Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1 | /* |
| 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 Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 7 | * Matt Porter <mporter@embeddedalley.com> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 8 | * |
| 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 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 31 | #include <linux/dmi.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 32 | #include <linux/module.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 33 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 34 | #include <sound/asoundef.h> |
Matthew Ranostay | 45a6ac1 | 2008-10-15 14:45:38 -0400 | [diff] [blame] | 35 | #include <sound/jack.h> |
Clemens Ladisch | a74ccea | 2010-10-22 15:52:34 +0200 | [diff] [blame] | 36 | #include <sound/tlv.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 37 | #include "hda_codec.h" |
| 38 | #include "hda_local.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 39 | #include "hda_beep.h" |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 40 | #include "hda_jack.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 41 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 42 | enum { |
| 43 | STAC_VREF_EVENT = 1, |
| 44 | STAC_INSERT_EVENT, |
| 45 | STAC_PWR_EVENT, |
| 46 | STAC_HP_EVENT, |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 47 | STAC_LO_EVENT, |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 48 | STAC_MIC_EVENT, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 49 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 50 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 51 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 52 | STAC_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 53 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 54 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 55 | STAC_9200_DELL_D21, |
| 56 | STAC_9200_DELL_D22, |
| 57 | STAC_9200_DELL_D23, |
| 58 | STAC_9200_DELL_M21, |
| 59 | STAC_9200_DELL_M22, |
| 60 | STAC_9200_DELL_M23, |
| 61 | STAC_9200_DELL_M24, |
| 62 | STAC_9200_DELL_M25, |
| 63 | STAC_9200_DELL_M26, |
| 64 | STAC_9200_DELL_M27, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 65 | STAC_9200_M4, |
| 66 | STAC_9200_M4_2, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 67 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 68 | STAC_9200_MODELS |
| 69 | }; |
| 70 | |
| 71 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 72 | STAC_9205_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 73 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 74 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 75 | STAC_9205_DELL_M43, |
| 76 | STAC_9205_DELL_M44, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 77 | STAC_9205_EAPD, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 78 | STAC_9205_MODELS |
| 79 | }; |
| 80 | |
| 81 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 82 | STAC_92HD73XX_AUTO, |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 83 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 84 | STAC_92HD73XX_REF, |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 85 | STAC_92HD73XX_INTEL, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 86 | STAC_DELL_M6_AMIC, |
| 87 | STAC_DELL_M6_DMIC, |
| 88 | STAC_DELL_M6_BOTH, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 89 | STAC_DELL_EQ, |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 90 | STAC_ALIENWARE_M17X, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 91 | STAC_92HD73XX_MODELS |
| 92 | }; |
| 93 | |
| 94 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 95 | STAC_92HD83XXX_AUTO, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 96 | STAC_92HD83XXX_REF, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 97 | STAC_92HD83XXX_PWR_REF, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 98 | STAC_DELL_S14, |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 99 | STAC_DELL_VOSTRO_3500, |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 100 | STAC_92HD83XXX_HP_cNB11_INTQUAD, |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 101 | STAC_HP_DV7_4000, |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 102 | STAC_HP_ZEPHYR, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 103 | STAC_92HD83XXX_MODELS |
| 104 | }; |
| 105 | |
| 106 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 107 | STAC_92HD71BXX_AUTO, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 108 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 109 | STAC_DELL_M4_1, |
| 110 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 111 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 112 | STAC_HP_M4, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 113 | STAC_HP_DV4, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 114 | STAC_HP_DV5, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 115 | STAC_HP_HDX, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 116 | STAC_HP_DV4_1222NR, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 117 | STAC_92HD71BXX_MODELS |
| 118 | }; |
| 119 | |
| 120 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 121 | STAC_925x_AUTO, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 122 | STAC_925x_REF, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 123 | STAC_M1, |
| 124 | STAC_M1_2, |
| 125 | STAC_M2, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 126 | STAC_M2_2, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 127 | STAC_M3, |
| 128 | STAC_M5, |
| 129 | STAC_M6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 130 | STAC_925x_MODELS |
| 131 | }; |
| 132 | |
| 133 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 134 | STAC_922X_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 135 | STAC_D945_REF, |
| 136 | STAC_D945GTP3, |
| 137 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 138 | STAC_INTEL_MAC_V1, |
| 139 | STAC_INTEL_MAC_V2, |
| 140 | STAC_INTEL_MAC_V3, |
| 141 | STAC_INTEL_MAC_V4, |
| 142 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 143 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 144 | * is given, one of the above models will be |
| 145 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 146 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 147 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 148 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 149 | STAC_MACBOOK_PRO_V1, |
| 150 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 151 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 152 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 153 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 154 | STAC_922X_DELL_D81, |
| 155 | STAC_922X_DELL_D82, |
| 156 | STAC_922X_DELL_M81, |
| 157 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 158 | STAC_922X_MODELS |
| 159 | }; |
| 160 | |
| 161 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 162 | STAC_927X_AUTO, |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 163 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 164 | STAC_D965_REF, |
| 165 | STAC_D965_3ST, |
| 166 | STAC_D965_5ST, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 167 | STAC_D965_5ST_NO_FP, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 168 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 169 | STAC_DELL_BIOS, |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 170 | STAC_927X_VOLKNOB, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 171 | STAC_927X_MODELS |
| 172 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 173 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 174 | enum { |
| 175 | STAC_9872_AUTO, |
| 176 | STAC_9872_VAIO, |
| 177 | STAC_9872_MODELS |
| 178 | }; |
| 179 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 180 | struct sigmatel_mic_route { |
| 181 | hda_nid_t pin; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 182 | signed char mux_idx; |
| 183 | signed char dmux_idx; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 184 | }; |
| 185 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 186 | #define MAX_PINS_NUM 16 |
| 187 | #define MAX_ADCS_NUM 4 |
| 188 | #define MAX_DMICS_NUM 4 |
| 189 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 190 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 191 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 192 | unsigned int num_mixers; |
| 193 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 194 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 195 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 196 | unsigned int surr_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 197 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 198 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 199 | unsigned int spdif_mute: 1; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 200 | unsigned int check_volume_offset:1; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 201 | unsigned int auto_mic:1; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 202 | unsigned int linear_tone_beep:1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 203 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 204 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 205 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 206 | unsigned int gpio_mask; |
| 207 | unsigned int gpio_dir; |
| 208 | unsigned int gpio_data; |
| 209 | unsigned int gpio_mute; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 210 | unsigned int gpio_led; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 211 | unsigned int gpio_led_polarity; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 212 | unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */ |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 213 | unsigned int vref_led; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 214 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 215 | /* stream */ |
| 216 | unsigned int stream_delay; |
| 217 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 218 | /* analog loopback */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 219 | const struct snd_kcontrol_new *aloopback_ctl; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 220 | unsigned char aloopback_mask; |
| 221 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 222 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 223 | /* power management */ |
| 224 | unsigned int num_pwrs; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 225 | const hda_nid_t *pwr_nids; |
| 226 | const hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 227 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 228 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 229 | struct hda_input_mux *mono_mux; |
| 230 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 231 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 232 | hda_nid_t dac_nids[5]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 233 | hda_nid_t hp_dacs[5]; |
| 234 | hda_nid_t speaker_dacs[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 235 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 236 | int volume_offset; |
| 237 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 238 | /* capture */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 239 | const hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 240 | unsigned int num_adcs; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 241 | const hda_nid_t *mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 242 | unsigned int num_muxes; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 243 | const hda_nid_t *dmic_nids; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 244 | unsigned int num_dmics; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 245 | const hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 246 | unsigned int num_dmuxes; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 247 | const hda_nid_t *smux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 248 | unsigned int num_smuxes; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 249 | unsigned int num_analog_muxes; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 250 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 251 | const unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ |
| 252 | const unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 253 | unsigned int num_caps; /* number of capture volume/switch elements */ |
| 254 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 255 | struct sigmatel_mic_route ext_mic; |
| 256 | struct sigmatel_mic_route int_mic; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 257 | struct sigmatel_mic_route dock_mic; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 258 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 259 | const char * const *spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 260 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 261 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 262 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 263 | hda_nid_t anabeep_nid; |
| 264 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 265 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 266 | /* pin widgets */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 267 | const hda_nid_t *pin_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 268 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 269 | |
| 270 | /* codec specific stuff */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 271 | const struct hda_verb *init; |
| 272 | const struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 273 | |
| 274 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 275 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 276 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 277 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 278 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 279 | struct hda_input_mux *sinput_mux; |
| 280 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 281 | unsigned int cur_amux; |
| 282 | hda_nid_t *amp_nids; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 283 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 284 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 285 | /* i/o switches */ |
| 286 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 287 | unsigned int clfe_swap; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 288 | hda_nid_t line_switch; /* shared line-in for input and output */ |
| 289 | hda_nid_t mic_switch; /* shared mic-in for input and output */ |
| 290 | hda_nid_t hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 291 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 292 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 293 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 294 | |
| 295 | /* dynamic controls and input_mux */ |
| 296 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 297 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 298 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 299 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 300 | struct hda_input_mux private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 301 | struct hda_input_mux private_mono_mux; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 302 | |
| 303 | /* auto spec */ |
| 304 | unsigned auto_pin_cnt; |
| 305 | hda_nid_t auto_pin_nids[MAX_PINS_NUM]; |
| 306 | unsigned auto_adc_cnt; |
| 307 | hda_nid_t auto_adc_nids[MAX_ADCS_NUM]; |
| 308 | hda_nid_t auto_mux_nids[MAX_ADCS_NUM]; |
| 309 | hda_nid_t auto_dmux_nids[MAX_ADCS_NUM]; |
| 310 | unsigned long auto_capvols[MAX_ADCS_NUM]; |
| 311 | unsigned auto_dmic_cnt; |
| 312 | hda_nid_t auto_dmic_nids[MAX_DMICS_NUM]; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 313 | |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 314 | struct hda_vmaster_mute_hook vmaster_mute; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 315 | }; |
| 316 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 317 | static const hda_nid_t stac9200_adc_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 318 | 0x03, |
| 319 | }; |
| 320 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 321 | static const hda_nid_t stac9200_mux_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 322 | 0x0c, |
| 323 | }; |
| 324 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 325 | static const hda_nid_t stac9200_dac_nids[1] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 326 | 0x02, |
| 327 | }; |
| 328 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 329 | static const hda_nid_t stac92hd73xx_pwr_nids[8] = { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 330 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 331 | 0x0f, 0x10, 0x11 |
| 332 | }; |
| 333 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 334 | static const hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 335 | 0x26, 0, |
| 336 | }; |
| 337 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 338 | static const hda_nid_t stac92hd73xx_adc_nids[2] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 339 | 0x1a, 0x1b |
| 340 | }; |
| 341 | |
| 342 | #define STAC92HD73XX_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 343 | static const hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 344 | 0x13, 0x14, 0 |
| 345 | }; |
| 346 | |
| 347 | #define STAC92HD73_DAC_COUNT 5 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 348 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 349 | static const hda_nid_t stac92hd73xx_mux_nids[2] = { |
Takashi Iwai | e2aec17 | 2009-09-02 01:00:05 +0200 | [diff] [blame] | 350 | 0x20, 0x21, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 351 | }; |
| 352 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 353 | static const hda_nid_t stac92hd73xx_dmux_nids[2] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 354 | 0x20, 0x21, |
| 355 | }; |
| 356 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 357 | static const hda_nid_t stac92hd73xx_smux_nids[2] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 358 | 0x22, 0x23, |
| 359 | }; |
| 360 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 361 | #define STAC92HD73XX_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 362 | static const unsigned long stac92hd73xx_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 363 | HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT), |
| 364 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 365 | }; |
| 366 | #define stac92hd73xx_capsws stac92hd73xx_capvols |
| 367 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 368 | #define STAC92HD83_DAC_COUNT 3 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 369 | |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 370 | static const hda_nid_t stac92hd83xxx_pwr_nids[7] = { |
| 371 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 372 | 0x0f, 0x10 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 373 | }; |
| 374 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 375 | static const hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 376 | 0x1e, 0, |
| 377 | }; |
| 378 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 379 | static const hda_nid_t stac92hd83xxx_dmic_nids[] = { |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 380 | 0x11, 0x20, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 381 | }; |
| 382 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 383 | static const hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 384 | 0x0a, 0x0d, 0x0f |
| 385 | }; |
| 386 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 387 | static const hda_nid_t stac92hd71bxx_adc_nids[2] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 388 | 0x12, 0x13, |
| 389 | }; |
| 390 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 391 | static const hda_nid_t stac92hd71bxx_mux_nids[2] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 392 | 0x1a, 0x1b |
| 393 | }; |
| 394 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 395 | static const hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 396 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 397 | }; |
| 398 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 399 | static const hda_nid_t stac92hd71bxx_smux_nids[2] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 400 | 0x24, 0x25, |
| 401 | }; |
| 402 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 403 | #define STAC92HD71BXX_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 404 | static const hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 405 | 0x18, 0x19, 0 |
| 406 | }; |
| 407 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 408 | static const hda_nid_t stac92hd71bxx_dmic_5port_nids[STAC92HD71BXX_NUM_DMICS] = { |
| 409 | 0x18, 0 |
| 410 | }; |
| 411 | |
| 412 | static const hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 413 | 0x22, 0 |
| 414 | }; |
| 415 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 416 | #define STAC92HD71BXX_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 417 | static const unsigned long stac92hd71bxx_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 418 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 419 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 420 | }; |
| 421 | #define stac92hd71bxx_capsws stac92hd71bxx_capvols |
| 422 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 423 | static const hda_nid_t stac925x_adc_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 424 | 0x03, |
| 425 | }; |
| 426 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 427 | static const hda_nid_t stac925x_mux_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 428 | 0x0f, |
| 429 | }; |
| 430 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 431 | static const hda_nid_t stac925x_dac_nids[1] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 432 | 0x02, |
| 433 | }; |
| 434 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 435 | #define STAC925X_NUM_DMICS 1 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 436 | static const hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 437 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 438 | }; |
| 439 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 440 | static const hda_nid_t stac925x_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 441 | 0x14, |
| 442 | }; |
| 443 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 444 | static const unsigned long stac925x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 445 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 446 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 447 | static const unsigned long stac925x_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 448 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 449 | }; |
| 450 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 451 | static const hda_nid_t stac922x_adc_nids[2] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 452 | 0x06, 0x07, |
| 453 | }; |
| 454 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 455 | static const hda_nid_t stac922x_mux_nids[2] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 456 | 0x12, 0x13, |
| 457 | }; |
| 458 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 459 | #define STAC922X_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 460 | static const unsigned long stac922x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 461 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT), |
| 462 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 463 | }; |
| 464 | #define stac922x_capsws stac922x_capvols |
| 465 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 466 | static const hda_nid_t stac927x_slave_dig_outs[2] = { |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 467 | 0x1f, 0, |
| 468 | }; |
| 469 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 470 | static const hda_nid_t stac927x_adc_nids[3] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 471 | 0x07, 0x08, 0x09 |
| 472 | }; |
| 473 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 474 | static const hda_nid_t stac927x_mux_nids[3] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 475 | 0x15, 0x16, 0x17 |
| 476 | }; |
| 477 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 478 | static const hda_nid_t stac927x_smux_nids[1] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 479 | 0x21, |
| 480 | }; |
| 481 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 482 | static const hda_nid_t stac927x_dac_nids[6] = { |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 483 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 484 | }; |
| 485 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 486 | static const hda_nid_t stac927x_dmux_nids[1] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 487 | 0x1b, |
| 488 | }; |
| 489 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 490 | #define STAC927X_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 491 | static const hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 492 | 0x13, 0x14, 0 |
| 493 | }; |
| 494 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 495 | #define STAC927X_NUM_CAPS 3 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 496 | static const unsigned long stac927x_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 497 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 498 | HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT), |
| 499 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT), |
| 500 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 501 | static const unsigned long stac927x_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 502 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 503 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 504 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 505 | }; |
| 506 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 507 | static const char * const stac927x_spdif_labels[5] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 508 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 509 | "Analog Mux 2", "Analog Mux 3" |
| 510 | }; |
| 511 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 512 | static const hda_nid_t stac9205_adc_nids[2] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 513 | 0x12, 0x13 |
| 514 | }; |
| 515 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 516 | static const hda_nid_t stac9205_mux_nids[2] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 517 | 0x19, 0x1a |
| 518 | }; |
| 519 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 520 | static const hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 521 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 522 | }; |
| 523 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 524 | static const hda_nid_t stac9205_smux_nids[1] = { |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 525 | 0x21, |
| 526 | }; |
| 527 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 528 | #define STAC9205_NUM_DMICS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 529 | static const hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 530 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 531 | }; |
| 532 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 533 | #define STAC9205_NUM_CAPS 2 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 534 | static const unsigned long stac9205_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 535 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT), |
| 536 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT), |
| 537 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 538 | static const unsigned long stac9205_capsws[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 539 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 540 | HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT), |
| 541 | }; |
| 542 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 543 | static const hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 544 | 0x08, 0x09, 0x0d, 0x0e, |
| 545 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 546 | }; |
| 547 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 548 | static const hda_nid_t stac925x_pin_nids[8] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 549 | 0x07, 0x08, 0x0a, 0x0b, |
| 550 | 0x0c, 0x0d, 0x10, 0x11, |
| 551 | }; |
| 552 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 553 | static const hda_nid_t stac922x_pin_nids[10] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 554 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 555 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 556 | }; |
| 557 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 558 | static const hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 559 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 560 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 561 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 562 | }; |
| 563 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 564 | #define STAC92HD71BXX_NUM_PINS 13 |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 565 | static const hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 566 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, |
| 567 | 0x00, 0x14, 0x18, 0x19, 0x1e, |
| 568 | 0x1f, 0x20, 0x27 |
| 569 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 570 | static const hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 571 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 572 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 573 | 0x1f, 0x20, 0x27 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 574 | }; |
| 575 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 576 | static const hda_nid_t stac927x_pin_nids[14] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 577 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 578 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 579 | 0x14, 0x21, 0x22, 0x23, |
| 580 | }; |
| 581 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 582 | static const hda_nid_t stac9205_pin_nids[12] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 583 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 584 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 585 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 586 | }; |
| 587 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 588 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_info *uinfo) |
| 590 | { |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | struct sigmatel_spec *spec = codec->spec; |
| 593 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 594 | } |
| 595 | |
| 596 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 597 | struct snd_ctl_elem_value *ucontrol) |
| 598 | { |
| 599 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 600 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 601 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 602 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 603 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 604 | return 0; |
| 605 | } |
| 606 | |
| 607 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 608 | struct snd_ctl_elem_value *ucontrol) |
| 609 | { |
| 610 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 611 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 612 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 613 | |
| 614 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 615 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 616 | } |
| 617 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 618 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 619 | struct snd_ctl_elem_info *uinfo) |
| 620 | { |
| 621 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 622 | struct sigmatel_spec *spec = codec->spec; |
| 623 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 624 | } |
| 625 | |
| 626 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 627 | struct snd_ctl_elem_value *ucontrol) |
| 628 | { |
| 629 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 630 | struct sigmatel_spec *spec = codec->spec; |
| 631 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 632 | |
| 633 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 634 | return 0; |
| 635 | } |
| 636 | |
| 637 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 638 | struct snd_ctl_elem_value *ucontrol) |
| 639 | { |
| 640 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 641 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 642 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 643 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 644 | int err, val; |
| 645 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 646 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 647 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 648 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 649 | if (err < 0) |
| 650 | return err; |
| 651 | |
| 652 | if (spec->spdif_mute) { |
| 653 | if (smux_idx == 0) |
| 654 | nid = spec->multiout.dig_out_nid; |
| 655 | else |
| 656 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 657 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 658 | val = HDA_AMP_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 659 | else |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 660 | val = 0; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 661 | /* un/mute SPDIF out */ |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 662 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 663 | HDA_AMP_MUTE, val); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 664 | } |
| 665 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 666 | } |
| 667 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 668 | static int stac_vrefout_set(struct hda_codec *codec, |
| 669 | hda_nid_t nid, unsigned int new_vref) |
| 670 | { |
| 671 | int error, pinctl; |
| 672 | |
| 673 | snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref); |
| 674 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 675 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 676 | |
| 677 | if (pinctl < 0) |
| 678 | return pinctl; |
| 679 | |
| 680 | pinctl &= 0xff; |
| 681 | pinctl &= ~AC_PINCTL_VREFEN; |
| 682 | pinctl |= (new_vref & AC_PINCTL_VREFEN); |
| 683 | |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 684 | error = snd_hda_set_pin_ctl_cache(codec, nid, pinctl); |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 685 | if (error < 0) |
| 686 | return error; |
| 687 | |
| 688 | return 1; |
| 689 | } |
| 690 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 691 | static unsigned int stac92xx_vref_set(struct hda_codec *codec, |
| 692 | hda_nid_t nid, unsigned int new_vref) |
| 693 | { |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 694 | int error; |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 695 | unsigned int pincfg; |
| 696 | pincfg = snd_hda_codec_read(codec, nid, 0, |
| 697 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 698 | |
| 699 | pincfg &= 0xff; |
| 700 | pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 701 | pincfg |= new_vref; |
| 702 | |
| 703 | if (new_vref == AC_PINCTL_VREF_HIZ) |
| 704 | pincfg |= AC_PINCTL_OUT_EN; |
| 705 | else |
| 706 | pincfg |= AC_PINCTL_IN_EN; |
| 707 | |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 708 | error = snd_hda_set_pin_ctl_cache(codec, nid, pincfg); |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 709 | if (error < 0) |
| 710 | return error; |
| 711 | else |
| 712 | return 1; |
| 713 | } |
| 714 | |
| 715 | static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid) |
| 716 | { |
| 717 | unsigned int vref; |
| 718 | vref = snd_hda_codec_read(codec, nid, 0, |
| 719 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 720 | vref &= AC_PINCTL_VREFEN; |
| 721 | return vref; |
| 722 | } |
| 723 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 724 | static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 725 | { |
| 726 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 727 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 728 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 729 | } |
| 730 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 731 | static int stac92xx_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 732 | { |
| 733 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 734 | struct sigmatel_spec *spec = codec->spec; |
| 735 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 736 | |
| 737 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 738 | return 0; |
| 739 | } |
| 740 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 741 | static int stac92xx_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 742 | { |
| 743 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 744 | struct sigmatel_spec *spec = codec->spec; |
| 745 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 746 | const struct hda_input_mux *imux = spec->input_mux; |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 747 | unsigned int idx, prev_idx, didx; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 748 | |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 749 | idx = ucontrol->value.enumerated.item[0]; |
| 750 | if (idx >= imux->num_items) |
| 751 | idx = imux->num_items - 1; |
| 752 | prev_idx = spec->cur_mux[adc_idx]; |
| 753 | if (prev_idx == idx) |
| 754 | return 0; |
| 755 | if (idx < spec->num_analog_muxes) { |
| 756 | snd_hda_codec_write_cache(codec, spec->mux_nids[adc_idx], 0, |
| 757 | AC_VERB_SET_CONNECT_SEL, |
| 758 | imux->items[idx].index); |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 759 | if (prev_idx >= spec->num_analog_muxes && |
| 760 | spec->mux_nids[adc_idx] != spec->dmux_nids[adc_idx]) { |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 761 | imux = spec->dinput_mux; |
| 762 | /* 0 = analog */ |
| 763 | snd_hda_codec_write_cache(codec, |
| 764 | spec->dmux_nids[adc_idx], 0, |
| 765 | AC_VERB_SET_CONNECT_SEL, |
| 766 | imux->items[0].index); |
| 767 | } |
| 768 | } else { |
| 769 | imux = spec->dinput_mux; |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 770 | /* first dimux item is hardcoded to select analog imux, |
| 771 | * so lets skip it |
| 772 | */ |
| 773 | didx = idx - spec->num_analog_muxes + 1; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 774 | snd_hda_codec_write_cache(codec, spec->dmux_nids[adc_idx], 0, |
| 775 | AC_VERB_SET_CONNECT_SEL, |
Vitaliy Kulikov | 094a424 | 2011-03-09 19:47:43 -0600 | [diff] [blame] | 776 | imux->items[didx].index); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 777 | } |
| 778 | spec->cur_mux[adc_idx] = idx; |
| 779 | return 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 780 | } |
| 781 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 782 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 783 | struct snd_ctl_elem_info *uinfo) |
| 784 | { |
| 785 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 786 | struct sigmatel_spec *spec = codec->spec; |
| 787 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 788 | } |
| 789 | |
| 790 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 791 | struct snd_ctl_elem_value *ucontrol) |
| 792 | { |
| 793 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 794 | struct sigmatel_spec *spec = codec->spec; |
| 795 | |
| 796 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 797 | return 0; |
| 798 | } |
| 799 | |
| 800 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 801 | struct snd_ctl_elem_value *ucontrol) |
| 802 | { |
| 803 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 804 | struct sigmatel_spec *spec = codec->spec; |
| 805 | |
| 806 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 807 | spec->mono_nid, &spec->cur_mmux); |
| 808 | } |
| 809 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 810 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 811 | |
| 812 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 813 | struct snd_ctl_elem_value *ucontrol) |
| 814 | { |
| 815 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 816 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 817 | struct sigmatel_spec *spec = codec->spec; |
| 818 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 819 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 820 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 821 | return 0; |
| 822 | } |
| 823 | |
| 824 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 825 | struct snd_ctl_elem_value *ucontrol) |
| 826 | { |
| 827 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 828 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 829 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 830 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 831 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 832 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 833 | idx_val = spec->aloopback_mask << idx; |
| 834 | if (ucontrol->value.integer.value[0]) |
| 835 | val = spec->aloopback | idx_val; |
| 836 | else |
| 837 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 838 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 839 | return 0; |
| 840 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 841 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 842 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 843 | /* Only return the bits defined by the shift value of the |
| 844 | * first two bytes of the mask |
| 845 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 846 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 847 | kcontrol->private_value & 0xFFFF, 0x0); |
| 848 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 849 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 850 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 851 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 852 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 853 | } else { |
| 854 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 855 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 856 | } |
| 857 | |
| 858 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 859 | kcontrol->private_value >> 16, dac_mode); |
| 860 | |
| 861 | return 1; |
| 862 | } |
| 863 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 864 | static const struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 865 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 866 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 867 | {} |
| 868 | }; |
| 869 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 870 | static const struct hda_verb stac9200_eapd_init[] = { |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 871 | /* set dac0mux for dac converter */ |
| 872 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 873 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 874 | {} |
| 875 | }; |
| 876 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 877 | static const struct hda_verb dell_eq_core_init[] = { |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 878 | /* set master volume to max value without distortion |
| 879 | * and direct control */ |
| 880 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 881 | {} |
| 882 | }; |
| 883 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 884 | static const struct hda_verb stac92hd73xx_core_init[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 885 | /* set master volume and direct control */ |
| 886 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 887 | {} |
| 888 | }; |
| 889 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 890 | static const struct hda_verb stac92hd83xxx_core_init[] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 891 | /* power state controls amps */ |
| 892 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 893 | {} |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 894 | }; |
| 895 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 896 | static const struct hda_verb stac92hd83xxx_hp_zephyr_init[] = { |
| 897 | { 0x22, 0x785, 0x43 }, |
| 898 | { 0x22, 0x782, 0xe0 }, |
| 899 | { 0x22, 0x795, 0x00 }, |
| 900 | {} |
| 901 | }; |
| 902 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 903 | static const struct hda_verb stac92hd71bxx_core_init[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 904 | /* set master volume and direct control */ |
| 905 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 906 | {} |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 907 | }; |
| 908 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 909 | static const struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 910 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
| 911 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 912 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 913 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 914 | {} |
| 915 | }; |
| 916 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 917 | static const struct hda_verb stac925x_core_init[] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 918 | /* set dac0mux for dac converter */ |
| 919 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 920 | /* mute the master volume */ |
| 921 | { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 922 | {} |
| 923 | }; |
| 924 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 925 | static const struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 926 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 927 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 928 | {} |
| 929 | }; |
| 930 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 931 | static const struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 932 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 933 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 934 | /* unmute node 0x1b */ |
| 935 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 936 | /* select node 0x03 as DAC */ |
| 937 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 938 | {} |
| 939 | }; |
| 940 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 941 | static const struct hda_verb dell_3st_core_init[] = { |
Takashi Iwai | ccca7cd | 2009-10-13 15:32:21 +0200 | [diff] [blame] | 942 | /* don't set delta bit */ |
| 943 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, |
| 944 | /* unmute node 0x1b */ |
| 945 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 946 | /* select node 0x03 as DAC */ |
| 947 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 948 | {} |
| 949 | }; |
| 950 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 951 | static const struct hda_verb stac927x_core_init[] = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 952 | /* set master volume and direct control */ |
| 953 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 954 | /* enable analog pc beep path */ |
| 955 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 956 | {} |
| 957 | }; |
| 958 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 959 | static const struct hda_verb stac927x_volknob_core_init[] = { |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 960 | /* don't set delta bit */ |
| 961 | {0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0x7f}, |
| 962 | /* enable analog pc beep path */ |
| 963 | {0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
| 964 | {} |
| 965 | }; |
| 966 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 967 | static const struct hda_verb stac9205_core_init[] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 968 | /* set master volume and direct control */ |
| 969 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 970 | /* enable analog pc beep path */ |
| 971 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 972 | {} |
| 973 | }; |
| 974 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 975 | #define STAC_MONO_MUX \ |
| 976 | { \ |
| 977 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 978 | .name = "Mono Mux", \ |
| 979 | .count = 1, \ |
| 980 | .info = stac92xx_mono_mux_enum_info, \ |
| 981 | .get = stac92xx_mono_mux_enum_get, \ |
| 982 | .put = stac92xx_mono_mux_enum_put, \ |
| 983 | } |
| 984 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 985 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 986 | { \ |
| 987 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 988 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 989 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 990 | .info = stac92xx_aloopback_info, \ |
| 991 | .get = stac92xx_aloopback_get, \ |
| 992 | .put = stac92xx_aloopback_put, \ |
| 993 | .private_value = verb_read | (verb_write << 16), \ |
| 994 | } |
| 995 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 996 | #define DC_BIAS(xname, idx, nid) \ |
| 997 | { \ |
| 998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 999 | .name = xname, \ |
| 1000 | .index = idx, \ |
| 1001 | .info = stac92xx_dc_bias_info, \ |
| 1002 | .get = stac92xx_dc_bias_get, \ |
| 1003 | .put = stac92xx_dc_bias_put, \ |
| 1004 | .private_value = nid, \ |
| 1005 | } |
| 1006 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1007 | static const struct snd_kcontrol_new stac9200_mixer[] = { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1008 | HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 1009 | HDA_CODEC_MUTE("PCM Playback Switch", 0xb, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1010 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 1011 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1012 | { } /* end */ |
| 1013 | }; |
| 1014 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1015 | static const struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1016 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1017 | {} |
| 1018 | }; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1019 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1020 | static const struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1021 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1022 | {} |
| 1023 | }; |
| 1024 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1025 | static const struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1026 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 1027 | {} |
| 1028 | }; |
| 1029 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1030 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1031 | static const struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1032 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
| 1033 | }; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1034 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1035 | static const struct snd_kcontrol_new stac925x_mixer[] = { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1036 | HDA_CODEC_VOLUME_MIN_MUTE("PCM Playback Volume", 0xe, 0, HDA_OUTPUT), |
| 1037 | HDA_CODEC_MUTE("PCM Playback Switch", 0x0e, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1038 | { } /* end */ |
| 1039 | }; |
| 1040 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1041 | static const struct snd_kcontrol_new stac9205_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1042 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
| 1043 | {} |
| 1044 | }; |
| 1045 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1046 | static const struct snd_kcontrol_new stac927x_loopback[] = { |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1047 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
| 1048 | {} |
| 1049 | }; |
| 1050 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1051 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1052 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1053 | .name = "Digital Input Source", |
| 1054 | /* count set later */ |
| 1055 | .info = stac92xx_dmux_enum_info, |
| 1056 | .get = stac92xx_dmux_enum_get, |
| 1057 | .put = stac92xx_dmux_enum_put, |
| 1058 | }; |
| 1059 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1060 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1061 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1062 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1063 | /* count set later */ |
| 1064 | .info = stac92xx_smux_enum_info, |
| 1065 | .get = stac92xx_smux_enum_get, |
| 1066 | .put = stac92xx_smux_enum_put, |
| 1067 | }; |
| 1068 | |
Takashi Iwai | 9322ca5 | 2012-02-03 14:28:01 +0100 | [diff] [blame] | 1069 | static const char * const slave_pfxs[] = { |
| 1070 | "Front", "Surround", "Center", "LFE", "Side", |
| 1071 | "Headphone", "Speaker", "IEC958", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1072 | NULL |
| 1073 | }; |
| 1074 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1075 | static void stac92xx_update_led_status(struct hda_codec *codec, int enabled); |
| 1076 | |
| 1077 | static void stac92xx_vmaster_hook(void *private_data, int val) |
| 1078 | { |
| 1079 | stac92xx_update_led_status(private_data, val); |
| 1080 | } |
| 1081 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1082 | static void stac92xx_free_kctls(struct hda_codec *codec); |
| 1083 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1084 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1085 | { |
| 1086 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1087 | unsigned int vmaster_tlv[4]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1088 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1089 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1090 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 1091 | if (spec->mixer) { |
| 1092 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1093 | if (err < 0) |
| 1094 | return err; |
| 1095 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1096 | |
| 1097 | for (i = 0; i < spec->num_mixers; i++) { |
| 1098 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1099 | if (err < 0) |
| 1100 | return err; |
| 1101 | } |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 1102 | if (!spec->auto_mic && spec->num_dmuxes > 0 && |
| 1103 | snd_hda_get_bool_hint(codec, "separate_dmux") == 1) { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1104 | stac_dmux_mixer.count = spec->num_dmuxes; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 1105 | err = snd_hda_ctl_add(codec, 0, |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1106 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1107 | if (err < 0) |
| 1108 | return err; |
| 1109 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1110 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1111 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1112 | struct hda_input_mux *smux = &spec->private_smux; |
| 1113 | /* check for mute support on SPDIF out */ |
| 1114 | if (wcaps & AC_WCAP_OUT_AMP) { |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 1115 | snd_hda_add_imux_item(smux, "Off", 0, NULL); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1116 | spec->spdif_mute = 1; |
| 1117 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1118 | stac_smux_mixer.count = spec->num_smuxes; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 1119 | err = snd_hda_ctl_add(codec, 0, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1120 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1121 | if (err < 0) |
| 1122 | return err; |
| 1123 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1124 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1125 | if (spec->multiout.dig_out_nid) { |
Stephen Warren | 74b654c | 2011-06-01 11:14:18 -0600 | [diff] [blame] | 1126 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1127 | spec->multiout.dig_out_nid, |
| 1128 | spec->multiout.dig_out_nid); |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1129 | if (err < 0) |
| 1130 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1131 | err = snd_hda_create_spdif_share_sw(codec, |
| 1132 | &spec->multiout); |
| 1133 | if (err < 0) |
| 1134 | return err; |
| 1135 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1136 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1137 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1138 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1139 | if (err < 0) |
| 1140 | return err; |
| 1141 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1142 | |
| 1143 | /* if we have no master control, let's create it */ |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1144 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
| 1145 | HDA_OUTPUT, vmaster_tlv); |
| 1146 | /* correct volume offset */ |
| 1147 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; |
| 1148 | /* minimum value is actually mute */ |
| 1149 | vmaster_tlv[3] |= TLV_DB_SCALE_MUTE; |
| 1150 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1151 | vmaster_tlv, slave_pfxs, |
| 1152 | "Playback Volume"); |
| 1153 | if (err < 0) |
| 1154 | return err; |
| 1155 | |
| 1156 | err = __snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1157 | NULL, slave_pfxs, |
| 1158 | "Playback Switch", true, |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1159 | &spec->vmaster_mute.sw_kctl); |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 1160 | if (err < 0) |
| 1161 | return err; |
| 1162 | |
| 1163 | if (spec->gpio_led) { |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1164 | spec->vmaster_mute.hook = stac92xx_vmaster_hook; |
Takashi Iwai | f29735cb | 2012-03-13 07:55:10 +0100 | [diff] [blame] | 1165 | err = snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true); |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 1166 | if (err < 0) |
| 1167 | return err; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1168 | } |
| 1169 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1170 | if (spec->aloopback_ctl && |
| 1171 | snd_hda_get_bool_hint(codec, "loopback") == 1) { |
| 1172 | err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); |
| 1173 | if (err < 0) |
| 1174 | return err; |
| 1175 | } |
| 1176 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1177 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1178 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 1179 | err = snd_hda_jack_add_kctls(codec, &spec->autocfg); |
| 1180 | if (err < 0) |
| 1181 | return err; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1182 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1183 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1184 | } |
| 1185 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1186 | static const unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1187 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1188 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1189 | }; |
| 1190 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1191 | static const unsigned int gateway9200_m4_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1192 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1193 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1194 | }; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1195 | static const unsigned int gateway9200_m4_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1196 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1197 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1198 | }; |
| 1199 | |
| 1200 | /* |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1201 | STAC 9200 pin configs for |
| 1202 | 102801A8 |
| 1203 | 102801DE |
| 1204 | 102801E8 |
| 1205 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1206 | static const unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1207 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1208 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1209 | }; |
| 1210 | |
| 1211 | /* |
| 1212 | STAC 9200 pin configs for |
| 1213 | 102801C0 |
| 1214 | 102801C1 |
| 1215 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1216 | static const unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1217 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1218 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1219 | }; |
| 1220 | |
| 1221 | /* |
| 1222 | STAC 9200 pin configs for |
| 1223 | 102801C4 (Dell Dimension E310) |
| 1224 | 102801C5 |
| 1225 | 102801C7 |
| 1226 | 102801D9 |
| 1227 | 102801DA |
| 1228 | 102801E3 |
| 1229 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1230 | static const unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1231 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1232 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1233 | }; |
| 1234 | |
| 1235 | |
| 1236 | /* |
| 1237 | STAC 9200-32 pin configs for |
| 1238 | 102801B5 (Dell Inspiron 630m) |
| 1239 | 102801D8 (Dell Inspiron 640m) |
| 1240 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1241 | static const unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1242 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1243 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1244 | }; |
| 1245 | |
| 1246 | /* |
| 1247 | STAC 9200-32 pin configs for |
| 1248 | 102801C2 (Dell Latitude D620) |
| 1249 | 102801C8 |
| 1250 | 102801CC (Dell Latitude D820) |
| 1251 | 102801D4 |
| 1252 | 102801D6 |
| 1253 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1254 | static const unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1255 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1256 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1257 | }; |
| 1258 | |
| 1259 | /* |
| 1260 | STAC 9200-32 pin configs for |
| 1261 | 102801CE (Dell XPS M1710) |
| 1262 | 102801CF (Dell Precision M90) |
| 1263 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1264 | static const unsigned int dell9200_m23_pin_configs[8] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1265 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1266 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1267 | }; |
| 1268 | |
| 1269 | /* |
| 1270 | STAC 9200-32 pin configs for |
| 1271 | 102801C9 |
| 1272 | 102801CA |
| 1273 | 102801CB (Dell Latitude 120L) |
| 1274 | 102801D3 |
| 1275 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1276 | static const unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1277 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1278 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1279 | }; |
| 1280 | |
| 1281 | /* |
| 1282 | STAC 9200-32 pin configs for |
| 1283 | 102801BD (Dell Inspiron E1505n) |
| 1284 | 102801EE |
| 1285 | 102801EF |
| 1286 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1287 | static const unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1288 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1289 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1290 | }; |
| 1291 | |
| 1292 | /* |
| 1293 | STAC 9200-32 pin configs for |
| 1294 | 102801F5 (Dell Inspiron 1501) |
| 1295 | 102801F6 |
| 1296 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1297 | static const unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1298 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1299 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1300 | }; |
| 1301 | |
| 1302 | /* |
| 1303 | STAC 9200-32 |
| 1304 | 102801CD (Dell Inspiron E1705/9400) |
| 1305 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1306 | static const unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1307 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1308 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1309 | }; |
| 1310 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1311 | static const unsigned int oqo9200_pin_configs[8] = { |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1312 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1313 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1314 | }; |
| 1315 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1316 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1317 | static const unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1318 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1319 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1320 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1321 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1322 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1323 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1324 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1325 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1326 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1327 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1328 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1329 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1330 | [STAC_9200_M4] = gateway9200_m4_pin_configs, |
| 1331 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1332 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1333 | }; |
| 1334 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1335 | static const char * const stac9200_models[STAC_9200_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1336 | [STAC_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1337 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1338 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1339 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1340 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1341 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1342 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1343 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1344 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1345 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1346 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1347 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1348 | [STAC_9200_DELL_M27] = "dell-m27", |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1349 | [STAC_9200_M4] = "gateway-m4", |
| 1350 | [STAC_9200_M4_2] = "gateway-m4-2", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1351 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1352 | }; |
| 1353 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1354 | static const struct snd_pci_quirk stac9200_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1355 | /* SigmaTel reference board */ |
| 1356 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1357 | "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1358 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1359 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1360 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1361 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1362 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1363 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1364 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1365 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1366 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1367 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1368 | "unknown Dell", STAC_9200_DELL_D22), |
| 1369 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1370 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1371 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1372 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1373 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1374 | "unknown Dell", STAC_9200_DELL_D23), |
| 1375 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1376 | "unknown Dell", STAC_9200_DELL_D23), |
| 1377 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1378 | "unknown Dell", STAC_9200_DELL_M22), |
| 1379 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1380 | "unknown Dell", STAC_9200_DELL_M24), |
| 1381 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1382 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1383 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1384 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1385 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1386 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1387 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1388 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1389 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1390 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1391 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1392 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1393 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1394 | "unknown Dell", STAC_9200_DELL_M22), |
| 1395 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1396 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1397 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1398 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1399 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1400 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1401 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1402 | "unknown Dell", STAC_9200_DELL_D23), |
| 1403 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1404 | "unknown Dell", STAC_9200_DELL_D23), |
| 1405 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1406 | "unknown Dell", STAC_9200_DELL_D21), |
| 1407 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1408 | "unknown Dell", STAC_9200_DELL_D23), |
| 1409 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1410 | "unknown Dell", STAC_9200_DELL_D21), |
| 1411 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1412 | "unknown Dell", STAC_9200_DELL_M25), |
| 1413 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1414 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1415 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1416 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1417 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1418 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1419 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1420 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1421 | /* Gateway machines needs EAPD to be set on resume */ |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1422 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
| 1423 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
| 1424 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1425 | /* OQO Mobile */ |
| 1426 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1427 | {} /* terminator */ |
| 1428 | }; |
| 1429 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1430 | static const unsigned int ref925x_pin_configs[8] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1431 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1432 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1433 | }; |
| 1434 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1435 | static const unsigned int stac925xM1_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1436 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1437 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1438 | }; |
| 1439 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1440 | static const unsigned int stac925xM1_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1441 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1442 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1443 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1444 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1445 | static const unsigned int stac925xM2_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1446 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1447 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1448 | }; |
| 1449 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1450 | static const unsigned int stac925xM2_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1451 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1452 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1453 | }; |
| 1454 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1455 | static const unsigned int stac925xM3_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1456 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1457 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, |
| 1458 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1459 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1460 | static const unsigned int stac925xM5_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1461 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1462 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1463 | }; |
| 1464 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1465 | static const unsigned int stac925xM6_pin_configs[8] = { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1466 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1467 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1468 | }; |
| 1469 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1470 | static const unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1471 | [STAC_REF] = ref925x_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1472 | [STAC_M1] = stac925xM1_pin_configs, |
| 1473 | [STAC_M1_2] = stac925xM1_2_pin_configs, |
| 1474 | [STAC_M2] = stac925xM2_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1475 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1476 | [STAC_M3] = stac925xM3_pin_configs, |
| 1477 | [STAC_M5] = stac925xM5_pin_configs, |
| 1478 | [STAC_M6] = stac925xM6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1479 | }; |
| 1480 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1481 | static const char * const stac925x_models[STAC_925x_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1482 | [STAC_925x_AUTO] = "auto", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1483 | [STAC_REF] = "ref", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1484 | [STAC_M1] = "m1", |
| 1485 | [STAC_M1_2] = "m1-2", |
| 1486 | [STAC_M2] = "m2", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1487 | [STAC_M2_2] = "m2-2", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1488 | [STAC_M3] = "m3", |
| 1489 | [STAC_M5] = "m5", |
| 1490 | [STAC_M6] = "m6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1491 | }; |
| 1492 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1493 | static const struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1494 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), |
| 1495 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), |
| 1496 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), |
| 1497 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1498 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1499 | /* Not sure about the brand name for those */ |
| 1500 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), |
| 1501 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), |
| 1502 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), |
| 1503 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1504 | {} /* terminator */ |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1505 | }; |
| 1506 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1507 | static const struct snd_pci_quirk stac925x_cfg_tbl[] = { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1508 | /* SigmaTel reference board */ |
| 1509 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1510 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1511 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1512 | |
| 1513 | /* Default table for unknown ID */ |
| 1514 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
| 1515 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1516 | {} /* terminator */ |
| 1517 | }; |
| 1518 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1519 | static const unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1520 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1521 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1522 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1523 | 0x01452050, |
| 1524 | }; |
| 1525 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1526 | static const unsigned int dell_m6_pin_configs[13] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1527 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1528 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1529 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1530 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1531 | }; |
| 1532 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1533 | static const unsigned int alienware_m17x_pin_configs[13] = { |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1534 | 0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, |
| 1535 | 0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, |
| 1536 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1537 | 0x904601b0, |
| 1538 | }; |
| 1539 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1540 | static const unsigned int intel_dg45id_pin_configs[13] = { |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1541 | 0x02214230, 0x02A19240, 0x01013214, 0x01014210, |
Wu Fengguang | 4d26f44 | 2010-05-07 08:47:54 +0800 | [diff] [blame] | 1542 | 0x01A19250, 0x01011212, 0x01016211 |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1543 | }; |
| 1544 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1545 | static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1546 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1547 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
| 1548 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
| 1549 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1550 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1551 | [STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, |
Alexey Fisher | 52dc438 | 2009-12-12 11:16:41 +0200 | [diff] [blame] | 1552 | [STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1553 | }; |
| 1554 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1555 | static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1556 | [STAC_92HD73XX_AUTO] = "auto", |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 1557 | [STAC_92HD73XX_NO_JD] = "no-jd", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1558 | [STAC_92HD73XX_REF] = "ref", |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 1559 | [STAC_92HD73XX_INTEL] = "intel", |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1560 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
| 1561 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
| 1562 | [STAC_DELL_M6_BOTH] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1563 | [STAC_DELL_EQ] = "dell-eq", |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1564 | [STAC_ALIENWARE_M17X] = "alienware", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1565 | }; |
| 1566 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1567 | static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1568 | /* SigmaTel reference board */ |
| 1569 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1570 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1571 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1572 | "DFI LanParty", STAC_92HD73XX_REF), |
Wu Fengguang | ae70944 | 2009-08-19 17:05:11 +0800 | [diff] [blame] | 1573 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5002, |
| 1574 | "Intel DG45ID", STAC_92HD73XX_INTEL), |
| 1575 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5003, |
| 1576 | "Intel DG45FC", STAC_92HD73XX_INTEL), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1577 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1578 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1579 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1580 | "unknown Dell", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1581 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1582 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1583 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1584 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1585 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1586 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1587 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1588 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1589 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1590 | "unknown Dell", STAC_DELL_M6_DMIC), |
| 1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, |
| 1592 | "unknown Dell", STAC_DELL_M6_DMIC), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1594 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
Joerg Schirottke | fa620e9 | 2008-12-19 08:13:49 +0100 | [diff] [blame] | 1595 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, |
| 1596 | "Dell Studio 17", STAC_DELL_M6_DMIC), |
Takashi Iwai | 626f5ce | 2009-07-28 00:54:39 +0200 | [diff] [blame] | 1597 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02be, |
| 1598 | "Dell Studio 1555", STAC_DELL_M6_DMIC), |
Daniel J Blueman | 8ef5837 | 2009-11-14 18:20:04 +0000 | [diff] [blame] | 1599 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd, |
| 1600 | "Dell Studio 1557", STAC_DELL_M6_DMIC), |
Daniel T Chen | aac78da | 2010-04-21 20:41:52 -0400 | [diff] [blame] | 1601 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe, |
David Henningsson | ffe535e | 2012-01-16 10:52:20 +0100 | [diff] [blame] | 1602 | "Dell Studio XPS 1645", STAC_DELL_M6_DMIC), |
Daniel T Chen | 5c1bccf | 2010-04-22 17:54:45 -0400 | [diff] [blame] | 1603 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, |
David Henningsson | e033ebf | 2011-05-16 12:09:29 +0200 | [diff] [blame] | 1604 | "Dell Studio 1558", STAC_DELL_M6_DMIC), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1605 | {} /* terminator */ |
| 1606 | }; |
| 1607 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1608 | static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = { |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1609 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, |
| 1610 | "Alienware M17x", STAC_ALIENWARE_M17X), |
Daniel T Chen | 0defe09 | 2010-12-01 19:16:07 -0500 | [diff] [blame] | 1611 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, |
| 1612 | "Alienware M17x", STAC_ALIENWARE_M17X), |
Takashi Iwai | dbd1b54 | 2011-11-19 11:41:30 +0100 | [diff] [blame] | 1613 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, |
Albert Pool | b9ecc4e | 2012-01-19 22:08:50 +0100 | [diff] [blame] | 1614 | "Alienware M17x R3", STAC_DELL_EQ), |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 1615 | {} /* terminator */ |
| 1616 | }; |
| 1617 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1618 | static const unsigned int ref92hd83xxx_pin_configs[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1619 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1620 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1621 | 0x01451160, 0x98560170, |
| 1622 | }; |
| 1623 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1624 | static const unsigned int dell_s14_pin_configs[10] = { |
Takashi Iwai | 69b5655 | 2009-09-15 12:37:42 +0200 | [diff] [blame] | 1625 | 0x0221403f, 0x0221101f, 0x02a19020, 0x90170110, |
| 1626 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a60160, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1627 | 0x40f000f0, 0x40f000f0, |
| 1628 | }; |
| 1629 | |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1630 | static const unsigned int dell_vostro_3500_pin_configs[10] = { |
| 1631 | 0x02a11020, 0x0221101f, 0x400000f0, 0x90170110, |
| 1632 | 0x400000f1, 0x400000f2, 0x400000f3, 0x90a60160, |
| 1633 | 0x400000f4, 0x400000f5, |
| 1634 | }; |
| 1635 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1636 | static const unsigned int hp_dv7_4000_pin_configs[10] = { |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1637 | 0x03a12050, 0x0321201f, 0x40f000f0, 0x90170110, |
| 1638 | 0x40f000f0, 0x40f000f0, 0x90170110, 0xd5a30140, |
| 1639 | 0x40f000f0, 0x40f000f0, |
| 1640 | }; |
| 1641 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1642 | static const unsigned int hp_zephyr_pin_configs[10] = { |
| 1643 | 0x01813050, 0x0421201f, 0x04a1205e, 0x96130310, |
| 1644 | 0x96130310, 0x0101401f, 0x1111611f, 0xd5a30130, |
| 1645 | 0, 0, |
| 1646 | }; |
| 1647 | |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1648 | static const unsigned int hp_cNB11_intquad_pin_configs[10] = { |
| 1649 | 0x40f000f0, 0x0221101f, 0x02a11020, 0x92170110, |
| 1650 | 0x40f000f0, 0x92170110, 0x40f000f0, 0xd5a30130, |
| 1651 | 0x40f000f0, 0x40f000f0, |
| 1652 | }; |
| 1653 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1654 | static const unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1655 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1656 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1657 | [STAC_DELL_S14] = dell_s14_pin_configs, |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1658 | [STAC_DELL_VOSTRO_3500] = dell_vostro_3500_pin_configs, |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1659 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = hp_cNB11_intquad_pin_configs, |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1660 | [STAC_HP_DV7_4000] = hp_dv7_4000_pin_configs, |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1661 | [STAC_HP_ZEPHYR] = hp_zephyr_pin_configs, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1662 | }; |
| 1663 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1664 | static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1665 | [STAC_92HD83XXX_AUTO] = "auto", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1666 | [STAC_92HD83XXX_REF] = "ref", |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1667 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1668 | [STAC_DELL_S14] = "dell-s14", |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1669 | [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1670 | [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", |
Steven Eastland | 4831559 | 2010-08-06 15:07:35 -0600 | [diff] [blame] | 1671 | [STAC_HP_DV7_4000] = "hp-dv7-4000", |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1672 | [STAC_HP_ZEPHYR] = "hp-zephyr", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1673 | }; |
| 1674 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1675 | static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1676 | /* SigmaTel reference board */ |
| 1677 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Takashi Iwai | f9d088b | 2009-01-13 11:54:49 +0100 | [diff] [blame] | 1678 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1679 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1680 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1681 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
| 1682 | "unknown Dell", STAC_DELL_S14), |
Julian Wollrath | f7f9bdf | 2011-11-09 10:02:40 +0100 | [diff] [blame] | 1683 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, |
| 1684 | "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), |
Vitaliy Kulikov | 0c27c18 | 2011-07-22 17:50:37 -0500 | [diff] [blame] | 1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, |
| 1686 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, |
| 1688 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, |
| 1690 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1691 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, |
| 1692 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1693 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, |
| 1694 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1695 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, |
| 1696 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3388, |
| 1698 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1699 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3389, |
| 1700 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1701 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355B, |
| 1702 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1703 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355C, |
| 1704 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1705 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355D, |
| 1706 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1707 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355E, |
| 1708 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1709 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x355F, |
| 1710 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1711 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3560, |
| 1712 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1713 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358B, |
| 1714 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1715 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358C, |
| 1716 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1717 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x358D, |
| 1718 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1719 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3591, |
| 1720 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1721 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3592, |
| 1722 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
| 1723 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3593, |
| 1724 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 1725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, |
| 1726 | "HP", STAC_HP_ZEPHYR), |
| 1727 | {} /* terminator */ |
| 1728 | }; |
| 1729 | |
| 1730 | static const struct snd_pci_quirk stac92hd83xxx_codec_id_cfg_tbl[] = { |
| 1731 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, |
| 1732 | "HP", STAC_HP_ZEPHYR), |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 1733 | {} /* terminator */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1734 | }; |
| 1735 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1736 | static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1737 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1738 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1739 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
| 1740 | 0x00000000 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1741 | }; |
| 1742 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1743 | static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1744 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1745 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1746 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
| 1747 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1748 | }; |
| 1749 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1750 | static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1751 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1752 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1753 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1754 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1755 | }; |
| 1756 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1757 | static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1758 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1759 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1760 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1761 | 0x00000000 |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1762 | }; |
| 1763 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1764 | static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1765 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1766 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1767 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1768 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1769 | [STAC_HP_M4] = NULL, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1770 | [STAC_HP_DV4] = NULL, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1771 | [STAC_HP_DV5] = NULL, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1772 | [STAC_HP_HDX] = NULL, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1773 | [STAC_HP_DV4_1222NR] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1774 | }; |
| 1775 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1776 | static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1777 | [STAC_92HD71BXX_AUTO] = "auto", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1778 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1779 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1780 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1781 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1782 | [STAC_HP_M4] = "hp-m4", |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1783 | [STAC_HP_DV4] = "hp-dv4", |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1784 | [STAC_HP_DV5] = "hp-dv5", |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1785 | [STAC_HP_HDX] = "hp-hdx", |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1786 | [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1787 | }; |
| 1788 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1789 | static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1790 | /* SigmaTel reference board */ |
| 1791 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1792 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1793 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1794 | "DFI LanParty", STAC_92HD71BXX_REF), |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1795 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, |
| 1796 | "HP dv4-1222nr", STAC_HP_DV4_1222NR), |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 1797 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x1720, |
| 1798 | "HP", STAC_HP_DV5), |
Takashi Iwai | 58d8395 | 2009-03-13 17:04:34 +0100 | [diff] [blame] | 1799 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
| 1800 | "HP", STAC_HP_DV5), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1801 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 1802 | "HP dv4-7", STAC_HP_DV4), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1803 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, |
| 1804 | "HP dv4-7", STAC_HP_DV5), |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, |
| 1806 | "HP HDX", STAC_HP_HDX), /* HDX18 */ |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1808 | "HP mini 1000", STAC_HP_M4), |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1810 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
Takashi Iwai | 6e34c03 | 2009-09-14 15:42:18 +0200 | [diff] [blame] | 1811 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3620, |
| 1812 | "HP dv6", STAC_HP_DV5), |
Kunal Gangakhedkar | e3d2530 | 2010-03-20 23:08:01 +0530 | [diff] [blame] | 1813 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3061, |
| 1814 | "HP dv6", STAC_HP_DV5), /* HP dv6-1110ax */ |
Luke Yelavich | 9b2167d | 2010-10-06 15:45:46 +1100 | [diff] [blame] | 1815 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x363e, |
| 1816 | "HP DV6", STAC_HP_DV5), |
Takashi Iwai | 1972d02 | 2009-08-06 08:44:43 +0200 | [diff] [blame] | 1817 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, |
| 1818 | "HP", STAC_HP_DV5), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1819 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1820 | "unknown Dell", STAC_DELL_M4_1), |
| 1821 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1822 | "unknown Dell", STAC_DELL_M4_1), |
| 1823 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1824 | "unknown Dell", STAC_DELL_M4_1), |
| 1825 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1826 | "unknown Dell", STAC_DELL_M4_1), |
| 1827 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1828 | "unknown Dell", STAC_DELL_M4_1), |
| 1829 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1830 | "unknown Dell", STAC_DELL_M4_1), |
| 1831 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1832 | "unknown Dell", STAC_DELL_M4_1), |
| 1833 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1834 | "unknown Dell", STAC_DELL_M4_2), |
| 1835 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1836 | "unknown Dell", STAC_DELL_M4_2), |
| 1837 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1838 | "unknown Dell", STAC_DELL_M4_2), |
| 1839 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1840 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1841 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1842 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1843 | {} /* terminator */ |
| 1844 | }; |
| 1845 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1846 | static const unsigned int ref922x_pin_configs[10] = { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1847 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1848 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1849 | 0x40000100, 0x40000100, |
| 1850 | }; |
| 1851 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1852 | /* |
| 1853 | STAC 922X pin configs for |
| 1854 | 102801A7 |
| 1855 | 102801AB |
| 1856 | 102801A9 |
| 1857 | 102801D1 |
| 1858 | 102801D2 |
| 1859 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1860 | static const unsigned int dell_922x_d81_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1861 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1862 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1863 | 0x01813122, 0x400001f2, |
| 1864 | }; |
| 1865 | |
| 1866 | /* |
| 1867 | STAC 922X pin configs for |
| 1868 | 102801AC |
| 1869 | 102801D0 |
| 1870 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1871 | static const unsigned int dell_922x_d82_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1872 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1873 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1874 | 0x01813122, 0x400001f1, |
| 1875 | }; |
| 1876 | |
| 1877 | /* |
| 1878 | STAC 922X pin configs for |
| 1879 | 102801BF |
| 1880 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1881 | static const unsigned int dell_922x_m81_pin_configs[10] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1882 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1883 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1884 | 0x40C003f1, 0x405003f0, |
| 1885 | }; |
| 1886 | |
| 1887 | /* |
| 1888 | STAC 9221 A1 pin configs for |
| 1889 | 102801D7 (Dell XPS M1210) |
| 1890 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1891 | static const unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1892 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1893 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1894 | 0x508003f3, 0x405003f4, |
| 1895 | }; |
| 1896 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1897 | static const unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1898 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1899 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1900 | 0x02a19120, 0x40000100, |
| 1901 | }; |
| 1902 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1903 | static const unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1904 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1905 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1906 | 0x02a19320, 0x40000100, |
| 1907 | }; |
| 1908 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1909 | static const unsigned int intel_mac_v1_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1910 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1911 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1912 | 0x400000fc, 0x400000fb, |
| 1913 | }; |
| 1914 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1915 | static const unsigned int intel_mac_v2_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1916 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1917 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1918 | 0x400000fc, 0x400000fb, |
| 1919 | }; |
| 1920 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1921 | static const unsigned int intel_mac_v3_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1922 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1923 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1924 | 0x400000fc, 0x400000fb, |
| 1925 | }; |
| 1926 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1927 | static const unsigned int intel_mac_v4_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1928 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1929 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1930 | 0x400000fc, 0x400000fb, |
| 1931 | }; |
| 1932 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1933 | static const unsigned int intel_mac_v5_pin_configs[10] = { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1934 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1935 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1936 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1937 | }; |
| 1938 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1939 | static const unsigned int ecs202_pin_configs[10] = { |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1940 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 1941 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 1942 | 0x9037012e, 0x40e000f2, |
| 1943 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1944 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1945 | static const unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1946 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1947 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 1948 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1949 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 1950 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 1951 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 1952 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 1953 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1954 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1955 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1956 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 1957 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 1958 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 1959 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 1960 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 1961 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1962 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1963 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 1964 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 1965 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 1966 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1967 | }; |
| 1968 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 1969 | static const char * const stac922x_models[STAC_922X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1970 | [STAC_922X_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1971 | [STAC_D945_REF] = "ref", |
| 1972 | [STAC_D945GTP5] = "5stack", |
| 1973 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1974 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 1975 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 1976 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 1977 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 1978 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1979 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1980 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1981 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1982 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 1983 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 1984 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1985 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1986 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1987 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1988 | [STAC_922X_DELL_D81] = "dell-d81", |
| 1989 | [STAC_922X_DELL_D82] = "dell-d82", |
| 1990 | [STAC_922X_DELL_M81] = "dell-m81", |
| 1991 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1992 | }; |
| 1993 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 1994 | static const struct snd_pci_quirk stac922x_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1995 | /* SigmaTel reference board */ |
| 1996 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1997 | "DFI LanParty", STAC_D945_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1998 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1999 | "DFI LanParty", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2000 | /* Intel 945G based systems */ |
| 2001 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 2002 | "Intel D945G", STAC_D945GTP3), |
| 2003 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 2004 | "Intel D945G", STAC_D945GTP3), |
| 2005 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 2006 | "Intel D945G", STAC_D945GTP3), |
| 2007 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 2008 | "Intel D945G", STAC_D945GTP3), |
| 2009 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 2010 | "Intel D945G", STAC_D945GTP3), |
| 2011 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 2012 | "Intel D945G", STAC_D945GTP3), |
| 2013 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 2014 | "Intel D945G", STAC_D945GTP3), |
| 2015 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 2016 | "Intel D945G", STAC_D945GTP3), |
| 2017 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 2018 | "Intel D945G", STAC_D945GTP3), |
| 2019 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 2020 | "Intel D945G", STAC_D945GTP3), |
| 2021 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 2022 | "Intel D945G", STAC_D945GTP3), |
| 2023 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 2024 | "Intel D945G", STAC_D945GTP3), |
| 2025 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 2026 | "Intel D945G", STAC_D945GTP3), |
| 2027 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 2028 | "Intel D945G", STAC_D945GTP3), |
| 2029 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 2030 | "Intel D945G", STAC_D945GTP3), |
| 2031 | /* Intel D945G 5-stack systems */ |
| 2032 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 2033 | "Intel D945G", STAC_D945GTP5), |
| 2034 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 2035 | "Intel D945G", STAC_D945GTP5), |
| 2036 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 2037 | "Intel D945G", STAC_D945GTP5), |
| 2038 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 2039 | "Intel D945G", STAC_D945GTP5), |
| 2040 | /* Intel 945P based systems */ |
| 2041 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 2042 | "Intel D945P", STAC_D945GTP3), |
| 2043 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 2044 | "Intel D945P", STAC_D945GTP3), |
| 2045 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 2046 | "Intel D945P", STAC_D945GTP3), |
| 2047 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 2048 | "Intel D945P", STAC_D945GTP3), |
| 2049 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 2050 | "Intel D945P", STAC_D945GTP3), |
| 2051 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 2052 | "Intel D945P", STAC_D945GTP5), |
Takashi Iwai | 8056d47 | 2009-01-23 09:09:43 +0100 | [diff] [blame] | 2053 | /* other intel */ |
| 2054 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, |
| 2055 | "Intel D945", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2056 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2057 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2058 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2059 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2060 | /* Dell systems */ |
| 2061 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2062 | "unknown Dell", STAC_922X_DELL_D81), |
| 2063 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2064 | "unknown Dell", STAC_922X_DELL_D81), |
| 2065 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2066 | "unknown Dell", STAC_922X_DELL_D81), |
| 2067 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2068 | "unknown Dell", STAC_922X_DELL_D82), |
| 2069 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2070 | "unknown Dell", STAC_922X_DELL_M81), |
| 2071 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2072 | "unknown Dell", STAC_922X_DELL_D82), |
| 2073 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2074 | "unknown Dell", STAC_922X_DELL_D81), |
| 2075 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2076 | "unknown Dell", STAC_922X_DELL_D81), |
| 2077 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2078 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2079 | /* ECS/PC Chips boards */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2080 | SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, |
Herton Ronaldo Krzesinski | 8663ae5 | 2009-02-08 19:50:34 -0200 | [diff] [blame] | 2081 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2082 | {} /* terminator */ |
| 2083 | }; |
| 2084 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2085 | static const unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2086 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2087 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2088 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2089 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2090 | }; |
| 2091 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2092 | static const unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2093 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2094 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2095 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2096 | 0x40000100, 0x40000100 |
| 2097 | }; |
| 2098 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2099 | static const unsigned int d965_5st_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2100 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2101 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2102 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2103 | 0x40000100, 0x40000100 |
| 2104 | }; |
| 2105 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2106 | static const unsigned int d965_5st_no_fp_pin_configs[14] = { |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2107 | 0x40000100, 0x40000100, 0x0181304e, 0x01014010, |
| 2108 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2109 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2110 | 0x40000100, 0x40000100 |
| 2111 | }; |
| 2112 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2113 | static const unsigned int dell_3st_pin_configs[14] = { |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2114 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2115 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2116 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2117 | 0x40c003fc, 0x40000100 |
| 2118 | }; |
| 2119 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2120 | static const unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2121 | [STAC_D965_REF_NO_JD] = ref927x_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2122 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2123 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2124 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2125 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2126 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2127 | [STAC_DELL_BIOS] = NULL, |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2128 | [STAC_927X_VOLKNOB] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2129 | }; |
| 2130 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2131 | static const char * const stac927x_models[STAC_927X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2132 | [STAC_927X_AUTO] = "auto", |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2133 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2134 | [STAC_D965_REF] = "ref", |
| 2135 | [STAC_D965_3ST] = "3stack", |
| 2136 | [STAC_D965_5ST] = "5stack", |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2137 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2138 | [STAC_DELL_3ST] = "dell-3stack", |
| 2139 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2140 | [STAC_927X_VOLKNOB] = "volknob", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2141 | }; |
| 2142 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2143 | static const struct snd_pci_quirk stac927x_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2144 | /* SigmaTel reference board */ |
| 2145 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2146 | "DFI LanParty", STAC_D965_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2147 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2148 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2149 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2150 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2151 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2152 | /* 965 based 3 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2153 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, |
| 2154 | "Intel D965", STAC_D965_3ST), |
| 2155 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, |
| 2156 | "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2157 | /* Dell 3 stack systems */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2158 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2159 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2160 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2161 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2162 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
Daniel T Chen | 66668b6 | 2010-05-23 20:47:45 -0400 | [diff] [blame] | 2163 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_BIOS), |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2164 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2165 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Chengu Wang | 84d3dc2 | 2009-07-30 19:43:55 +0800 | [diff] [blame] | 2166 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_BIOS), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2167 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2168 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2169 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2170 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2171 | /* 965 based 5 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2172 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, |
| 2173 | "Intel D965", STAC_D965_5ST), |
| 2174 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
| 2175 | "Intel D965", STAC_D965_5ST), |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 2176 | /* volume-knob fixes */ |
| 2177 | SND_PCI_QUIRK_VENDOR(0x10cf, "FSC", STAC_927X_VOLKNOB), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2178 | {} /* terminator */ |
| 2179 | }; |
| 2180 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2181 | static const unsigned int ref9205_pin_configs[12] = { |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2182 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2183 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2184 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2185 | }; |
| 2186 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2187 | /* |
| 2188 | STAC 9205 pin configs for |
| 2189 | 102801F1 |
| 2190 | 102801F2 |
| 2191 | 102801FC |
| 2192 | 102801FD |
| 2193 | 10280204 |
| 2194 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2195 | 10280228 (Dell Vostro 1500) |
Anisse Astier | 95e70e8 | 2009-12-23 17:28:45 +0100 | [diff] [blame] | 2196 | 10280229 (Dell Vostro 1700) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2197 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2198 | static const unsigned int dell_9205_m42_pin_configs[12] = { |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2199 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2200 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2201 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2202 | }; |
| 2203 | |
| 2204 | /* |
| 2205 | STAC 9205 pin configs for |
| 2206 | 102801F9 |
| 2207 | 102801FA |
| 2208 | 102801FE |
| 2209 | 102801FF (Dell Precision M4300) |
| 2210 | 10280206 |
| 2211 | 10280200 |
| 2212 | 10280201 |
| 2213 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2214 | static const unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2215 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2216 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2217 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2218 | }; |
| 2219 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2220 | static const unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2221 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2222 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2223 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2224 | }; |
| 2225 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2226 | static const unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2227 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2228 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2229 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2230 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2231 | [STAC_9205_EAPD] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2232 | }; |
| 2233 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 2234 | static const char * const stac9205_models[STAC_9205_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2235 | [STAC_9205_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2236 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2237 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2238 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2239 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2240 | [STAC_9205_EAPD] = "eapd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2241 | }; |
| 2242 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2243 | static const struct snd_pci_quirk stac9205_cfg_tbl[] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2244 | /* SigmaTel reference board */ |
| 2245 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2246 | "DFI LanParty", STAC_9205_REF), |
Herton Ronaldo Krzesinski | 02358fc | 2009-07-04 01:44:59 -0300 | [diff] [blame] | 2247 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, |
| 2248 | "SigmaTel", STAC_9205_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2249 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2250 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2251 | /* Dell */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2252 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2253 | "unknown Dell", STAC_9205_DELL_M42), |
| 2254 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2255 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2256 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2257 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2258 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2259 | "Dell Precision", STAC_9205_DELL_M43), |
| 2260 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2261 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2262 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2263 | "unknown Dell", STAC_9205_DELL_M42), |
| 2264 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2265 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2266 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2267 | "Dell Precision", STAC_9205_DELL_M43), |
| 2268 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2269 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2270 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2271 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2272 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2273 | "Dell Precision", STAC_9205_DELL_M43), |
| 2274 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2275 | "Dell Precision", STAC_9205_DELL_M43), |
| 2276 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2277 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2278 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2279 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2280 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2281 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Anisse Astier | 95e70e8 | 2009-12-23 17:28:45 +0100 | [diff] [blame] | 2282 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229, |
| 2283 | "Dell Vostro 1700", STAC_9205_DELL_M42), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2284 | /* Gateway */ |
Hao Song | 42b95f0 | 2009-07-20 15:01:16 +0800 | [diff] [blame] | 2285 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2286 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2287 | {} /* terminator */ |
| 2288 | }; |
| 2289 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2290 | static void stac92xx_set_config_regs(struct hda_codec *codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2291 | const unsigned int *pincfgs) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2292 | { |
| 2293 | int i; |
| 2294 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2295 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2296 | if (!pincfgs) |
| 2297 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2298 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2299 | for (i = 0; i < spec->num_pins; i++) |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2300 | if (spec->pin_nids[i] && pincfgs[i]) |
| 2301 | snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], |
| 2302 | pincfgs[i]); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2303 | } |
| 2304 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2305 | /* |
| 2306 | * Analog playback callbacks |
| 2307 | */ |
| 2308 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2309 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2310 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2311 | { |
| 2312 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2313 | if (spec->stream_delay) |
| 2314 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2315 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2316 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2317 | } |
| 2318 | |
| 2319 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2320 | struct hda_codec *codec, |
| 2321 | unsigned int stream_tag, |
| 2322 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2323 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2324 | { |
| 2325 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2326 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag, format, substream); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2327 | } |
| 2328 | |
| 2329 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2330 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2331 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2332 | { |
| 2333 | struct sigmatel_spec *spec = codec->spec; |
| 2334 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2335 | } |
| 2336 | |
| 2337 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2338 | * Digital playback callbacks |
| 2339 | */ |
| 2340 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2341 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2342 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2343 | { |
| 2344 | struct sigmatel_spec *spec = codec->spec; |
| 2345 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2346 | } |
| 2347 | |
| 2348 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2349 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2350 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2351 | { |
| 2352 | struct sigmatel_spec *spec = codec->spec; |
| 2353 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2354 | } |
| 2355 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2356 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2357 | struct hda_codec *codec, |
| 2358 | unsigned int stream_tag, |
| 2359 | unsigned int format, |
| 2360 | struct snd_pcm_substream *substream) |
| 2361 | { |
| 2362 | struct sigmatel_spec *spec = codec->spec; |
| 2363 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2364 | stream_tag, format, substream); |
| 2365 | } |
| 2366 | |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2367 | static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2368 | struct hda_codec *codec, |
| 2369 | struct snd_pcm_substream *substream) |
| 2370 | { |
| 2371 | struct sigmatel_spec *spec = codec->spec; |
| 2372 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2373 | } |
| 2374 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2375 | |
| 2376 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2377 | * Analog capture callbacks |
| 2378 | */ |
| 2379 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2380 | struct hda_codec *codec, |
| 2381 | unsigned int stream_tag, |
| 2382 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2383 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2384 | { |
| 2385 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2386 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2387 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2388 | if (spec->powerdown_adcs) { |
| 2389 | msleep(40); |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2390 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2391 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2392 | } |
| 2393 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2394 | return 0; |
| 2395 | } |
| 2396 | |
| 2397 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2398 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2399 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2400 | { |
| 2401 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2402 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2403 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2404 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2405 | if (spec->powerdown_adcs) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2406 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2407 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2408 | return 0; |
| 2409 | } |
| 2410 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2411 | static const struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2412 | .substreams = 1, |
| 2413 | .channels_min = 2, |
| 2414 | .channels_max = 2, |
| 2415 | /* NID is set in stac92xx_build_pcms */ |
| 2416 | .ops = { |
| 2417 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2418 | .close = stac92xx_dig_playback_pcm_close, |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2419 | .prepare = stac92xx_dig_playback_pcm_prepare, |
| 2420 | .cleanup = stac92xx_dig_playback_pcm_cleanup |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2421 | }, |
| 2422 | }; |
| 2423 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2424 | static const struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2425 | .substreams = 1, |
| 2426 | .channels_min = 2, |
| 2427 | .channels_max = 2, |
| 2428 | /* NID is set in stac92xx_build_pcms */ |
| 2429 | }; |
| 2430 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2431 | static const struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2432 | .substreams = 1, |
| 2433 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2434 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2435 | .nid = 0x02, /* NID to query formats and rates */ |
| 2436 | .ops = { |
| 2437 | .open = stac92xx_playback_pcm_open, |
| 2438 | .prepare = stac92xx_playback_pcm_prepare, |
| 2439 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2440 | }, |
| 2441 | }; |
| 2442 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2443 | static const struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2444 | .substreams = 1, |
| 2445 | .channels_min = 2, |
| 2446 | .channels_max = 2, |
| 2447 | .nid = 0x06, /* NID to query formats and rates */ |
| 2448 | .ops = { |
| 2449 | .open = stac92xx_playback_pcm_open, |
| 2450 | .prepare = stac92xx_playback_pcm_prepare, |
| 2451 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2452 | }, |
| 2453 | }; |
| 2454 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2455 | static const struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2456 | .channels_min = 2, |
| 2457 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2458 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2459 | .ops = { |
| 2460 | .prepare = stac92xx_capture_pcm_prepare, |
| 2461 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2462 | }, |
| 2463 | }; |
| 2464 | |
| 2465 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2466 | { |
| 2467 | struct sigmatel_spec *spec = codec->spec; |
| 2468 | struct hda_pcm *info = spec->pcm_rec; |
| 2469 | |
| 2470 | codec->num_pcms = 1; |
| 2471 | codec->pcm_info = info; |
| 2472 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2473 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2474 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Takashi Iwai | 00a602d | 2009-01-23 11:55:42 +0100 | [diff] [blame] | 2475 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2476 | spec->multiout.dac_nids[0]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2477 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2478 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2479 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2480 | |
| 2481 | if (spec->alt_switch) { |
| 2482 | codec->num_pcms++; |
| 2483 | info++; |
| 2484 | info->name = "STAC92xx Analog Alt"; |
| 2485 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2486 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2487 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2488 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2489 | codec->num_pcms++; |
| 2490 | info++; |
| 2491 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 2492 | info->pcm_type = spec->autocfg.dig_out_type[0]; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2493 | if (spec->multiout.dig_out_nid) { |
| 2494 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2495 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2496 | } |
| 2497 | if (spec->dig_in_nid) { |
| 2498 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2499 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2500 | } |
| 2501 | } |
| 2502 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2503 | return 0; |
| 2504 | } |
| 2505 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2506 | static unsigned int stac92xx_get_default_vref(struct hda_codec *codec, |
| 2507 | hda_nid_t nid) |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2508 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2509 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2510 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2511 | if (pincap & AC_PINCAP_VREF_100) |
| 2512 | return AC_PINCTL_VREF_100; |
| 2513 | if (pincap & AC_PINCAP_VREF_80) |
| 2514 | return AC_PINCTL_VREF_80; |
| 2515 | if (pincap & AC_PINCAP_VREF_50) |
| 2516 | return AC_PINCTL_VREF_50; |
| 2517 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2518 | return AC_PINCTL_VREF_GRD; |
| 2519 | return 0; |
| 2520 | } |
| 2521 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2522 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2523 | |
| 2524 | { |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 2525 | snd_hda_set_pin_ctl_cache(codec, nid, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2526 | } |
| 2527 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2528 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2529 | |
| 2530 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2531 | struct snd_ctl_elem_value *ucontrol) |
| 2532 | { |
| 2533 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2534 | struct sigmatel_spec *spec = codec->spec; |
| 2535 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2536 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2537 | return 0; |
| 2538 | } |
| 2539 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2540 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2541 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2542 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2543 | struct snd_ctl_elem_value *ucontrol) |
| 2544 | { |
| 2545 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2546 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2547 | int nid = kcontrol->private_value; |
| 2548 | |
| 2549 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2550 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 2551 | /* check to be sure that the ports are up to date with |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2552 | * switch changes |
| 2553 | */ |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2554 | stac_issue_unsol_event(codec, nid); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2555 | |
| 2556 | return 1; |
| 2557 | } |
| 2558 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2559 | static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol, |
| 2560 | struct snd_ctl_elem_info *uinfo) |
| 2561 | { |
| 2562 | int i; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2563 | static const char * const texts[] = { |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2564 | "Mic In", "Line In", "Line Out" |
| 2565 | }; |
| 2566 | |
| 2567 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2568 | struct sigmatel_spec *spec = codec->spec; |
| 2569 | hda_nid_t nid = kcontrol->private_value; |
| 2570 | |
| 2571 | if (nid == spec->mic_switch || nid == spec->line_switch) |
| 2572 | i = 3; |
| 2573 | else |
| 2574 | i = 2; |
| 2575 | |
| 2576 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2577 | uinfo->value.enumerated.items = i; |
| 2578 | uinfo->count = 1; |
| 2579 | if (uinfo->value.enumerated.item >= i) |
| 2580 | uinfo->value.enumerated.item = i-1; |
| 2581 | strcpy(uinfo->value.enumerated.name, |
| 2582 | texts[uinfo->value.enumerated.item]); |
| 2583 | |
| 2584 | return 0; |
| 2585 | } |
| 2586 | |
| 2587 | static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol, |
| 2588 | struct snd_ctl_elem_value *ucontrol) |
| 2589 | { |
| 2590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2591 | hda_nid_t nid = kcontrol->private_value; |
| 2592 | unsigned int vref = stac92xx_vref_get(codec, nid); |
| 2593 | |
| 2594 | if (vref == stac92xx_get_default_vref(codec, nid)) |
| 2595 | ucontrol->value.enumerated.item[0] = 0; |
| 2596 | else if (vref == AC_PINCTL_VREF_GRD) |
| 2597 | ucontrol->value.enumerated.item[0] = 1; |
| 2598 | else if (vref == AC_PINCTL_VREF_HIZ) |
| 2599 | ucontrol->value.enumerated.item[0] = 2; |
| 2600 | |
| 2601 | return 0; |
| 2602 | } |
| 2603 | |
| 2604 | static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol, |
| 2605 | struct snd_ctl_elem_value *ucontrol) |
| 2606 | { |
| 2607 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2608 | unsigned int new_vref = 0; |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 2609 | int error; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2610 | hda_nid_t nid = kcontrol->private_value; |
| 2611 | |
| 2612 | if (ucontrol->value.enumerated.item[0] == 0) |
| 2613 | new_vref = stac92xx_get_default_vref(codec, nid); |
| 2614 | else if (ucontrol->value.enumerated.item[0] == 1) |
| 2615 | new_vref = AC_PINCTL_VREF_GRD; |
| 2616 | else if (ucontrol->value.enumerated.item[0] == 2) |
| 2617 | new_vref = AC_PINCTL_VREF_HIZ; |
| 2618 | else |
| 2619 | return 0; |
| 2620 | |
| 2621 | if (new_vref != stac92xx_vref_get(codec, nid)) { |
| 2622 | error = stac92xx_vref_set(codec, nid, new_vref); |
| 2623 | return error; |
| 2624 | } |
| 2625 | |
| 2626 | return 0; |
| 2627 | } |
| 2628 | |
| 2629 | static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, |
| 2630 | struct snd_ctl_elem_info *uinfo) |
| 2631 | { |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2632 | char *texts[2]; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2634 | struct sigmatel_spec *spec = codec->spec; |
| 2635 | |
| 2636 | if (kcontrol->private_value == spec->line_switch) |
| 2637 | texts[0] = "Line In"; |
| 2638 | else |
| 2639 | texts[0] = "Mic In"; |
| 2640 | texts[1] = "Line Out"; |
| 2641 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2642 | uinfo->value.enumerated.items = 2; |
| 2643 | uinfo->count = 1; |
| 2644 | |
| 2645 | if (uinfo->value.enumerated.item >= 2) |
| 2646 | uinfo->value.enumerated.item = 1; |
| 2647 | strcpy(uinfo->value.enumerated.name, |
| 2648 | texts[uinfo->value.enumerated.item]); |
| 2649 | |
| 2650 | return 0; |
| 2651 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2652 | |
| 2653 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2654 | { |
| 2655 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2656 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2657 | hda_nid_t nid = kcontrol->private_value; |
| 2658 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2659 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2660 | ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2661 | return 0; |
| 2662 | } |
| 2663 | |
| 2664 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2665 | { |
| 2666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2667 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2668 | hda_nid_t nid = kcontrol->private_value; |
| 2669 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
| 2670 | unsigned short val = !!ucontrol->value.enumerated.item[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2671 | |
| 2672 | spec->io_switch[io_idx] = val; |
| 2673 | |
| 2674 | if (val) |
| 2675 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2676 | else { |
| 2677 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2678 | if (io_idx) /* set VREF for mic */ |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2679 | pinctl |= stac92xx_get_default_vref(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2680 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2681 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2682 | |
| 2683 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2684 | * appropriately according to the pin direction |
| 2685 | */ |
| 2686 | if (spec->hp_detect) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2687 | stac_issue_unsol_event(codec, nid); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2688 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2689 | return 1; |
| 2690 | } |
| 2691 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2692 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2693 | |
| 2694 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2695 | struct snd_ctl_elem_value *ucontrol) |
| 2696 | { |
| 2697 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2698 | struct sigmatel_spec *spec = codec->spec; |
| 2699 | |
| 2700 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2701 | return 0; |
| 2702 | } |
| 2703 | |
| 2704 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2705 | struct snd_ctl_elem_value *ucontrol) |
| 2706 | { |
| 2707 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2708 | struct sigmatel_spec *spec = codec->spec; |
| 2709 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2710 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2711 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2712 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2713 | return 0; |
| 2714 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2715 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2716 | |
| 2717 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2718 | spec->clfe_swap ? 0x4 : 0x0); |
| 2719 | |
| 2720 | return 1; |
| 2721 | } |
| 2722 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2723 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2724 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2725 | .name = xname, \ |
| 2726 | .index = 0, \ |
| 2727 | .info = stac92xx_hp_switch_info, \ |
| 2728 | .get = stac92xx_hp_switch_get, \ |
| 2729 | .put = stac92xx_hp_switch_put, \ |
| 2730 | } |
| 2731 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2732 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2733 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2734 | .name = xname, \ |
| 2735 | .index = 0, \ |
| 2736 | .info = stac92xx_io_switch_info, \ |
| 2737 | .get = stac92xx_io_switch_get, \ |
| 2738 | .put = stac92xx_io_switch_put, \ |
| 2739 | .private_value = xpval, \ |
| 2740 | } |
| 2741 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2742 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2743 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2744 | .name = xname, \ |
| 2745 | .index = 0, \ |
| 2746 | .info = stac92xx_clfe_switch_info, \ |
| 2747 | .get = stac92xx_clfe_switch_get, \ |
| 2748 | .put = stac92xx_clfe_switch_put, \ |
| 2749 | .private_value = xpval, \ |
| 2750 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2751 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2752 | enum { |
| 2753 | STAC_CTL_WIDGET_VOL, |
| 2754 | STAC_CTL_WIDGET_MUTE, |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2755 | STAC_CTL_WIDGET_MUTE_BEEP, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2756 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2757 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2758 | STAC_CTL_WIDGET_IO_SWITCH, |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2759 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 2760 | STAC_CTL_WIDGET_DC_BIAS |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2761 | }; |
| 2762 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2763 | static const struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2764 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2765 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 2766 | HDA_CODEC_MUTE_BEEP(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2767 | STAC_MONO_MUX, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2768 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2769 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2770 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2771 | DC_BIAS(NULL, 0, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2772 | }; |
| 2773 | |
| 2774 | /* add dynamic controls */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2775 | static struct snd_kcontrol_new * |
| 2776 | stac_control_new(struct sigmatel_spec *spec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2777 | const struct snd_kcontrol_new *ktemp, |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2778 | const char *name, |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2779 | unsigned int subdev) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2780 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2781 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2782 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2783 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2784 | knew = snd_array_new(&spec->kctls); |
| 2785 | if (!knew) |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2786 | return NULL; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2787 | *knew = *ktemp; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2788 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2789 | if (!knew->name) { |
| 2790 | /* roolback */ |
| 2791 | memset(knew, 0, sizeof(*knew)); |
| 2792 | spec->kctls.alloced--; |
| 2793 | return NULL; |
| 2794 | } |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2795 | knew->subdevice = subdev; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2796 | return knew; |
| 2797 | } |
| 2798 | |
| 2799 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2800 | const struct snd_kcontrol_new *ktemp, |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2801 | int idx, const char *name, |
| 2802 | unsigned long val) |
| 2803 | { |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2804 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name, |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 2805 | HDA_SUBDEV_AMP_FLAG); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2806 | if (!knew) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2807 | return -ENOMEM; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2808 | knew->index = idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2809 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2810 | return 0; |
| 2811 | } |
| 2812 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2813 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2814 | int type, int idx, const char *name, |
| 2815 | unsigned long val) |
| 2816 | { |
| 2817 | return stac92xx_add_control_temp(spec, |
| 2818 | &stac92xx_control_templates[type], |
| 2819 | idx, name, val); |
| 2820 | } |
| 2821 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2822 | |
| 2823 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2824 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2825 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2826 | { |
| 2827 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2828 | } |
| 2829 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 2830 | static const struct snd_kcontrol_new stac_input_src_temp = { |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2832 | .name = "Input Source", |
| 2833 | .info = stac92xx_mux_enum_info, |
| 2834 | .get = stac92xx_mux_enum_get, |
| 2835 | .put = stac92xx_mux_enum_put, |
| 2836 | }; |
| 2837 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2838 | static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, |
| 2839 | hda_nid_t nid, int idx) |
| 2840 | { |
| 2841 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 2842 | int control = 0; |
| 2843 | struct sigmatel_spec *spec = codec->spec; |
| 2844 | char name[22]; |
| 2845 | |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 2846 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2847 | if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD |
| 2848 | && nid == spec->line_switch) |
| 2849 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2850 | else if (snd_hda_query_pin_caps(codec, nid) |
| 2851 | & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT)) |
| 2852 | control = STAC_CTL_WIDGET_DC_BIAS; |
| 2853 | else if (nid == spec->mic_switch) |
| 2854 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2855 | } |
| 2856 | |
| 2857 | if (control) { |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 2858 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
| 2859 | name, sizeof(name), NULL); |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2860 | return stac92xx_add_control(codec->spec, control, |
| 2861 | strcat(name, " Jack Mode"), nid); |
| 2862 | } |
| 2863 | |
| 2864 | return 0; |
| 2865 | } |
| 2866 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2867 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) |
| 2868 | { |
| 2869 | struct snd_kcontrol_new *knew; |
| 2870 | struct hda_input_mux *imux = &spec->private_imux; |
| 2871 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 2872 | if (spec->auto_mic) |
| 2873 | return 0; /* no need for input source */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2874 | if (!spec->num_adcs || imux->num_items <= 1) |
| 2875 | return 0; /* no need for input source control */ |
| 2876 | knew = stac_control_new(spec, &stac_input_src_temp, |
Jaroslav Kysela | 4d02d1b | 2009-11-12 10:15:48 +0100 | [diff] [blame] | 2877 | stac_input_src_temp.name, 0); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2878 | if (!knew) |
| 2879 | return -ENOMEM; |
| 2880 | knew->count = spec->num_adcs; |
| 2881 | return 0; |
| 2882 | } |
| 2883 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2884 | /* check whether the line-input can be used as line-out */ |
| 2885 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2886 | { |
| 2887 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2888 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2889 | hda_nid_t nid; |
| 2890 | unsigned int pincap; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2891 | int i; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2892 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2893 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2894 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2895 | for (i = 0; i < cfg->num_inputs; i++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2896 | if (cfg->inputs[i].type == AUTO_PIN_LINE_IN) { |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2897 | nid = cfg->inputs[i].pin; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2898 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2899 | if (pincap & AC_PINCAP_OUT) |
| 2900 | return nid; |
| 2901 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2902 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2903 | return 0; |
| 2904 | } |
| 2905 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2906 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid); |
| 2907 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2908 | /* check whether the mic-input can be used as line-out */ |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2909 | static hda_nid_t check_mic_out_switch(struct hda_codec *codec, hda_nid_t *dac) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2910 | { |
| 2911 | struct sigmatel_spec *spec = codec->spec; |
| 2912 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2913 | unsigned int def_conf, pincap; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2914 | int i; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2915 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2916 | *dac = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2917 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2918 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2919 | for (i = 0; i < cfg->num_inputs; i++) { |
| 2920 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 2921 | if (cfg->inputs[i].type != AUTO_PIN_MIC) |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2922 | continue; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2923 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 2924 | /* some laptops have an internal analog microphone |
| 2925 | * which can't be used as a output */ |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 2926 | if (snd_hda_get_input_pin_attr(def_conf) != INPUT_PIN_ATTR_INT) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2927 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 2928 | if (pincap & AC_PINCAP_OUT) { |
| 2929 | *dac = get_unassigned_dac(codec, nid); |
| 2930 | if (*dac) |
| 2931 | return nid; |
| 2932 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2933 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2934 | } |
| 2935 | return 0; |
| 2936 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2937 | |
| 2938 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2939 | { |
| 2940 | int i; |
| 2941 | |
| 2942 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2943 | if (spec->multiout.dac_nids[i] == nid) |
| 2944 | return 1; |
| 2945 | } |
| 2946 | |
| 2947 | return 0; |
| 2948 | } |
| 2949 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2950 | static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2951 | { |
| 2952 | int i; |
| 2953 | if (is_in_dac_nids(spec, nid)) |
| 2954 | return 1; |
| 2955 | for (i = 0; i < spec->autocfg.hp_outs; i++) |
| 2956 | if (spec->hp_dacs[i] == nid) |
| 2957 | return 1; |
| 2958 | for (i = 0; i < spec->autocfg.speaker_outs; i++) |
| 2959 | if (spec->speaker_dacs[i] == nid) |
| 2960 | return 1; |
| 2961 | return 0; |
| 2962 | } |
| 2963 | |
| 2964 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
| 2965 | { |
| 2966 | struct sigmatel_spec *spec = codec->spec; |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2967 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2968 | int j, conn_len; |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2969 | hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2970 | unsigned int wcaps, wtype; |
| 2971 | |
| 2972 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2973 | HDA_MAX_CONNECTIONS); |
Charles Chin | 3670600 | 2010-01-29 12:05:51 +0100 | [diff] [blame] | 2974 | /* 92HD88: trace back up the link of nids to find the DAC */ |
| 2975 | while (conn_len == 1 && (get_wcaps_type(get_wcaps(codec, conn[0])) |
| 2976 | != AC_WID_AUD_OUT)) { |
| 2977 | nid = conn[0]; |
| 2978 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2979 | HDA_MAX_CONNECTIONS); |
| 2980 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2981 | for (j = 0; j < conn_len; j++) { |
Takashi Iwai | 14bafe3 | 2009-03-23 16:35:39 +0100 | [diff] [blame] | 2982 | wcaps = get_wcaps(codec, conn[j]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 2983 | wtype = get_wcaps_type(wcaps); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2984 | /* we check only analog outputs */ |
| 2985 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
| 2986 | continue; |
| 2987 | /* if this route has a free DAC, assign it */ |
| 2988 | if (!check_all_dac_nids(spec, conn[j])) { |
| 2989 | if (conn_len > 1) { |
| 2990 | /* select this DAC in the pin's input mux */ |
| 2991 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2992 | AC_VERB_SET_CONNECT_SEL, j); |
| 2993 | } |
| 2994 | return conn[j]; |
| 2995 | } |
| 2996 | } |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 2997 | |
| 2998 | /* if all DACs are already assigned, connect to the primary DAC, |
| 2999 | unless we're assigning a secondary headphone */ |
| 3000 | fallback_dac = spec->multiout.dac_nids[0]; |
| 3001 | if (spec->multiout.hp_nid) { |
| 3002 | for (j = 0; j < cfg->hp_outs; j++) |
| 3003 | if (cfg->hp_pins[j] == nid) { |
| 3004 | fallback_dac = spec->multiout.hp_nid; |
| 3005 | break; |
| 3006 | } |
| 3007 | } |
| 3008 | |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 3009 | if (conn_len > 1) { |
| 3010 | for (j = 0; j < conn_len; j++) { |
David Henningsson | 48718ea | 2011-10-05 09:49:05 +0200 | [diff] [blame] | 3011 | if (conn[j] == fallback_dac) { |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 3012 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3013 | AC_VERB_SET_CONNECT_SEL, j); |
| 3014 | break; |
| 3015 | } |
| 3016 | } |
| 3017 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3018 | return 0; |
| 3019 | } |
| 3020 | |
| 3021 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3022 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3023 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3024 | /* |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3025 | * Fill in the dac_nids table from the parsed pin configuration |
| 3026 | * This function only works when every pin in line_out_pins[] |
| 3027 | * contains atleast one DAC in its connection list. Some 92xx |
| 3028 | * codecs are not connected directly to a DAC, such as the 9200 |
| 3029 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3030 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3031 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3032 | { |
| 3033 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3034 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3035 | int i; |
| 3036 | hda_nid_t nid, dac; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3037 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3038 | for (i = 0; i < cfg->line_outs; i++) { |
| 3039 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3040 | dac = get_unassigned_dac(codec, nid); |
| 3041 | if (!dac) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 3042 | if (spec->multiout.num_dacs > 0) { |
| 3043 | /* we have already working output pins, |
| 3044 | * so let's drop the broken ones again |
| 3045 | */ |
| 3046 | cfg->line_outs = spec->multiout.num_dacs; |
| 3047 | break; |
| 3048 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3049 | /* error out, no available DAC found */ |
| 3050 | snd_printk(KERN_ERR |
| 3051 | "%s: No available DAC for pin 0x%x\n", |
| 3052 | __func__, nid); |
| 3053 | return -ENODEV; |
| 3054 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3055 | add_spec_dacs(spec, dac); |
| 3056 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3057 | |
Takashi Iwai | 139e071 | 2009-03-06 12:10:41 +0100 | [diff] [blame] | 3058 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3059 | nid = cfg->hp_pins[i]; |
| 3060 | dac = get_unassigned_dac(codec, nid); |
| 3061 | if (dac) { |
| 3062 | if (!spec->multiout.hp_nid) |
| 3063 | spec->multiout.hp_nid = dac; |
| 3064 | else |
| 3065 | add_spec_extra_dacs(spec, dac); |
| 3066 | } |
| 3067 | spec->hp_dacs[i] = dac; |
| 3068 | } |
| 3069 | |
| 3070 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 3071 | nid = cfg->speaker_pins[i]; |
| 3072 | dac = get_unassigned_dac(codec, nid); |
| 3073 | if (dac) |
| 3074 | add_spec_extra_dacs(spec, dac); |
| 3075 | spec->speaker_dacs[i] = dac; |
| 3076 | } |
| 3077 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3078 | /* add line-in as output */ |
| 3079 | nid = check_line_out_switch(codec); |
| 3080 | if (nid) { |
| 3081 | dac = get_unassigned_dac(codec, nid); |
| 3082 | if (dac) { |
| 3083 | snd_printdd("STAC: Add line-in 0x%x as output %d\n", |
| 3084 | nid, cfg->line_outs); |
| 3085 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3086 | cfg->line_outs++; |
| 3087 | spec->line_switch = nid; |
| 3088 | add_spec_dacs(spec, dac); |
| 3089 | } |
| 3090 | } |
| 3091 | /* add mic as output */ |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3092 | nid = check_mic_out_switch(codec, &dac); |
| 3093 | if (nid && dac) { |
| 3094 | snd_printdd("STAC: Add mic-in 0x%x as output %d\n", |
| 3095 | nid, cfg->line_outs); |
| 3096 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3097 | cfg->line_outs++; |
| 3098 | spec->mic_switch = nid; |
| 3099 | add_spec_dacs(spec, dac); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3100 | } |
| 3101 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3102 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3103 | spec->multiout.num_dacs, |
| 3104 | spec->multiout.dac_nids[0], |
| 3105 | spec->multiout.dac_nids[1], |
| 3106 | spec->multiout.dac_nids[2], |
| 3107 | spec->multiout.dac_nids[3], |
| 3108 | spec->multiout.dac_nids[4]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3109 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3110 | return 0; |
| 3111 | } |
| 3112 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3113 | /* create volume control/switch for the given prefx type */ |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3114 | static int create_controls_idx(struct hda_codec *codec, const char *pfx, |
| 3115 | int idx, hda_nid_t nid, int chs) |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3116 | { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3117 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3118 | char name[32]; |
| 3119 | int err; |
| 3120 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3121 | if (!spec->check_volume_offset) { |
| 3122 | unsigned int caps, step, nums, db_scale; |
| 3123 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3124 | step = (caps & AC_AMPCAP_STEP_SIZE) >> |
| 3125 | AC_AMPCAP_STEP_SIZE_SHIFT; |
| 3126 | step = (step + 1) * 25; /* in .01dB unit */ |
| 3127 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> |
| 3128 | AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3129 | db_scale = nums * step; |
| 3130 | /* if dB scale is over -64dB, and finer enough, |
| 3131 | * let's reduce it to half |
| 3132 | */ |
| 3133 | if (db_scale > 6400 && nums >= 0x1f) |
| 3134 | spec->volume_offset = nums / 2; |
| 3135 | spec->check_volume_offset = 1; |
| 3136 | } |
| 3137 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3138 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3139 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3140 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
| 3141 | spec->volume_offset)); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3142 | if (err < 0) |
| 3143 | return err; |
| 3144 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3145 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3146 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 3147 | if (err < 0) |
| 3148 | return err; |
| 3149 | return 0; |
| 3150 | } |
| 3151 | |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3152 | #define create_controls(codec, pfx, nid, chs) \ |
| 3153 | create_controls_idx(codec, pfx, 0, nid, chs) |
| 3154 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3155 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3156 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3157 | if (spec->multiout.num_dacs > 4) { |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3158 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 3159 | return 1; |
| 3160 | } else { |
Takashi Iwai | dda1441 | 2011-05-02 11:29:30 +0200 | [diff] [blame] | 3161 | snd_BUG_ON(spec->multiout.dac_nids != spec->dac_nids); |
| 3162 | spec->dac_nids[spec->multiout.num_dacs] = nid; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3163 | spec->multiout.num_dacs++; |
| 3164 | } |
| 3165 | return 0; |
| 3166 | } |
| 3167 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3168 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3169 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3170 | int i; |
| 3171 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { |
| 3172 | if (!spec->multiout.extra_out_nid[i]) { |
| 3173 | spec->multiout.extra_out_nid[i] = nid; |
| 3174 | return 0; |
| 3175 | } |
| 3176 | } |
| 3177 | printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); |
| 3178 | return 1; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3179 | } |
| 3180 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3181 | /* Create output controls |
| 3182 | * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) |
| 3183 | */ |
| 3184 | static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, |
| 3185 | const hda_nid_t *pins, |
| 3186 | const hda_nid_t *dac_nids, |
| 3187 | int type) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3188 | { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3189 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3190 | static const char * const chname[4] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3191 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3192 | }; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3193 | hda_nid_t nid; |
Takashi Iwai | 9158923 | 2008-12-19 15:59:40 +0100 | [diff] [blame] | 3194 | int i, err; |
| 3195 | unsigned int wid_caps; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3196 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3197 | for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3198 | if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 3199 | if (is_jack_detectable(codec, pins[i])) |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3200 | spec->hp_detect = 1; |
| 3201 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3202 | nid = dac_nids[i]; |
| 3203 | if (!nid) |
| 3204 | continue; |
| 3205 | if (type != AUTO_PIN_HP_OUT && i == 2) { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3206 | /* Center/LFE */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3207 | err = create_controls(codec, "Center", nid, 1); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3208 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3209 | return err; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3210 | err = create_controls(codec, "LFE", nid, 2); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3211 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3212 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3213 | |
| 3214 | wid_caps = get_wcaps(codec, nid); |
| 3215 | |
| 3216 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 3217 | err = stac92xx_add_control(spec, |
| 3218 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 3219 | "Swap Center/LFE Playback Switch", nid); |
| 3220 | |
| 3221 | if (err < 0) |
| 3222 | return err; |
| 3223 | } |
| 3224 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3225 | } else { |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3226 | const char *name; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3227 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3228 | switch (type) { |
| 3229 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3230 | name = "Headphone"; |
| 3231 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3232 | break; |
| 3233 | case AUTO_PIN_SPEAKER_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3234 | name = "Speaker"; |
| 3235 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3236 | break; |
| 3237 | default: |
| 3238 | name = chname[i]; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3239 | idx = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3240 | break; |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3241 | } |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3242 | err = create_controls_idx(codec, name, idx, nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3243 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3244 | return err; |
| 3245 | } |
| 3246 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3247 | return 0; |
| 3248 | } |
| 3249 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3250 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, |
| 3251 | unsigned long sw, int idx) |
| 3252 | { |
| 3253 | int err; |
| 3254 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, |
Takashi Iwai | bf677bd8 | 2009-07-30 09:24:29 +0200 | [diff] [blame] | 3255 | "Capture Volume", vol); |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3256 | if (err < 0) |
| 3257 | return err; |
| 3258 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, |
Takashi Iwai | bf677bd8 | 2009-07-30 09:24:29 +0200 | [diff] [blame] | 3259 | "Capture Switch", sw); |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3260 | if (err < 0) |
| 3261 | return err; |
| 3262 | return 0; |
| 3263 | } |
| 3264 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3265 | /* add playback controls from the parsed DAC table */ |
| 3266 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 3267 | const struct auto_pin_cfg *cfg) |
| 3268 | { |
| 3269 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3270 | hda_nid_t nid; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3271 | int err; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3272 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3273 | |
| 3274 | err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, |
| 3275 | spec->multiout.dac_nids, |
| 3276 | cfg->line_out_type); |
| 3277 | if (err < 0) |
| 3278 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3279 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 3280 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3281 | err = stac92xx_add_control(spec, |
| 3282 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 3283 | "Headphone as Line Out Switch", |
| 3284 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3285 | if (err < 0) |
| 3286 | return err; |
| 3287 | } |
| 3288 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3289 | for (idx = 0; idx < cfg->num_inputs; idx++) { |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 3290 | if (cfg->inputs[idx].type > AUTO_PIN_LINE_IN) |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3291 | break; |
| 3292 | nid = cfg->inputs[idx].pin; |
| 3293 | err = stac92xx_add_jack_mode_control(codec, nid, idx); |
| 3294 | if (err < 0) |
| 3295 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3296 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3297 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3298 | return 0; |
| 3299 | } |
| 3300 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3301 | /* add playback controls for Speaker and HP outputs */ |
| 3302 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3303 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3304 | { |
| 3305 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3306 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3307 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3308 | err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, |
| 3309 | spec->hp_dacs, AUTO_PIN_HP_OUT); |
| 3310 | if (err < 0) |
| 3311 | return err; |
| 3312 | |
| 3313 | err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, |
| 3314 | spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); |
| 3315 | if (err < 0) |
| 3316 | return err; |
| 3317 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3318 | return 0; |
| 3319 | } |
| 3320 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3321 | /* labels for mono mux outputs */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3322 | static const char * const stac92xx_mono_labels[4] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3323 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3324 | }; |
| 3325 | |
| 3326 | /* create mono mux for mono out on capable codecs */ |
| 3327 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3328 | { |
| 3329 | struct sigmatel_spec *spec = codec->spec; |
| 3330 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3331 | int i, num_cons; |
| 3332 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3333 | |
| 3334 | num_cons = snd_hda_get_connections(codec, |
| 3335 | spec->mono_nid, |
| 3336 | con_lst, |
| 3337 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3338 | if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3339 | return -EINVAL; |
| 3340 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3341 | for (i = 0; i < num_cons; i++) |
| 3342 | snd_hda_add_imux_item(mono_mux, stac92xx_mono_labels[i], i, |
| 3343 | NULL); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3344 | |
| 3345 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3346 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3347 | } |
| 3348 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3349 | /* create PC beep volume controls */ |
| 3350 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3351 | hda_nid_t nid) |
| 3352 | { |
| 3353 | struct sigmatel_spec *spec = codec->spec; |
| 3354 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3355 | int err, type = STAC_CTL_WIDGET_MUTE_BEEP; |
| 3356 | |
| 3357 | if (spec->anabeep_nid == nid) |
| 3358 | type = STAC_CTL_WIDGET_MUTE; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3359 | |
| 3360 | /* check for mute support for the the amp */ |
| 3361 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3362 | err = stac92xx_add_control(spec, type, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3363 | "Beep Playback Switch", |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3364 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3365 | if (err < 0) |
| 3366 | return err; |
| 3367 | } |
| 3368 | |
| 3369 | /* check to see if there is volume support for the amp */ |
| 3370 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3371 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3372 | "Beep Playback Volume", |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3373 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3374 | if (err < 0) |
| 3375 | return err; |
| 3376 | } |
| 3377 | return 0; |
| 3378 | } |
| 3379 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3380 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3381 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3382 | |
| 3383 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3384 | struct snd_ctl_elem_value *ucontrol) |
| 3385 | { |
| 3386 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3387 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3388 | return 0; |
| 3389 | } |
| 3390 | |
| 3391 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3392 | struct snd_ctl_elem_value *ucontrol) |
| 3393 | { |
| 3394 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 3395 | return snd_hda_enable_beep_device(codec, ucontrol->value.integer.value[0]); |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3396 | } |
| 3397 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 3398 | static const struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3399 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3400 | .info = stac92xx_dig_beep_switch_info, |
| 3401 | .get = stac92xx_dig_beep_switch_get, |
| 3402 | .put = stac92xx_dig_beep_switch_put, |
| 3403 | }; |
| 3404 | |
| 3405 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3406 | { |
| 3407 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
Jaroslav Kysela | d355c82a | 2009-11-03 15:47:25 +0100 | [diff] [blame] | 3408 | 0, "Beep Playback Switch", 0); |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3409 | } |
| 3410 | #endif |
| 3411 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3412 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3413 | { |
| 3414 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3415 | int i, j, err = 0; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3416 | |
| 3417 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3418 | hda_nid_t nid; |
| 3419 | unsigned int wcaps; |
| 3420 | unsigned long val; |
| 3421 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3422 | nid = spec->mux_nids[i]; |
| 3423 | wcaps = get_wcaps(codec, nid); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3424 | if (!(wcaps & AC_WCAP_OUT_AMP)) |
| 3425 | continue; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3426 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3427 | /* check whether already the same control was created as |
| 3428 | * normal Capture Volume. |
| 3429 | */ |
| 3430 | val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 3431 | for (j = 0; j < spec->num_caps; j++) { |
| 3432 | if (spec->capvols[j] == val) |
| 3433 | break; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3434 | } |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3435 | if (j < spec->num_caps) |
| 3436 | continue; |
| 3437 | |
| 3438 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, i, |
| 3439 | "Mux Capture Volume", val); |
| 3440 | if (err < 0) |
| 3441 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3442 | } |
| 3443 | return 0; |
| 3444 | }; |
| 3445 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3446 | static const char * const stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3447 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3448 | }; |
| 3449 | |
| 3450 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3451 | { |
| 3452 | struct sigmatel_spec *spec = codec->spec; |
| 3453 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3454 | const char * const *labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3455 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3456 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3457 | |
| 3458 | num_cons = snd_hda_get_connections(codec, |
| 3459 | spec->smux_nids[0], |
| 3460 | con_lst, |
| 3461 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3462 | if (num_cons <= 0) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3463 | return -EINVAL; |
| 3464 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3465 | if (!labels) |
| 3466 | labels = stac92xx_spdif_labels; |
| 3467 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3468 | for (i = 0; i < num_cons; i++) |
| 3469 | snd_hda_add_imux_item(spdif_mux, labels[i], i, NULL); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3470 | |
| 3471 | return 0; |
| 3472 | } |
| 3473 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3474 | /* labels for dmic mux inputs */ |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 3475 | static const char * const stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3476 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3477 | "Digital Mic 3", "Digital Mic 4" |
| 3478 | }; |
| 3479 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 3480 | static hda_nid_t get_connected_node(struct hda_codec *codec, hda_nid_t mux, |
| 3481 | int idx) |
| 3482 | { |
| 3483 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 3484 | int nums; |
| 3485 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 3486 | if (idx >= 0 && idx < nums) |
| 3487 | return conn[idx]; |
| 3488 | return 0; |
| 3489 | } |
| 3490 | |
Takashi Iwai | 8d087c7 | 2011-06-28 12:45:47 +0200 | [diff] [blame] | 3491 | /* look for NID recursively */ |
| 3492 | #define get_connection_index(codec, mux, nid) \ |
| 3493 | snd_hda_get_conn_index(codec, mux, nid, 1) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3494 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3495 | /* create a volume assigned to the given pin (only if supported) */ |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3496 | /* return 1 if the volume control is created */ |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3497 | static int create_elem_capture_vol(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3498 | const char *label, int idx, int direction) |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3499 | { |
| 3500 | unsigned int caps, nums; |
| 3501 | char name[32]; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3502 | int err; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3503 | |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3504 | if (direction == HDA_OUTPUT) |
| 3505 | caps = AC_WCAP_OUT_AMP; |
| 3506 | else |
| 3507 | caps = AC_WCAP_IN_AMP; |
| 3508 | if (!(get_wcaps(codec, nid) & caps)) |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3509 | return 0; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3510 | caps = query_amp_caps(codec, nid, direction); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3511 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3512 | if (!nums) |
| 3513 | return 0; |
| 3514 | snprintf(name, sizeof(name), "%s Capture Volume", label); |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3515 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, name, |
| 3516 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, direction)); |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3517 | if (err < 0) |
| 3518 | return err; |
| 3519 | return 1; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3520 | } |
| 3521 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3522 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3523 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3524 | const struct auto_pin_cfg *cfg) |
| 3525 | { |
| 3526 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3527 | struct hda_input_mux *imux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3528 | struct hda_input_mux *dimux = &spec->private_dimux; |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3529 | int err, i; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3530 | unsigned int def_conf; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3531 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3532 | snd_hda_add_imux_item(dimux, stac92xx_dmic_labels[0], 0, NULL); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3533 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3534 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3535 | hda_nid_t nid; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3536 | int index, type_idx; |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 3537 | char label[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3538 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3539 | nid = spec->dmic_nids[i]; |
| 3540 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 3541 | continue; |
| 3542 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3543 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3544 | continue; |
| 3545 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3546 | index = get_connection_index(codec, spec->dmux_nids[0], nid); |
| 3547 | if (index < 0) |
| 3548 | continue; |
| 3549 | |
Takashi Iwai | 201e06f | 2011-11-16 15:33:26 +0100 | [diff] [blame] | 3550 | snd_hda_get_pin_label(codec, nid, &spec->autocfg, |
| 3551 | label, sizeof(label), NULL); |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3552 | snd_hda_add_imux_item(dimux, label, index, &type_idx); |
Takashi Iwai | 2d7ec12 | 2010-12-23 10:16:05 +0100 | [diff] [blame] | 3553 | if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) |
| 3554 | snd_hda_add_imux_item(imux, label, index, &type_idx); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3555 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3556 | err = create_elem_capture_vol(codec, nid, label, type_idx, |
| 3557 | HDA_INPUT); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3558 | if (err < 0) |
| 3559 | return err; |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3560 | if (!err) { |
| 3561 | err = create_elem_capture_vol(codec, nid, label, |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3562 | type_idx, HDA_OUTPUT); |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3563 | if (err < 0) |
| 3564 | return err; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 3565 | if (!err) { |
| 3566 | nid = get_connected_node(codec, |
| 3567 | spec->dmux_nids[0], index); |
| 3568 | if (nid) |
| 3569 | err = create_elem_capture_vol(codec, |
| 3570 | nid, label, |
| 3571 | type_idx, HDA_INPUT); |
| 3572 | if (err < 0) |
| 3573 | return err; |
| 3574 | } |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3575 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3576 | } |
| 3577 | |
| 3578 | return 0; |
| 3579 | } |
| 3580 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3581 | static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid, |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3582 | hda_nid_t *fixed, hda_nid_t *ext, hda_nid_t *dock) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3583 | { |
| 3584 | unsigned int cfg; |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3585 | unsigned int type; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3586 | |
| 3587 | if (!nid) |
| 3588 | return 0; |
| 3589 | cfg = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3590 | type = get_defcfg_device(cfg); |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3591 | switch (snd_hda_get_input_pin_attr(cfg)) { |
| 3592 | case INPUT_PIN_ATTR_INT: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3593 | if (*fixed) |
| 3594 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3595 | if (type != AC_JACK_MIC_IN) |
| 3596 | return 1; /* invalid type */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3597 | *fixed = nid; |
| 3598 | break; |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3599 | case INPUT_PIN_ATTR_UNUSED: |
| 3600 | break; |
| 3601 | case INPUT_PIN_ATTR_DOCK: |
| 3602 | if (*dock) |
| 3603 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3604 | if (type != AC_JACK_MIC_IN && type != AC_JACK_LINE_IN) |
| 3605 | return 1; /* invalid type */ |
Takashi Iwai | 99ae28b | 2010-09-17 14:42:34 +0200 | [diff] [blame] | 3606 | *dock = nid; |
| 3607 | break; |
| 3608 | default: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3609 | if (*ext) |
| 3610 | return 1; /* already occupied */ |
Takashi Iwai | 1f83ac5 | 2011-05-17 12:29:09 +0200 | [diff] [blame] | 3611 | if (type != AC_JACK_MIC_IN) |
| 3612 | return 1; /* invalid type */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3613 | *ext = nid; |
| 3614 | break; |
| 3615 | } |
| 3616 | return 0; |
| 3617 | } |
| 3618 | |
| 3619 | static int set_mic_route(struct hda_codec *codec, |
| 3620 | struct sigmatel_mic_route *mic, |
| 3621 | hda_nid_t pin) |
| 3622 | { |
| 3623 | struct sigmatel_spec *spec = codec->spec; |
| 3624 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3625 | int i; |
| 3626 | |
| 3627 | mic->pin = pin; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3628 | if (pin == 0) |
| 3629 | return 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3630 | for (i = 0; i < cfg->num_inputs; i++) { |
| 3631 | if (pin == cfg->inputs[i].pin) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3632 | break; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3633 | } |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 3634 | if (i < cfg->num_inputs && cfg->inputs[i].type == AUTO_PIN_MIC) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3635 | /* analog pin */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3636 | i = get_connection_index(codec, spec->mux_nids[0], pin); |
| 3637 | if (i < 0) |
| 3638 | return -1; |
| 3639 | mic->mux_idx = i; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 3640 | mic->dmux_idx = -1; |
| 3641 | if (spec->dmux_nids) |
| 3642 | mic->dmux_idx = get_connection_index(codec, |
| 3643 | spec->dmux_nids[0], |
| 3644 | spec->mux_nids[0]); |
Takashi Iwai | da2a2aa | 2009-08-10 07:44:09 +0200 | [diff] [blame] | 3645 | } else if (spec->dmux_nids) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3646 | /* digital pin */ |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3647 | i = get_connection_index(codec, spec->dmux_nids[0], pin); |
| 3648 | if (i < 0) |
| 3649 | return -1; |
| 3650 | mic->dmux_idx = i; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 3651 | mic->mux_idx = -1; |
| 3652 | if (spec->mux_nids) |
| 3653 | mic->mux_idx = get_connection_index(codec, |
| 3654 | spec->mux_nids[0], |
| 3655 | spec->dmux_nids[0]); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3656 | } |
| 3657 | return 0; |
| 3658 | } |
| 3659 | |
| 3660 | /* return non-zero if the device is for automatic mic switch */ |
| 3661 | static int stac_check_auto_mic(struct hda_codec *codec) |
| 3662 | { |
| 3663 | struct sigmatel_spec *spec = codec->spec; |
| 3664 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3665 | hda_nid_t fixed, ext, dock; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3666 | int i; |
| 3667 | |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3668 | fixed = ext = dock = 0; |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3669 | for (i = 0; i < cfg->num_inputs; i++) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3670 | if (check_mic_pin(codec, cfg->inputs[i].pin, |
| 3671 | &fixed, &ext, &dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3672 | return 0; |
| 3673 | for (i = 0; i < spec->num_dmics; i++) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3674 | if (check_mic_pin(codec, spec->dmic_nids[i], |
| 3675 | &fixed, &ext, &dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3676 | return 0; |
Takashi Iwai | 80c6785 | 2011-01-13 08:08:08 +0100 | [diff] [blame] | 3677 | if (!fixed || (!ext && !dock)) |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3678 | return 0; /* no input to switch */ |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 3679 | if (!is_jack_detectable(codec, ext)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3680 | return 0; /* no unsol support */ |
| 3681 | if (set_mic_route(codec, &spec->ext_mic, ext) || |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 3682 | set_mic_route(codec, &spec->int_mic, fixed) || |
| 3683 | set_mic_route(codec, &spec->dock_mic, dock)) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3684 | return 0; /* something is wrong */ |
| 3685 | return 1; |
| 3686 | } |
| 3687 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3688 | /* create playback/capture controls for input pins */ |
| 3689 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3690 | { |
| 3691 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3692 | struct hda_input_mux *imux = &spec->private_imux; |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3693 | int i, j; |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3694 | const char *label; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3695 | |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 3696 | for (i = 0; i < cfg->num_inputs; i++) { |
| 3697 | hda_nid_t nid = cfg->inputs[i].pin; |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3698 | int index, err, type_idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3699 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3700 | index = -1; |
| 3701 | for (j = 0; j < spec->num_muxes; j++) { |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3702 | index = get_connection_index(codec, spec->mux_nids[j], |
| 3703 | nid); |
| 3704 | if (index >= 0) |
| 3705 | break; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3706 | } |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3707 | if (index < 0) |
| 3708 | continue; |
| 3709 | |
Takashi Iwai | 10a20af | 2010-09-09 16:28:02 +0200 | [diff] [blame] | 3710 | label = hda_get_autocfg_input_label(codec, cfg, i); |
| 3711 | snd_hda_add_imux_item(imux, label, index, &type_idx); |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3712 | |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3713 | err = create_elem_capture_vol(codec, nid, |
Vitaliy Kulikov | 263d032 | 2010-09-08 08:56:03 +0200 | [diff] [blame] | 3714 | label, type_idx, |
Takashi Iwai | 96f845d | 2009-08-29 00:49:36 +0200 | [diff] [blame] | 3715 | HDA_INPUT); |
Takashi Iwai | 667067d | 2009-08-13 18:14:42 +0200 | [diff] [blame] | 3716 | if (err < 0) |
| 3717 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3718 | } |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 3719 | spec->num_analog_muxes = imux->num_items; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3720 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3721 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3722 | /* |
| 3723 | * Set the current input for the muxes. |
| 3724 | * The STAC9221 has two input muxes with identical source |
| 3725 | * NID lists. Hopefully this won't get confused. |
| 3726 | */ |
| 3727 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3728 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3729 | AC_VERB_SET_CONNECT_SEL, |
| 3730 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3731 | } |
| 3732 | } |
| 3733 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3734 | return 0; |
| 3735 | } |
| 3736 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3737 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3738 | { |
| 3739 | struct sigmatel_spec *spec = codec->spec; |
| 3740 | int i; |
| 3741 | |
| 3742 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3743 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3744 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3745 | } |
| 3746 | } |
| 3747 | |
| 3748 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3749 | { |
| 3750 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3751 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3752 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3753 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3754 | hda_nid_t pin; |
| 3755 | pin = spec->autocfg.hp_pins[i]; |
| 3756 | if (pin) /* connect to front */ |
| 3757 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3758 | } |
| 3759 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3760 | hda_nid_t pin; |
| 3761 | pin = spec->autocfg.speaker_pins[i]; |
| 3762 | if (pin) /* connect to front */ |
| 3763 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3764 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3765 | } |
| 3766 | |
Takashi Iwai | 8af3aeb | 2009-11-18 14:23:37 +0100 | [diff] [blame] | 3767 | static int is_dual_headphones(struct hda_codec *codec) |
| 3768 | { |
| 3769 | struct sigmatel_spec *spec = codec->spec; |
| 3770 | int i, valid_hps; |
| 3771 | |
| 3772 | if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT || |
| 3773 | spec->autocfg.hp_outs <= 1) |
| 3774 | return 0; |
| 3775 | valid_hps = 0; |
| 3776 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3777 | hda_nid_t nid = spec->autocfg.hp_pins[i]; |
| 3778 | unsigned int cfg = snd_hda_codec_get_pincfg(codec, nid); |
| 3779 | if (get_defcfg_location(cfg) & AC_JACK_LOC_SEPARATE) |
| 3780 | continue; |
| 3781 | valid_hps++; |
| 3782 | } |
| 3783 | return (valid_hps > 1); |
| 3784 | } |
| 3785 | |
| 3786 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3787 | static int stac92xx_parse_auto_config(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3788 | { |
| 3789 | struct sigmatel_spec *spec = codec->spec; |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3790 | hda_nid_t dig_out = 0, dig_in = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3791 | int hp_swap = 0; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3792 | int i, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3793 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3794 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3795 | &spec->autocfg, |
| 3796 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3797 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3798 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3799 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3800 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3801 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3802 | * be set up as multi-channel outputs. |
| 3803 | */ |
Takashi Iwai | 8af3aeb | 2009-11-18 14:23:37 +0100 | [diff] [blame] | 3804 | if (is_dual_headphones(codec)) { |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3805 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3806 | * speaker_outs so that the following routines can handle |
| 3807 | * HP pins as primary outputs. |
| 3808 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3809 | snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3810 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3811 | sizeof(spec->autocfg.line_out_pins)); |
| 3812 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3813 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3814 | sizeof(spec->autocfg.hp_pins)); |
| 3815 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3816 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3817 | spec->autocfg.hp_outs = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3818 | hp_swap = 1; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3819 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3820 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3821 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3822 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3823 | u32 caps = query_amp_caps(codec, |
| 3824 | spec->autocfg.mono_out_pin, dir); |
| 3825 | hda_nid_t conn_list[1]; |
| 3826 | |
| 3827 | /* get the mixer node and then the mono mux if it exists */ |
| 3828 | if (snd_hda_get_connections(codec, |
| 3829 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3830 | snd_hda_get_connections(codec, conn_list[0], |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3831 | conn_list, 1) > 0) { |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3832 | |
| 3833 | int wcaps = get_wcaps(codec, conn_list[0]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 3834 | int wid_type = get_wcaps_type(wcaps); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3835 | /* LR swap check, some stac925x have a mux that |
| 3836 | * changes the DACs output path instead of the |
| 3837 | * mono-mux path. |
| 3838 | */ |
| 3839 | if (wid_type == AC_WID_AUD_SEL && |
| 3840 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3841 | spec->mono_nid = conn_list[0]; |
| 3842 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3843 | if (dir) { |
| 3844 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3845 | |
| 3846 | /* most mono outs have a least a mute/unmute switch */ |
| 3847 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3848 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3849 | "Mono Playback Switch", |
| 3850 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3851 | if (err < 0) |
| 3852 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3853 | /* check for volume support for the amp */ |
| 3854 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3855 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3856 | err = stac92xx_add_control(spec, |
| 3857 | STAC_CTL_WIDGET_VOL, |
| 3858 | "Mono Playback Volume", |
| 3859 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3860 | if (err < 0) |
| 3861 | return err; |
| 3862 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3863 | } |
| 3864 | |
| 3865 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3866 | AC_PINCTL_OUT_EN); |
| 3867 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3868 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3869 | if (!spec->multiout.num_dacs) { |
| 3870 | err = stac92xx_auto_fill_dac_nids(codec); |
| 3871 | if (err < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3872 | return err; |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 3873 | err = stac92xx_auto_create_multi_out_ctls(codec, |
| 3874 | &spec->autocfg); |
| 3875 | if (err < 0) |
| 3876 | return err; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3877 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3878 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3879 | /* setup analog beep controls */ |
| 3880 | if (spec->anabeep_nid > 0) { |
| 3881 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3882 | spec->anabeep_nid); |
| 3883 | if (err < 0) |
| 3884 | return err; |
| 3885 | } |
| 3886 | |
| 3887 | /* setup digital beep controls and input device */ |
| 3888 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3889 | if (spec->digbeep_nid > 0) { |
| 3890 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3891 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3892 | |
| 3893 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3894 | if (err < 0) |
| 3895 | return err; |
| 3896 | err = snd_hda_attach_beep_device(codec, nid); |
| 3897 | if (err < 0) |
| 3898 | return err; |
Takashi Iwai | d8d881d | 2009-12-22 07:52:49 +0100 | [diff] [blame] | 3899 | if (codec->beep) { |
| 3900 | /* IDT/STAC codecs have linear beep tone parameter */ |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 3901 | codec->beep->linear_tone = spec->linear_tone_beep; |
Takashi Iwai | d8d881d | 2009-12-22 07:52:49 +0100 | [diff] [blame] | 3902 | /* if no beep switch is available, make its own one */ |
| 3903 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3904 | if (!(caps & AC_AMPCAP_MUTE)) { |
| 3905 | err = stac92xx_beep_switch_ctl(codec); |
| 3906 | if (err < 0) |
| 3907 | return err; |
| 3908 | } |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3909 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3910 | } |
| 3911 | #endif |
| 3912 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3913 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3914 | if (err < 0) |
| 3915 | return err; |
| 3916 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3917 | /* All output parsing done, now restore the swapped hp pins */ |
| 3918 | if (hp_swap) { |
| 3919 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 3920 | sizeof(spec->autocfg.hp_pins)); |
| 3921 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 3922 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3923 | spec->autocfg.line_outs = 0; |
| 3924 | } |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3925 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 3926 | if (stac_check_auto_mic(codec)) { |
| 3927 | spec->auto_mic = 1; |
| 3928 | /* only one capture for auto-mic */ |
| 3929 | spec->num_adcs = 1; |
| 3930 | spec->num_caps = 1; |
| 3931 | spec->num_muxes = 1; |
| 3932 | } |
| 3933 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3934 | for (i = 0; i < spec->num_caps; i++) { |
| 3935 | err = stac92xx_add_capvol_ctls(codec, spec->capvols[i], |
| 3936 | spec->capsws[i], i); |
| 3937 | if (err < 0) |
| 3938 | return err; |
| 3939 | } |
| 3940 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3941 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3942 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3943 | return err; |
| 3944 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3945 | if (spec->mono_nid > 0) { |
| 3946 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3947 | if (err < 0) |
| 3948 | return err; |
| 3949 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3950 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3951 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3952 | &spec->autocfg)) < 0) |
| 3953 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3954 | if (spec->num_muxes > 0) { |
| 3955 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3956 | if (err < 0) |
| 3957 | return err; |
| 3958 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3959 | if (spec->num_smuxes > 0) { |
| 3960 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3961 | if (err < 0) |
| 3962 | return err; |
| 3963 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3964 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3965 | err = stac92xx_add_input_source(spec); |
| 3966 | if (err < 0) |
| 3967 | return err; |
| 3968 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3969 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3970 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3971 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3972 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 3973 | /* find digital out and in converters */ |
| 3974 | for (i = codec->start_nid; i < codec->start_nid + codec->num_nodes; i++) { |
| 3975 | unsigned int wid_caps = get_wcaps(codec, i); |
| 3976 | if (wid_caps & AC_WCAP_DIGITAL) { |
| 3977 | switch (get_wcaps_type(wid_caps)) { |
| 3978 | case AC_WID_AUD_OUT: |
| 3979 | if (!dig_out) |
| 3980 | dig_out = i; |
| 3981 | break; |
| 3982 | case AC_WID_AUD_IN: |
| 3983 | if (!dig_in) |
| 3984 | dig_in = i; |
| 3985 | break; |
| 3986 | } |
| 3987 | } |
| 3988 | } |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 3989 | if (spec->autocfg.dig_outs) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3990 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3991 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3992 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3993 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3994 | if (spec->kctls.list) |
| 3995 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3996 | |
| 3997 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | f8ccbf6 | 2008-12-20 17:36:28 -0500 | [diff] [blame] | 3998 | if (!spec->dinput_mux) |
| 3999 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4000 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 4001 | spec->mono_mux = &spec->private_mono_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4002 | return 1; |
| 4003 | } |
| 4004 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4005 | /* add playback controls for HP output */ |
| 4006 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 4007 | struct auto_pin_cfg *cfg) |
| 4008 | { |
| 4009 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4010 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4011 | |
| 4012 | if (! pin) |
| 4013 | return 0; |
| 4014 | |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 4015 | if (is_jack_detectable(codec, pin)) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4016 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4017 | |
| 4018 | return 0; |
| 4019 | } |
| 4020 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4021 | /* add playback controls for LFE output */ |
| 4022 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 4023 | struct auto_pin_cfg *cfg) |
| 4024 | { |
| 4025 | struct sigmatel_spec *spec = codec->spec; |
| 4026 | int err; |
| 4027 | hda_nid_t lfe_pin = 0x0; |
| 4028 | int i; |
| 4029 | |
| 4030 | /* |
| 4031 | * search speaker outs and line outs for a mono speaker pin |
| 4032 | * with an amp. If one is found, add LFE controls |
| 4033 | * for it. |
| 4034 | */ |
| 4035 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 4036 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4037 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4038 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4039 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4040 | /* found a mono speaker with an amp, must be lfe */ |
| 4041 | lfe_pin = pin; |
| 4042 | } |
| 4043 | |
| 4044 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 4045 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 4046 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 4047 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4048 | unsigned int defcfg; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4049 | defcfg = snd_hda_codec_get_pincfg(codec, pin); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 4050 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4051 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4052 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4053 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4054 | /* found a mono speaker with an amp, |
| 4055 | must be lfe */ |
| 4056 | lfe_pin = pin; |
| 4057 | } |
| 4058 | } |
| 4059 | } |
| 4060 | |
| 4061 | if (lfe_pin) { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 4062 | err = create_controls(codec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4063 | if (err < 0) |
| 4064 | return err; |
| 4065 | } |
| 4066 | |
| 4067 | return 0; |
| 4068 | } |
| 4069 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4070 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 4071 | { |
| 4072 | struct sigmatel_spec *spec = codec->spec; |
| 4073 | int err; |
| 4074 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4075 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4076 | return err; |
| 4077 | |
| 4078 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 4079 | return err; |
| 4080 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4081 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 4082 | return err; |
| 4083 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4084 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 4085 | return err; |
| 4086 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 4087 | if (spec->num_muxes > 0) { |
| 4088 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 4089 | if (err < 0) |
| 4090 | return err; |
| 4091 | } |
| 4092 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 4093 | err = stac92xx_add_input_source(spec); |
| 4094 | if (err < 0) |
| 4095 | return err; |
| 4096 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4097 | if (spec->autocfg.dig_outs) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4098 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4099 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4100 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4101 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4102 | if (spec->kctls.list) |
| 4103 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4104 | |
| 4105 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4106 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4107 | |
| 4108 | return 1; |
| 4109 | } |
| 4110 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4111 | /* |
| 4112 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 4113 | * funky external mute control using GPIO pins. |
| 4114 | */ |
| 4115 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4116 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4117 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4118 | { |
| 4119 | unsigned int gpiostate, gpiomask, gpiodir; |
| 4120 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4121 | snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data); |
| 4122 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4123 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 4124 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4125 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4126 | |
| 4127 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 4128 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4129 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4130 | |
| 4131 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 4132 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4133 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4134 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4135 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4136 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 4137 | |
| 4138 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4139 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4140 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4141 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4142 | |
| 4143 | msleep(1); |
| 4144 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4145 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4146 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4147 | } |
| 4148 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4149 | static int stac_add_event(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4150 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4151 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4152 | struct hda_jack_tbl *event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4153 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4154 | event = snd_hda_jack_tbl_new(codec, nid); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4155 | if (!event) |
| 4156 | return -ENOMEM; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4157 | event->action = type; |
| 4158 | event->private_data = data; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4159 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4160 | return 0; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4161 | } |
| 4162 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4163 | /* check if given nid is a valid pin and no other events are assigned |
| 4164 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
| 4165 | * Otherwise, returns zero. |
| 4166 | */ |
| 4167 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 4168 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4169 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4170 | struct hda_jack_tbl *event; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4171 | |
Takashi Iwai | e35d9d6 | 2011-05-17 11:28:16 +0200 | [diff] [blame] | 4172 | if (!is_jack_detectable(codec, nid)) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4173 | return 0; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4174 | event = snd_hda_jack_tbl_new(codec, nid); |
| 4175 | if (!event) |
| 4176 | return -ENOMEM; |
| 4177 | if (event->action && event->action != type) |
| 4178 | return 0; |
| 4179 | event->action = type; |
| 4180 | snd_hda_jack_detect_enable(codec, nid, 0); |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4181 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4182 | } |
| 4183 | |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4184 | static int is_nid_out_jack_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4185 | { |
| 4186 | int i; |
| 4187 | for (i = 0; i < cfg->hp_outs; i++) |
| 4188 | if (cfg->hp_pins[i] == nid) |
| 4189 | return 1; /* nid is a HP-Out */ |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4190 | for (i = 0; i < cfg->line_outs; i++) |
| 4191 | if (cfg->line_out_pins[i] == nid) |
| 4192 | return 1; /* nid is a line-Out */ |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4193 | return 0; /* nid is not a HP-Out */ |
| 4194 | }; |
| 4195 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4196 | static void stac92xx_power_down(struct hda_codec *codec) |
| 4197 | { |
| 4198 | struct sigmatel_spec *spec = codec->spec; |
| 4199 | |
| 4200 | /* power down inactive DACs */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 4201 | const hda_nid_t *dac; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4202 | for (dac = spec->dac_list; *dac; dac++) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4203 | if (!check_all_dac_nids(spec, *dac)) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4204 | snd_hda_codec_write(codec, *dac, 0, |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4205 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 4206 | } |
| 4207 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4208 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4209 | int enable); |
| 4210 | |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4211 | static inline int get_int_hint(struct hda_codec *codec, const char *key, |
| 4212 | int *valp) |
| 4213 | { |
| 4214 | const char *p; |
| 4215 | p = snd_hda_get_hint(codec, key); |
| 4216 | if (p) { |
| 4217 | unsigned long val; |
| 4218 | if (!strict_strtoul(p, 0, &val)) { |
| 4219 | *valp = val; |
| 4220 | return 1; |
| 4221 | } |
| 4222 | } |
| 4223 | return 0; |
| 4224 | } |
| 4225 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4226 | /* override some hints from the hwdep entry */ |
| 4227 | static void stac_store_hints(struct hda_codec *codec) |
| 4228 | { |
| 4229 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4230 | int val; |
| 4231 | |
| 4232 | val = snd_hda_get_bool_hint(codec, "hp_detect"); |
| 4233 | if (val >= 0) |
| 4234 | spec->hp_detect = val; |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4235 | if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) { |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4236 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = |
| 4237 | spec->gpio_mask; |
| 4238 | } |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4239 | if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) |
| 4240 | spec->gpio_mask &= spec->gpio_mask; |
| 4241 | if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) |
| 4242 | spec->gpio_dir &= spec->gpio_mask; |
| 4243 | if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) |
| 4244 | spec->eapd_mask &= spec->gpio_mask; |
| 4245 | if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) |
| 4246 | spec->gpio_mute &= spec->gpio_mask; |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4247 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); |
| 4248 | if (val >= 0) |
| 4249 | spec->eapd_switch = val; |
Takashi Iwai | 014c41f | 2009-12-27 13:53:24 +0100 | [diff] [blame] | 4250 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); |
| 4251 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 4252 | spec->gpio_mask |= spec->gpio_led; |
| 4253 | spec->gpio_dir |= spec->gpio_led; |
| 4254 | if (spec->gpio_led_polarity) |
| 4255 | spec->gpio_data |= spec->gpio_led; |
Takashi Iwai | 043958e | 2009-12-26 10:36:12 +0100 | [diff] [blame] | 4256 | } |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4257 | } |
| 4258 | |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4259 | static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins, |
| 4260 | const hda_nid_t *pins) |
| 4261 | { |
| 4262 | while (num_pins--) |
| 4263 | stac_issue_unsol_event(codec, *pins++); |
| 4264 | } |
| 4265 | |
| 4266 | /* fake event to set up pins */ |
| 4267 | static void stac_fake_hp_events(struct hda_codec *codec) |
| 4268 | { |
| 4269 | struct sigmatel_spec *spec = codec->spec; |
| 4270 | |
| 4271 | if (spec->autocfg.hp_outs) |
| 4272 | stac_issue_unsol_events(codec, spec->autocfg.hp_outs, |
| 4273 | spec->autocfg.hp_pins); |
| 4274 | if (spec->autocfg.line_outs && |
| 4275 | spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0]) |
| 4276 | stac_issue_unsol_events(codec, spec->autocfg.line_outs, |
| 4277 | spec->autocfg.line_out_pins); |
| 4278 | } |
| 4279 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4280 | static int stac92xx_init(struct hda_codec *codec) |
| 4281 | { |
| 4282 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4283 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4284 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4285 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4286 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4287 | snd_hda_sequence_write(codec, spec->init); |
| 4288 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4289 | /* power down adcs initially */ |
| 4290 | if (spec->powerdown_adcs) |
| 4291 | for (i = 0; i < spec->num_adcs; i++) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4292 | snd_hda_codec_write(codec, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4293 | spec->adc_nids[i], 0, |
| 4294 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4295 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4296 | /* override some hints */ |
| 4297 | stac_store_hints(codec); |
| 4298 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4299 | /* set up GPIO */ |
| 4300 | gpio = spec->gpio_data; |
| 4301 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 4302 | * otherwise, unsol event will turn it on/off dynamically |
| 4303 | */ |
| 4304 | if (!spec->eapd_switch) |
| 4305 | gpio |= spec->eapd_mask; |
| 4306 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 4307 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4308 | /* set up pins */ |
| 4309 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4310 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4311 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4312 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4313 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4314 | } |
Takashi Iwai | 1c4bdf9 | 2009-08-13 08:23:24 +0200 | [diff] [blame] | 4315 | if (cfg->line_out_type == AUTO_PIN_LINE_OUT && |
| 4316 | cfg->speaker_outs > 0) { |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4317 | /* enable pin-detect for line-outs as well */ |
Takashi Iwai | 15cfa2b | 2009-08-03 14:23:33 +0200 | [diff] [blame] | 4318 | for (i = 0; i < cfg->line_outs; i++) { |
| 4319 | hda_nid_t nid = cfg->line_out_pins[i]; |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4320 | enable_pin_detect(codec, nid, STAC_LO_EVENT); |
| 4321 | } |
| 4322 | } |
| 4323 | |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 4324 | /* force to enable the first line-out; the others are set up |
| 4325 | * in unsol_event |
| 4326 | */ |
| 4327 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4328 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4329 | /* fake event to set up pins */ |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4330 | stac_fake_hp_events(codec); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4331 | } else { |
| 4332 | stac92xx_auto_init_multi_out(codec); |
| 4333 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4334 | for (i = 0; i < cfg->hp_outs; i++) |
| 4335 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4336 | } |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4337 | if (spec->auto_mic) { |
Takashi Iwai | 15b4f29 | 2009-07-29 16:32:55 +0200 | [diff] [blame] | 4338 | /* initialize connection to analog input */ |
Takashi Iwai | da2a2aa | 2009-08-10 07:44:09 +0200 | [diff] [blame] | 4339 | if (spec->dmux_nids) |
| 4340 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
Takashi Iwai | 15b4f29 | 2009-07-29 16:32:55 +0200 | [diff] [blame] | 4341 | AC_VERB_SET_CONNECT_SEL, 0); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4342 | if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT)) |
| 4343 | stac_issue_unsol_event(codec, spec->ext_mic.pin); |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 4344 | if (enable_pin_detect(codec, spec->dock_mic.pin, |
| 4345 | STAC_MIC_EVENT)) |
| 4346 | stac_issue_unsol_event(codec, spec->dock_mic.pin); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4347 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4348 | for (i = 0; i < cfg->num_inputs; i++) { |
| 4349 | hda_nid_t nid = cfg->inputs[i].pin; |
| 4350 | int type = cfg->inputs[i].type; |
| 4351 | unsigned int pinctl, conf; |
Takashi Iwai | 86e2959 | 2010-09-09 14:50:17 +0200 | [diff] [blame] | 4352 | if (type == AUTO_PIN_MIC) { |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4353 | /* for mic pins, force to initialize */ |
| 4354 | pinctl = stac92xx_get_default_vref(codec, nid); |
| 4355 | pinctl |= AC_PINCTL_IN_EN; |
| 4356 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 4357 | } else { |
| 4358 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4359 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4360 | /* if PINCTL already set then skip */ |
| 4361 | /* Also, if both INPUT and OUTPUT are set, |
| 4362 | * it must be a BIOS bug; need to override, too |
| 4363 | */ |
| 4364 | if (!(pinctl & AC_PINCTL_IN_EN) || |
| 4365 | (pinctl & AC_PINCTL_OUT_EN)) { |
| 4366 | pinctl &= ~AC_PINCTL_OUT_EN; |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4367 | pinctl |= AC_PINCTL_IN_EN; |
| 4368 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4369 | } |
Takashi Iwai | eea7dc9 | 2010-08-30 13:06:15 +0200 | [diff] [blame] | 4370 | } |
| 4371 | conf = snd_hda_codec_get_pincfg(codec, nid); |
| 4372 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
| 4373 | if (enable_pin_detect(codec, nid, STAC_INSERT_EVENT)) |
| 4374 | stac_issue_unsol_event(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4375 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4376 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4377 | for (i = 0; i < spec->num_dmics; i++) |
| 4378 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 4379 | AC_PINCTL_IN_EN); |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4380 | if (cfg->dig_out_pins[0]) |
| 4381 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4382 | AC_PINCTL_OUT_EN); |
| 4383 | if (cfg->dig_in_pin) |
| 4384 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 4385 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4386 | for (i = 0; i < spec->num_pwrs; i++) { |
| 4387 | hda_nid_t nid = spec->pwr_nids[i]; |
| 4388 | int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4389 | |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4390 | /* power on when no jack detection is available */ |
Takashi Iwai | 542c9a0 | 2011-11-29 13:01:30 +0100 | [diff] [blame] | 4391 | /* or when the VREF is used for controlling LED */ |
| 4392 | if (!spec->hp_detect || |
Takashi Iwai | a020428 | 2011-12-06 13:17:23 +0100 | [diff] [blame] | 4393 | spec->vref_mute_led_nid == nid) { |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4394 | stac_toggle_power_map(codec, nid, 1); |
| 4395 | continue; |
| 4396 | } |
| 4397 | |
Takashi Iwai | b4ead01 | 2012-01-23 18:23:36 +0100 | [diff] [blame] | 4398 | if (is_nid_out_jack_pin(cfg, nid)) |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4399 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4400 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4401 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4402 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4403 | /* outputs are only ports capable of power management |
| 4404 | * any attempts on powering down a input port cause the |
| 4405 | * referenced VREF to act quirky. |
| 4406 | */ |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4407 | if (pinctl & AC_PINCTL_IN_EN) { |
| 4408 | stac_toggle_power_map(codec, nid, 1); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4409 | continue; |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4410 | } |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4411 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4412 | def_conf = get_defcfg_connect(def_conf); |
| 4413 | /* skip any ports that don't have jacks since presence |
| 4414 | * detection is useless */ |
| 4415 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
| 4416 | if (def_conf != AC_JACK_PORT_NONE) |
| 4417 | stac_toggle_power_map(codec, nid, 1); |
| 4418 | continue; |
| 4419 | } |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4420 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) { |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4421 | stac_issue_unsol_event(codec, nid); |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4422 | continue; |
| 4423 | } |
| 4424 | /* none of the above, turn the port OFF */ |
| 4425 | stac_toggle_power_map(codec, nid, 0); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4426 | } |
Takashi Iwai | c21bd02 | 2010-02-08 15:16:08 +0100 | [diff] [blame] | 4427 | |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 4428 | snd_hda_jack_report_sync(codec); |
| 4429 | |
Takashi Iwai | c21bd02 | 2010-02-08 15:16:08 +0100 | [diff] [blame] | 4430 | /* sync mute LED */ |
Takashi Iwai | d2f344b | 2012-03-12 16:59:58 +0100 | [diff] [blame] | 4431 | snd_hda_sync_vmaster_hook(&spec->vmaster_mute); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4432 | if (spec->dac_list) |
| 4433 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4434 | return 0; |
| 4435 | } |
| 4436 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4437 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 4438 | { |
| 4439 | struct sigmatel_spec *spec = codec->spec; |
| 4440 | |
| 4441 | if (spec->kctls.list) { |
| 4442 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4443 | int i; |
| 4444 | for (i = 0; i < spec->kctls.used; i++) |
| 4445 | kfree(kctl[i].name); |
| 4446 | } |
| 4447 | snd_array_free(&spec->kctls); |
| 4448 | } |
| 4449 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4450 | static void stac92xx_shutup_pins(struct hda_codec *codec) |
| 4451 | { |
| 4452 | unsigned int i, def_conf; |
| 4453 | |
| 4454 | if (codec->bus->shutdown) |
| 4455 | return; |
| 4456 | for (i = 0; i < codec->init_pins.used; i++) { |
| 4457 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); |
| 4458 | def_conf = snd_hda_codec_get_pincfg(codec, pin->nid); |
| 4459 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 4460 | snd_hda_set_pin_ctl(codec, pin->nid, 0); |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4461 | } |
| 4462 | } |
| 4463 | |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4464 | static void stac92xx_shutup(struct hda_codec *codec) |
| 4465 | { |
| 4466 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4467 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4468 | stac92xx_shutup_pins(codec); |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4469 | |
| 4470 | if (spec->eapd_mask) |
| 4471 | stac_gpio_set(codec, spec->gpio_mask, |
| 4472 | spec->gpio_dir, spec->gpio_data & |
| 4473 | ~spec->eapd_mask); |
| 4474 | } |
| 4475 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4476 | static void stac92xx_free(struct hda_codec *codec) |
| 4477 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4478 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4479 | |
| 4480 | if (! spec) |
| 4481 | return; |
| 4482 | |
Takashi Iwai | 167eae5 | 2009-11-06 15:47:50 +0100 | [diff] [blame] | 4483 | stac92xx_shutup(codec); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4484 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4485 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4486 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4487 | } |
| 4488 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4489 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4490 | unsigned int flag) |
| 4491 | { |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4492 | unsigned int old_ctl, pin_ctl; |
| 4493 | |
| 4494 | pin_ctl = snd_hda_codec_read(codec, nid, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4495 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4496 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4497 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4498 | /* |
| 4499 | * we need to check the current set-up direction of |
| 4500 | * shared input pins since they can be switched via |
| 4501 | * "xxx as Output" mixer switch |
| 4502 | */ |
| 4503 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4504 | if (nid == spec->line_switch || nid == spec->mic_switch) |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4505 | return; |
| 4506 | } |
| 4507 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4508 | old_ctl = pin_ctl; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4509 | /* if setting pin direction bits, clear the current |
| 4510 | direction bits first */ |
| 4511 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4512 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4513 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4514 | pin_ctl |= flag; |
| 4515 | if (old_ctl != pin_ctl) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 4516 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4517 | } |
| 4518 | |
| 4519 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4520 | unsigned int flag) |
| 4521 | { |
| 4522 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4523 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4524 | if (pin_ctl & flag) |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame^] | 4525 | snd_hda_set_pin_ctl_cache(codec, nid, pin_ctl & ~flag); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4526 | } |
| 4527 | |
Takashi Iwai | d56757a | 2009-11-18 08:00:14 +0100 | [diff] [blame] | 4528 | static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4529 | { |
| 4530 | if (!nid) |
| 4531 | return 0; |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 4532 | return snd_hda_jack_detect(codec, nid); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4533 | } |
| 4534 | |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4535 | static void stac92xx_line_out_detect(struct hda_codec *codec, |
| 4536 | int presence) |
| 4537 | { |
| 4538 | struct sigmatel_spec *spec = codec->spec; |
| 4539 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4540 | int i; |
| 4541 | |
| 4542 | for (i = 0; i < cfg->line_outs; i++) { |
| 4543 | if (presence) |
| 4544 | break; |
| 4545 | presence = get_pin_presence(codec, cfg->line_out_pins[i]); |
| 4546 | if (presence) { |
| 4547 | unsigned int pinctl; |
| 4548 | pinctl = snd_hda_codec_read(codec, |
| 4549 | cfg->line_out_pins[i], 0, |
| 4550 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4551 | if (pinctl & AC_PINCTL_IN_EN) |
| 4552 | presence = 0; /* mic- or line-input */ |
| 4553 | } |
| 4554 | } |
| 4555 | |
| 4556 | if (presence) { |
| 4557 | /* disable speakers */ |
| 4558 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4559 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4560 | AC_PINCTL_OUT_EN); |
| 4561 | if (spec->eapd_mask && spec->eapd_switch) |
| 4562 | stac_gpio_set(codec, spec->gpio_mask, |
| 4563 | spec->gpio_dir, spec->gpio_data & |
| 4564 | ~spec->eapd_mask); |
| 4565 | } else { |
| 4566 | /* enable speakers */ |
| 4567 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4568 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4569 | AC_PINCTL_OUT_EN); |
| 4570 | if (spec->eapd_mask && spec->eapd_switch) |
| 4571 | stac_gpio_set(codec, spec->gpio_mask, |
| 4572 | spec->gpio_dir, spec->gpio_data | |
| 4573 | spec->eapd_mask); |
| 4574 | } |
| 4575 | } |
| 4576 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4577 | /* return non-zero if the hp-pin of the given array index isn't |
| 4578 | * a jack-detection target |
| 4579 | */ |
| 4580 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4581 | { |
| 4582 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4583 | |
| 4584 | /* ignore sensing of shared line and mic jacks */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4585 | if (cfg->hp_pins[i] == spec->line_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4586 | return 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4587 | if (cfg->hp_pins[i] == spec->mic_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4588 | return 1; |
| 4589 | /* ignore if the pin is set as line-out */ |
| 4590 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4591 | return 1; |
| 4592 | return 0; |
| 4593 | } |
| 4594 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4595 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4596 | { |
| 4597 | struct sigmatel_spec *spec = codec->spec; |
| 4598 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4599 | int i, presence; |
| 4600 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4601 | presence = 0; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4602 | if (spec->gpio_mute) |
| 4603 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4604 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4605 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4606 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4607 | if (presence) |
| 4608 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4609 | if (no_hp_sensing(spec, i)) |
| 4610 | continue; |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4611 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 4612 | if (presence) { |
| 4613 | unsigned int pinctl; |
| 4614 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 4615 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4616 | if (pinctl & AC_PINCTL_IN_EN) |
| 4617 | presence = 0; /* mic- or line-input */ |
| 4618 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4619 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4620 | |
| 4621 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4622 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4623 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4624 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4625 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4626 | for (i = 0; i < cfg->line_outs; i++) |
| 4627 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4628 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4629 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4630 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4631 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4632 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4633 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4634 | for (i = 0; i < cfg->line_outs; i++) |
| 4635 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4636 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4637 | } |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4638 | stac92xx_line_out_detect(codec, presence); |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4639 | /* toggle hp outs */ |
| 4640 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4641 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4642 | if (no_hp_sensing(spec, i)) |
| 4643 | continue; |
Takashi Iwai | 7bff172 | 2012-02-29 09:41:17 +0100 | [diff] [blame] | 4644 | if (1 /*presence*/) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4645 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4646 | #if 0 /* FIXME */ |
| 4647 | /* Resetting the pinctl like below may lead to (a sort of) regressions |
| 4648 | * on some devices since they use the HP pin actually for line/speaker |
| 4649 | * outs although the default pin config shows a different pin (that is |
| 4650 | * wrong and useless). |
| 4651 | * |
| 4652 | * So, it's basically a problem of default pin configs, likely a BIOS issue. |
| 4653 | * But, disabling the code below just works around it, and I'm too tired of |
| 4654 | * bug reports with such devices... |
| 4655 | */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4656 | else |
| 4657 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4658 | #endif /* FIXME */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4659 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4660 | } |
| 4661 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4662 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4663 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4664 | { |
| 4665 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4666 | unsigned int idx, val; |
| 4667 | |
| 4668 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4669 | if (spec->pwr_nids[idx] == nid) |
| 4670 | break; |
| 4671 | } |
| 4672 | if (idx >= spec->num_pwrs) |
| 4673 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4674 | |
Charles Chin | afef2cf | 2011-11-11 08:05:28 +0100 | [diff] [blame] | 4675 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4676 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4677 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
| 4678 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4679 | val &= ~idx; |
| 4680 | else |
| 4681 | val |= idx; |
| 4682 | |
| 4683 | /* power down unused output ports */ |
| 4684 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4685 | } |
| 4686 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4687 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4688 | { |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4689 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4690 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4691 | |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 4692 | /* get the pin connection (fixed, none, etc) */ |
| 4693 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
| 4694 | { |
| 4695 | struct sigmatel_spec *spec = codec->spec; |
| 4696 | unsigned int cfg; |
| 4697 | |
| 4698 | cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); |
| 4699 | return get_defcfg_connect(cfg); |
| 4700 | } |
| 4701 | |
| 4702 | static int stac92xx_connected_ports(struct hda_codec *codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 4703 | const hda_nid_t *nids, int num_nids) |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 4704 | { |
| 4705 | struct sigmatel_spec *spec = codec->spec; |
| 4706 | int idx, num; |
| 4707 | unsigned int def_conf; |
| 4708 | |
| 4709 | for (num = 0; num < num_nids; num++) { |
| 4710 | for (idx = 0; idx < spec->num_pins; idx++) |
| 4711 | if (spec->pin_nids[idx] == nids[num]) |
| 4712 | break; |
| 4713 | if (idx >= spec->num_pins) |
| 4714 | break; |
| 4715 | def_conf = stac_get_defcfg_connect(codec, idx); |
| 4716 | if (def_conf == AC_JACK_PORT_NONE) |
| 4717 | break; |
| 4718 | } |
| 4719 | return num; |
| 4720 | } |
| 4721 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4722 | static void stac92xx_mic_detect(struct hda_codec *codec) |
| 4723 | { |
| 4724 | struct sigmatel_spec *spec = codec->spec; |
| 4725 | struct sigmatel_mic_route *mic; |
| 4726 | |
| 4727 | if (get_pin_presence(codec, spec->ext_mic.pin)) |
| 4728 | mic = &spec->ext_mic; |
Charles Chin | 9907790 | 2010-09-17 10:22:32 +0200 | [diff] [blame] | 4729 | else if (get_pin_presence(codec, spec->dock_mic.pin)) |
| 4730 | mic = &spec->dock_mic; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4731 | else |
| 4732 | mic = &spec->int_mic; |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 4733 | if (mic->dmux_idx >= 0) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4734 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
| 4735 | AC_VERB_SET_CONNECT_SEL, |
| 4736 | mic->dmux_idx); |
Takashi Iwai | 02d3332 | 2009-10-01 16:38:11 +0200 | [diff] [blame] | 4737 | if (mic->mux_idx >= 0) |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4738 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, |
| 4739 | AC_VERB_SET_CONNECT_SEL, |
| 4740 | mic->mux_idx); |
| 4741 | } |
| 4742 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4743 | static void handle_unsol_event(struct hda_codec *codec, |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4744 | struct hda_jack_tbl *event) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4745 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4746 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4747 | int data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4748 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4749 | switch (event->action) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4750 | case STAC_HP_EVENT: |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4751 | case STAC_LO_EVENT: |
Takashi Iwai | 16ffe32 | 2009-08-04 13:40:54 +0200 | [diff] [blame] | 4752 | stac92xx_hp_detect(codec); |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4753 | break; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4754 | case STAC_MIC_EVENT: |
| 4755 | stac92xx_mic_detect(codec); |
| 4756 | break; |
| 4757 | } |
| 4758 | |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4759 | switch (event->action) { |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4760 | case STAC_HP_EVENT: |
Takashi Iwai | fefd67f | 2009-07-30 18:03:05 +0200 | [diff] [blame] | 4761 | case STAC_LO_EVENT: |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame] | 4762 | case STAC_MIC_EVENT: |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4763 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4764 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4765 | if (spec->num_pwrs > 0) |
| 4766 | stac92xx_pin_sense(codec, event->nid); |
Matthew Ranostay | fd60cc8 | 2009-04-06 09:30:46 -0400 | [diff] [blame] | 4767 | |
| 4768 | switch (codec->subsystem_id) { |
| 4769 | case 0x103c308f: |
| 4770 | if (event->nid == 0xb) { |
| 4771 | int pin = AC_PINCTL_IN_EN; |
| 4772 | |
| 4773 | if (get_pin_presence(codec, 0xa) |
| 4774 | && get_pin_presence(codec, 0xb)) |
| 4775 | pin |= AC_PINCTL_VREF_80; |
| 4776 | if (!get_pin_presence(codec, 0xb)) |
| 4777 | pin |= AC_PINCTL_VREF_80; |
| 4778 | |
| 4779 | /* toggle VREF state based on mic + hp pin |
| 4780 | * status |
| 4781 | */ |
| 4782 | stac92xx_auto_set_pinctl(codec, 0x0a, pin); |
| 4783 | } |
| 4784 | } |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4785 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4786 | case STAC_VREF_EVENT: |
| 4787 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4788 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4789 | /* toggle VREF state based on GPIOx status */ |
| 4790 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4791 | !!(data & (1 << event->private_data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4792 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4793 | } |
| 4794 | } |
| 4795 | |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4796 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) |
| 4797 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4798 | struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4799 | if (!event) |
| 4800 | return; |
| 4801 | handle_unsol_event(codec, event); |
| 4802 | } |
| 4803 | |
| 4804 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4805 | { |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4806 | struct hda_jack_tbl *event; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4807 | int tag; |
| 4808 | |
| 4809 | tag = (res >> 26) & 0x7f; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4810 | event = snd_hda_jack_tbl_get_from_tag(codec, tag); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4811 | if (!event) |
| 4812 | return; |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 4813 | event->jack_dirty = 1; |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4814 | handle_unsol_event(codec, event); |
Takashi Iwai | 01a61e1 | 2011-10-28 00:03:22 +0200 | [diff] [blame] | 4815 | snd_hda_jack_report_sync(codec); |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 4816 | } |
| 4817 | |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4818 | static int hp_blike_system(u32 subsystem_id); |
| 4819 | |
| 4820 | static void set_hp_led_gpio(struct hda_codec *codec) |
| 4821 | { |
| 4822 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 07f8044 | 2010-02-08 15:06:13 +0100 | [diff] [blame] | 4823 | unsigned int gpio; |
| 4824 | |
Takashi Iwai | 26ebe0a | 2010-05-11 08:36:29 +0200 | [diff] [blame] | 4825 | if (spec->gpio_led) |
| 4826 | return; |
| 4827 | |
Takashi Iwai | 07f8044 | 2010-02-08 15:06:13 +0100 | [diff] [blame] | 4828 | gpio = snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP); |
| 4829 | gpio &= AC_GPIO_IO_COUNT; |
| 4830 | if (gpio > 3) |
| 4831 | spec->gpio_led = 0x08; /* GPIO 3 */ |
| 4832 | else |
| 4833 | spec->gpio_led = 0x01; /* GPIO 0 */ |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4834 | } |
| 4835 | |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4836 | /* |
| 4837 | * This method searches for the mute LED GPIO configuration |
| 4838 | * provided as OEM string in SMBIOS. The format of that string |
| 4839 | * is HP_Mute_LED_P_G or HP_Mute_LED_P |
| 4840 | * where P can be 0 or 1 and defines mute LED GPIO control state (low/high) |
| 4841 | * that corresponds to the NOT muted state of the master volume |
| 4842 | * and G is the index of the GPIO to use as the mute LED control (0..9) |
| 4843 | * If _G portion is missing it is assigned based on the codec ID |
| 4844 | * |
| 4845 | * So, HP B-series like systems may have HP_Mute_LED_0 (current models) |
| 4846 | * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4847 | * |
| 4848 | * |
| 4849 | * The dv-series laptops don't seem to have the HP_Mute_LED* strings in |
| 4850 | * SMBIOS - at least the ones I have seen do not have them - which include |
| 4851 | * my own system (HP Pavilion dv6-1110ax) and my cousin's |
| 4852 | * HP Pavilion dv9500t CTO. |
| 4853 | * Need more information on whether it is true across the entire series. |
| 4854 | * -- kunal |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4855 | */ |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4856 | static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity) |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4857 | { |
| 4858 | struct sigmatel_spec *spec = codec->spec; |
| 4859 | const struct dmi_device *dev = NULL; |
| 4860 | |
| 4861 | if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { |
| 4862 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, |
| 4863 | NULL, dev))) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4864 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4865 | &spec->gpio_led_polarity, |
| 4866 | &spec->gpio_led) == 2) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 4867 | unsigned int max_gpio; |
| 4868 | max_gpio = snd_hda_param_read(codec, codec->afg, |
| 4869 | AC_PAR_GPIO_CAP); |
| 4870 | max_gpio &= AC_GPIO_IO_COUNT; |
| 4871 | if (spec->gpio_led < max_gpio) |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4872 | spec->gpio_led = 1 << spec->gpio_led; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 4873 | else |
| 4874 | spec->vref_mute_led_nid = spec->gpio_led; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4875 | return 1; |
| 4876 | } |
| 4877 | if (sscanf(dev->name, "HP_Mute_LED_%d", |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4878 | &spec->gpio_led_polarity) == 1) { |
| 4879 | set_hp_led_gpio(codec); |
| 4880 | return 1; |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4881 | } |
Gustavo Maciel Dias Vieira | e2ef36c | 2011-12-13 11:47:22 -0200 | [diff] [blame] | 4882 | /* BIOS bug: unfilled OEM string */ |
| 4883 | if (strstr(dev->name, "HP_Mute_LED_P_G")) { |
| 4884 | set_hp_led_gpio(codec); |
Gustavo Maciel Dias Vieira | a6a600d | 2012-01-24 13:27:56 -0200 | [diff] [blame] | 4885 | switch (codec->subsystem_id) { |
| 4886 | case 0x103c148a: |
| 4887 | spec->gpio_led_polarity = 0; |
| 4888 | break; |
| 4889 | default: |
| 4890 | spec->gpio_led_polarity = 1; |
| 4891 | break; |
| 4892 | } |
Gustavo Maciel Dias Vieira | e2ef36c | 2011-12-13 11:47:22 -0200 | [diff] [blame] | 4893 | return 1; |
| 4894 | } |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4895 | } |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4896 | |
| 4897 | /* |
| 4898 | * Fallback case - if we don't find the DMI strings, |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4899 | * we statically set the GPIO - if not a B-series system |
| 4900 | * and default polarity is provided |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4901 | */ |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 4902 | if (!hp_blike_system(codec->subsystem_id) && |
| 4903 | (default_polarity == 0 || default_polarity == 1)) { |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4904 | set_hp_led_gpio(codec); |
Takashi Iwai | dce17d4 | 2010-02-09 09:25:26 +0100 | [diff] [blame] | 4905 | spec->gpio_led_polarity = default_polarity; |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 4906 | return 1; |
| 4907 | } |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4908 | } |
| 4909 | return 0; |
| 4910 | } |
| 4911 | |
| 4912 | static int hp_blike_system(u32 subsystem_id) |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4913 | { |
| 4914 | switch (subsystem_id) { |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4915 | case 0x103c1520: |
| 4916 | case 0x103c1521: |
| 4917 | case 0x103c1523: |
| 4918 | case 0x103c1524: |
| 4919 | case 0x103c1525: |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4920 | case 0x103c1722: |
| 4921 | case 0x103c1723: |
| 4922 | case 0x103c1724: |
| 4923 | case 0x103c1725: |
| 4924 | case 0x103c1726: |
| 4925 | case 0x103c1727: |
| 4926 | case 0x103c1728: |
| 4927 | case 0x103c1729: |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 4928 | case 0x103c172a: |
| 4929 | case 0x103c172b: |
| 4930 | case 0x103c307e: |
| 4931 | case 0x103c307f: |
| 4932 | case 0x103c3080: |
| 4933 | case 0x103c3081: |
| 4934 | case 0x103c7007: |
| 4935 | case 0x103c7008: |
Randy Dunlap | 78987bd | 2009-11-05 09:22:30 -0800 | [diff] [blame] | 4936 | return 1; |
| 4937 | } |
| 4938 | return 0; |
| 4939 | } |
| 4940 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4941 | #ifdef CONFIG_PROC_FS |
| 4942 | static void stac92hd_proc_hook(struct snd_info_buffer *buffer, |
| 4943 | struct hda_codec *codec, hda_nid_t nid) |
| 4944 | { |
| 4945 | if (nid == codec->afg) |
| 4946 | snd_iprintf(buffer, "Power-Map: 0x%02x\n", |
| 4947 | snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); |
| 4948 | } |
| 4949 | |
| 4950 | static void analog_loop_proc_hook(struct snd_info_buffer *buffer, |
| 4951 | struct hda_codec *codec, |
| 4952 | unsigned int verb) |
| 4953 | { |
| 4954 | snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", |
| 4955 | snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); |
| 4956 | } |
| 4957 | |
| 4958 | /* stac92hd71bxx, stac92hd73xx */ |
| 4959 | static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, |
| 4960 | struct hda_codec *codec, hda_nid_t nid) |
| 4961 | { |
| 4962 | stac92hd_proc_hook(buffer, codec, nid); |
| 4963 | if (nid == codec->afg) |
| 4964 | analog_loop_proc_hook(buffer, codec, 0xfa0); |
| 4965 | } |
| 4966 | |
| 4967 | static void stac9205_proc_hook(struct snd_info_buffer *buffer, |
| 4968 | struct hda_codec *codec, hda_nid_t nid) |
| 4969 | { |
| 4970 | if (nid == codec->afg) |
| 4971 | analog_loop_proc_hook(buffer, codec, 0xfe0); |
| 4972 | } |
| 4973 | |
| 4974 | static void stac927x_proc_hook(struct snd_info_buffer *buffer, |
| 4975 | struct hda_codec *codec, hda_nid_t nid) |
| 4976 | { |
| 4977 | if (nid == codec->afg) |
| 4978 | analog_loop_proc_hook(buffer, codec, 0xfeb); |
| 4979 | } |
| 4980 | #else |
| 4981 | #define stac92hd_proc_hook NULL |
| 4982 | #define stac92hd7x_proc_hook NULL |
| 4983 | #define stac9205_proc_hook NULL |
| 4984 | #define stac927x_proc_hook NULL |
| 4985 | #endif |
| 4986 | |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 4987 | #ifdef CONFIG_PM |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4988 | static int stac92xx_resume(struct hda_codec *codec) |
| 4989 | { |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4990 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4991 | snd_hda_codec_resume_amp(codec); |
| 4992 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4993 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | f2cbba7 | 2012-01-11 12:34:11 +0100 | [diff] [blame] | 4994 | stac_fake_hp_events(codec); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4995 | return 0; |
| 4996 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4997 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 4998 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4999 | { |
| 5000 | stac92xx_shutup(codec); |
| 5001 | return 0; |
| 5002 | } |
| 5003 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5004 | static int stac92xx_pre_resume(struct hda_codec *codec) |
| 5005 | { |
| 5006 | struct sigmatel_spec *spec = codec->spec; |
| 5007 | |
| 5008 | /* sync mute LED */ |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5009 | if (spec->vref_mute_led_nid) |
| 5010 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
| 5011 | spec->vref_led); |
| 5012 | else if (spec->gpio_led) |
| 5013 | stac_gpio_set(codec, spec->gpio_mask, |
| 5014 | spec->gpio_dir, spec->gpio_data); |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5015 | return 0; |
| 5016 | } |
| 5017 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5018 | static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
| 5019 | unsigned int power_state) |
| 5020 | { |
| 5021 | unsigned int afg_power_state = power_state; |
| 5022 | struct sigmatel_spec *spec = codec->spec; |
| 5023 | |
| 5024 | if (power_state == AC_PWRST_D3) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5025 | if (spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5026 | /* with vref-out pin used for mute led control |
| 5027 | * codec AFG is prevented from D3 state |
| 5028 | */ |
| 5029 | afg_power_state = AC_PWRST_D1; |
| 5030 | } |
| 5031 | /* this delay seems necessary to avoid click noise at power-down */ |
| 5032 | msleep(100); |
| 5033 | } |
| 5034 | snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, |
| 5035 | afg_power_state); |
| 5036 | snd_hda_codec_set_power_to_all(codec, fg, power_state, true); |
| 5037 | } |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5038 | #else |
| 5039 | #define stac92xx_suspend NULL |
| 5040 | #define stac92xx_resume NULL |
| 5041 | #define stac92xx_pre_resume NULL |
| 5042 | #define stac92xx_set_power_state NULL |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5043 | #endif /* CONFIG_PM */ |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5044 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5045 | /* update mute-LED accoring to the master switch */ |
| 5046 | static void stac92xx_update_led_status(struct hda_codec *codec, int enabled) |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5047 | { |
| 5048 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5049 | int muted = !enabled; |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 5050 | |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5051 | if (!spec->gpio_led) |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5052 | return; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5053 | |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5054 | /* LED state is inverted on these systems */ |
| 5055 | if (spec->gpio_led_polarity) |
| 5056 | muted = !muted; |
| 5057 | |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5058 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5059 | if (muted) |
Takashi Iwai | 3e84319 | 2012-04-19 12:04:03 +0200 | [diff] [blame] | 5060 | spec->gpio_data |= spec->gpio_led; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5061 | else |
Takashi Iwai | 3e84319 | 2012-04-19 12:04:03 +0200 | [diff] [blame] | 5062 | spec->gpio_data &= ~spec->gpio_led; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5063 | stac_gpio_set(codec, spec->gpio_mask, |
| 5064 | spec->gpio_dir, spec->gpio_data); |
| 5065 | } else { |
Takashi Iwai | 2faa3bf | 2012-03-12 12:30:22 +0100 | [diff] [blame] | 5066 | spec->vref_led = muted ? AC_PINCTL_VREF_50 : AC_PINCTL_VREF_GRD; |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5067 | stac_vrefout_set(codec, spec->vref_mute_led_nid, |
| 5068 | spec->vref_led); |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5069 | } |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5070 | } |
Vitaliy Kulikov | 7df1ce1 | 2011-07-25 17:52:57 -0500 | [diff] [blame] | 5071 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5072 | static const struct hda_codec_ops stac92xx_patch_ops = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5073 | .build_controls = stac92xx_build_controls, |
| 5074 | .build_pcms = stac92xx_build_pcms, |
| 5075 | .init = stac92xx_init, |
| 5076 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 5077 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 5078 | #ifdef CONFIG_PM |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 5079 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 5080 | .resume = stac92xx_resume, |
| 5081 | #endif |
Takashi Iwai | fb8d1a3 | 2009-11-10 16:02:29 +0100 | [diff] [blame] | 5082 | .reboot_notify = stac92xx_shutup, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5083 | }; |
| 5084 | |
| 5085 | static int patch_stac9200(struct hda_codec *codec) |
| 5086 | { |
| 5087 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5088 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5089 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5090 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5091 | if (spec == NULL) |
| 5092 | return -ENOMEM; |
| 5093 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5094 | codec->no_trigger_sense = 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5095 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5096 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5097 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5098 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5099 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 5100 | stac9200_models, |
| 5101 | stac9200_cfg_tbl); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5102 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5103 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5104 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5105 | else |
| 5106 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5107 | stac9200_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5108 | |
| 5109 | spec->multiout.max_channels = 2; |
| 5110 | spec->multiout.num_dacs = 1; |
| 5111 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 5112 | spec->adc_nids = stac9200_adc_nids; |
| 5113 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 5114 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5115 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5116 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5117 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5118 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 5119 | if (spec->board_config == STAC_9200_M4 || |
| 5120 | spec->board_config == STAC_9200_M4_2 || |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 5121 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 5122 | spec->init = stac9200_eapd_init; |
| 5123 | else |
| 5124 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5125 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5126 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 5127 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 5128 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 5129 | spec->gpio_data = 0x00; |
| 5130 | } |
| 5131 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5132 | err = stac9200_parse_auto_config(codec); |
| 5133 | if (err < 0) { |
| 5134 | stac92xx_free(codec); |
| 5135 | return err; |
| 5136 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5137 | |
Takashi Iwai | 2acc9dc | 2009-01-09 16:57:14 +0100 | [diff] [blame] | 5138 | /* CF-74 has no headphone detection, and the driver should *NOT* |
| 5139 | * do detection and HP/speaker toggle because the hardware does it. |
| 5140 | */ |
| 5141 | if (spec->board_config == STAC_9200_PANASONIC) |
| 5142 | spec->hp_detect = 0; |
| 5143 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5144 | codec->patch_ops = stac92xx_patch_ops; |
| 5145 | |
| 5146 | return 0; |
| 5147 | } |
| 5148 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5149 | static int patch_stac925x(struct hda_codec *codec) |
| 5150 | { |
| 5151 | struct sigmatel_spec *spec; |
| 5152 | int err; |
| 5153 | |
| 5154 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5155 | if (spec == NULL) |
| 5156 | return -ENOMEM; |
| 5157 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5158 | codec->no_trigger_sense = 1; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5159 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5160 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5161 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5162 | spec->pin_nids = stac925x_pin_nids; |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 5163 | |
| 5164 | /* Check first for codec ID */ |
| 5165 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, |
| 5166 | STAC_925x_MODELS, |
| 5167 | stac925x_models, |
| 5168 | stac925x_codec_id_cfg_tbl); |
| 5169 | |
| 5170 | /* Now checks for PCI ID, if codec ID is not found */ |
| 5171 | if (spec->board_config < 0) |
| 5172 | spec->board_config = snd_hda_check_board_config(codec, |
| 5173 | STAC_925x_MODELS, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5174 | stac925x_models, |
| 5175 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5176 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5177 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5178 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5179 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5180 | else |
| 5181 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5182 | stac925x_brd_tbl[spec->board_config]); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5183 | |
| 5184 | spec->multiout.max_channels = 2; |
| 5185 | spec->multiout.num_dacs = 1; |
| 5186 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 5187 | spec->adc_nids = stac925x_adc_nids; |
| 5188 | spec->mux_nids = stac925x_mux_nids; |
| 5189 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5190 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5191 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5192 | switch (codec->vendor_id) { |
| 5193 | case 0x83847632: /* STAC9202 */ |
| 5194 | case 0x83847633: /* STAC9202D */ |
| 5195 | case 0x83847636: /* STAC9251 */ |
| 5196 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5197 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5198 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5199 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 5200 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5201 | break; |
| 5202 | default: |
| 5203 | spec->num_dmics = 0; |
| 5204 | break; |
| 5205 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5206 | |
| 5207 | spec->init = stac925x_core_init; |
| 5208 | spec->mixer = stac925x_mixer; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5209 | spec->num_caps = 1; |
| 5210 | spec->capvols = stac925x_capvols; |
| 5211 | spec->capsws = stac925x_capsws; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5212 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5213 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5214 | if (!err) { |
| 5215 | if (spec->board_config < 0) { |
| 5216 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5217 | "available, default to model=ref\n"); |
| 5218 | spec->board_config = STAC_925x_REF; |
| 5219 | goto again; |
| 5220 | } |
| 5221 | err = -EINVAL; |
| 5222 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5223 | if (err < 0) { |
| 5224 | stac92xx_free(codec); |
| 5225 | return err; |
| 5226 | } |
| 5227 | |
| 5228 | codec->patch_ops = stac92xx_patch_ops; |
| 5229 | |
| 5230 | return 0; |
| 5231 | } |
| 5232 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5233 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 5234 | { |
| 5235 | struct sigmatel_spec *spec; |
| 5236 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 5237 | int err = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5238 | int num_dacs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5239 | |
| 5240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5241 | if (spec == NULL) |
| 5242 | return -ENOMEM; |
| 5243 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5244 | codec->no_trigger_sense = 1; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5245 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5246 | spec->linear_tone_beep = 0; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 5247 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5248 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 5249 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 5250 | spec->board_config = snd_hda_check_board_config(codec, |
| 5251 | STAC_92HD73XX_MODELS, |
| 5252 | stac92hd73xx_models, |
| 5253 | stac92hd73xx_cfg_tbl); |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 5254 | /* check codec subsystem id if not found */ |
| 5255 | if (spec->board_config < 0) |
| 5256 | spec->board_config = |
| 5257 | snd_hda_check_board_codec_sid_config(codec, |
| 5258 | STAC_92HD73XX_MODELS, stac92hd73xx_models, |
| 5259 | stac92hd73xx_codec_id_cfg_tbl); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5260 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5261 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5262 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5263 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5264 | else |
| 5265 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5266 | stac92hd73xx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5267 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5268 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5269 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 5270 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5271 | if (num_dacs < 3 || num_dacs > 5) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5272 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 5273 | "number of channels defaulting to DAC count\n"); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5274 | num_dacs = STAC92HD73_DAC_COUNT; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5275 | } |
Takashi Iwai | e2aec17 | 2009-09-02 01:00:05 +0200 | [diff] [blame] | 5276 | spec->init = stac92hd73xx_core_init; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5277 | switch (num_dacs) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5278 | case 0x3: /* 6 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5279 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5280 | break; |
| 5281 | case 0x4: /* 8 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5282 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5283 | break; |
| 5284 | case 0x5: /* 10 Channel */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5285 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; |
| 5286 | break; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5287 | } |
| 5288 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5289 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5290 | spec->aloopback_mask = 0x01; |
| 5291 | spec->aloopback_shift = 8; |
| 5292 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5293 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5294 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 5295 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 5296 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 5297 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5298 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5299 | |
| 5300 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 5301 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5302 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5303 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5304 | spec->num_caps = STAC92HD73XX_NUM_CAPS; |
| 5305 | spec->capvols = stac92hd73xx_capvols; |
| 5306 | spec->capsws = stac92hd73xx_capsws; |
| 5307 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5308 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5309 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 5310 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5311 | /* fallthru */ |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5312 | case STAC_DELL_M6_AMIC: |
| 5313 | case STAC_DELL_M6_DMIC: |
| 5314 | case STAC_DELL_M6_BOTH: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5315 | spec->num_smuxes = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5316 | spec->eapd_switch = 0; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5317 | |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5318 | switch (spec->board_config) { |
| 5319 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5320 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5321 | spec->num_dmics = 0; |
| 5322 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5323 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5324 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5325 | spec->num_dmics = 1; |
| 5326 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5327 | case STAC_DELL_M6_BOTH: /* Both */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5328 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
| 5329 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5330 | spec->num_dmics = 1; |
| 5331 | break; |
| 5332 | } |
| 5333 | break; |
Takashi Iwai | 842ae63 | 2009-09-02 07:43:08 +0200 | [diff] [blame] | 5334 | case STAC_ALIENWARE_M17X: |
| 5335 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
| 5336 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
| 5337 | spec->eapd_switch = 0; |
| 5338 | break; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5339 | default: |
| 5340 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5341 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5342 | spec->eapd_switch = 1; |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5343 | break; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5344 | } |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 5345 | if (spec->board_config != STAC_92HD73XX_REF) { |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5346 | /* GPIO0 High = Enable EAPD */ |
| 5347 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 5348 | spec->gpio_data = 0x01; |
| 5349 | } |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5350 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5351 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 5352 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 5353 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5354 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5355 | |
| 5356 | if (!err) { |
| 5357 | if (spec->board_config < 0) { |
| 5358 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5359 | "available, default to model=ref\n"); |
| 5360 | spec->board_config = STAC_92HD73XX_REF; |
| 5361 | goto again; |
| 5362 | } |
| 5363 | err = -EINVAL; |
| 5364 | } |
| 5365 | |
| 5366 | if (err < 0) { |
| 5367 | stac92xx_free(codec); |
| 5368 | return err; |
| 5369 | } |
| 5370 | |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 5371 | if (spec->board_config == STAC_92HD73XX_NO_JD) |
| 5372 | spec->hp_detect = 0; |
| 5373 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5374 | codec->patch_ops = stac92xx_patch_ops; |
| 5375 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5376 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5377 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5378 | return 0; |
| 5379 | } |
| 5380 | |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5381 | static int hp_bnb2011_with_dock(struct hda_codec *codec) |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5382 | { |
| 5383 | if (codec->vendor_id != 0x111d7605 && |
| 5384 | codec->vendor_id != 0x111d76d1) |
| 5385 | return 0; |
| 5386 | |
| 5387 | switch (codec->subsystem_id) { |
| 5388 | case 0x103c1618: |
| 5389 | case 0x103c1619: |
| 5390 | case 0x103c161a: |
| 5391 | case 0x103c161b: |
| 5392 | case 0x103c161c: |
| 5393 | case 0x103c161d: |
| 5394 | case 0x103c161e: |
| 5395 | case 0x103c161f: |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5396 | |
| 5397 | case 0x103c162a: |
| 5398 | case 0x103c162b: |
| 5399 | |
| 5400 | case 0x103c1630: |
| 5401 | case 0x103c1631: |
| 5402 | |
| 5403 | case 0x103c1633: |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5404 | case 0x103c1634: |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5405 | case 0x103c1635: |
| 5406 | |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5407 | case 0x103c3587: |
| 5408 | case 0x103c3588: |
| 5409 | case 0x103c3589: |
| 5410 | case 0x103c358a: |
| 5411 | |
| 5412 | case 0x103c3667: |
| 5413 | case 0x103c3668: |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5414 | case 0x103c3669: |
| 5415 | |
| 5416 | return 1; |
Vitaliy Kulikov | 335e3b8 | 2010-10-22 18:38:31 -0500 | [diff] [blame] | 5417 | } |
| 5418 | return 0; |
| 5419 | } |
| 5420 | |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 5421 | static void stac92hd8x_add_pin(struct hda_codec *codec, hda_nid_t nid) |
| 5422 | { |
| 5423 | struct sigmatel_spec *spec = codec->spec; |
| 5424 | unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 5425 | int i; |
| 5426 | |
| 5427 | spec->auto_pin_nids[spec->auto_pin_cnt] = nid; |
| 5428 | spec->auto_pin_cnt++; |
| 5429 | |
| 5430 | if (get_defcfg_device(def_conf) == AC_JACK_MIC_IN && |
| 5431 | get_defcfg_connect(def_conf) != AC_JACK_PORT_NONE) { |
| 5432 | for (i = 0; i < ARRAY_SIZE(stac92hd83xxx_dmic_nids); i++) { |
| 5433 | if (nid == stac92hd83xxx_dmic_nids[i]) { |
| 5434 | spec->auto_dmic_nids[spec->auto_dmic_cnt] = nid; |
| 5435 | spec->auto_dmic_cnt++; |
| 5436 | } |
| 5437 | } |
| 5438 | } |
| 5439 | } |
| 5440 | |
| 5441 | static void stac92hd8x_add_adc(struct hda_codec *codec, hda_nid_t nid) |
| 5442 | { |
| 5443 | struct sigmatel_spec *spec = codec->spec; |
| 5444 | |
| 5445 | spec->auto_adc_nids[spec->auto_adc_cnt] = nid; |
| 5446 | spec->auto_adc_cnt++; |
| 5447 | } |
| 5448 | |
| 5449 | static void stac92hd8x_add_mux(struct hda_codec *codec, hda_nid_t nid) |
| 5450 | { |
| 5451 | int i, j; |
| 5452 | struct sigmatel_spec *spec = codec->spec; |
| 5453 | |
| 5454 | for (i = 0; i < spec->auto_adc_cnt; i++) { |
| 5455 | if (get_connection_index(codec, |
| 5456 | spec->auto_adc_nids[i], nid) >= 0) { |
| 5457 | /* mux and volume for adc_nids[i] */ |
| 5458 | if (!spec->auto_mux_nids[i]) { |
| 5459 | spec->auto_mux_nids[i] = nid; |
| 5460 | /* 92hd codecs capture volume is in mux */ |
| 5461 | spec->auto_capvols[i] = HDA_COMPOSE_AMP_VAL(nid, |
| 5462 | 3, 0, HDA_OUTPUT); |
| 5463 | } |
| 5464 | for (j = 0; j < spec->auto_dmic_cnt; j++) { |
| 5465 | if (get_connection_index(codec, nid, |
| 5466 | spec->auto_dmic_nids[j]) >= 0) { |
| 5467 | /* dmux for adc_nids[i] */ |
| 5468 | if (!spec->auto_dmux_nids[i]) |
| 5469 | spec->auto_dmux_nids[i] = nid; |
| 5470 | break; |
| 5471 | } |
| 5472 | } |
| 5473 | break; |
| 5474 | } |
| 5475 | } |
| 5476 | } |
| 5477 | |
| 5478 | static void stac92hd8x_fill_auto_spec(struct hda_codec *codec) |
| 5479 | { |
| 5480 | hda_nid_t nid, end_nid; |
| 5481 | unsigned int wid_caps, wid_type; |
| 5482 | struct sigmatel_spec *spec = codec->spec; |
| 5483 | |
| 5484 | end_nid = codec->start_nid + codec->num_nodes; |
| 5485 | |
| 5486 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 5487 | wid_caps = get_wcaps(codec, nid); |
| 5488 | wid_type = get_wcaps_type(wid_caps); |
| 5489 | |
| 5490 | if (wid_type == AC_WID_PIN) |
| 5491 | stac92hd8x_add_pin(codec, nid); |
| 5492 | |
| 5493 | if (wid_type == AC_WID_AUD_IN && !(wid_caps & AC_WCAP_DIGITAL)) |
| 5494 | stac92hd8x_add_adc(codec, nid); |
| 5495 | } |
| 5496 | |
| 5497 | for (nid = codec->start_nid; nid < end_nid; nid++) { |
| 5498 | wid_caps = get_wcaps(codec, nid); |
| 5499 | wid_type = get_wcaps_type(wid_caps); |
| 5500 | |
| 5501 | if (wid_type == AC_WID_AUD_SEL) |
| 5502 | stac92hd8x_add_mux(codec, nid); |
| 5503 | } |
| 5504 | |
| 5505 | spec->pin_nids = spec->auto_pin_nids; |
| 5506 | spec->num_pins = spec->auto_pin_cnt; |
| 5507 | spec->adc_nids = spec->auto_adc_nids; |
| 5508 | spec->num_adcs = spec->auto_adc_cnt; |
| 5509 | spec->capvols = spec->auto_capvols; |
| 5510 | spec->capsws = spec->auto_capvols; |
| 5511 | spec->num_caps = spec->auto_adc_cnt; |
| 5512 | spec->mux_nids = spec->auto_mux_nids; |
| 5513 | spec->num_muxes = spec->auto_adc_cnt; |
| 5514 | spec->dmux_nids = spec->auto_dmux_nids; |
| 5515 | spec->num_dmuxes = spec->auto_adc_cnt; |
| 5516 | spec->dmic_nids = spec->auto_dmic_nids; |
| 5517 | spec->num_dmics = spec->auto_dmic_cnt; |
| 5518 | } |
| 5519 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5520 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 5521 | { |
| 5522 | struct sigmatel_spec *spec; |
| 5523 | int err; |
| 5524 | |
| 5525 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5526 | if (spec == NULL) |
| 5527 | return -ENOMEM; |
| 5528 | |
Vitaliy Kulikov | cbbf50b | 2011-01-14 17:21:13 -0600 | [diff] [blame] | 5529 | if (hp_bnb2011_with_dock(codec)) { |
| 5530 | snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); |
| 5531 | snd_hda_codec_set_pincfg(codec, 0xf, 0x2181205e); |
| 5532 | } |
| 5533 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5534 | codec->no_trigger_sense = 1; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5535 | codec->spec = spec; |
Vitaliy Kulikov | 699d899 | 2011-03-10 13:43:35 -0600 | [diff] [blame] | 5536 | |
| 5537 | stac92hd8x_fill_auto_spec(codec); |
| 5538 | |
Takashi Iwai | 1db7ccdb | 2010-12-03 15:19:14 +0100 | [diff] [blame] | 5539 | spec->linear_tone_beep = 0; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5540 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5541 | spec->digbeep_nid = 0x21; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5542 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5543 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5544 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5545 | spec->init = stac92hd83xxx_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5546 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5547 | spec->board_config = snd_hda_check_board_config(codec, |
| 5548 | STAC_92HD83XXX_MODELS, |
| 5549 | stac92hd83xxx_models, |
| 5550 | stac92hd83xxx_cfg_tbl); |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 5551 | /* check codec subsystem id if not found */ |
| 5552 | if (spec->board_config < 0) |
| 5553 | spec->board_config = |
| 5554 | snd_hda_check_board_codec_sid_config(codec, |
| 5555 | STAC_92HD83XXX_MODELS, stac92hd83xxx_models, |
| 5556 | stac92hd83xxx_codec_id_cfg_tbl); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5557 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5558 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5559 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5560 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5561 | else |
| 5562 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5563 | stac92hd83xxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5564 | |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5565 | codec->patch_ops = stac92xx_patch_ops; |
| 5566 | |
Vitaliy Kulikov | 5556e14 | 2012-02-27 16:47:37 -0600 | [diff] [blame] | 5567 | switch (spec->board_config) { |
| 5568 | case STAC_HP_ZEPHYR: |
| 5569 | spec->init = stac92hd83xxx_hp_zephyr_init; |
| 5570 | break; |
| 5571 | } |
| 5572 | |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 5573 | if (find_mute_led_cfg(codec, -1/*no default cfg*/)) |
Vitaliy Kulikov | e108c7b | 2010-01-28 19:21:07 +0100 | [diff] [blame] | 5574 | snd_printd("mute LED gpio %d polarity %d\n", |
| 5575 | spec->gpio_led, |
| 5576 | spec->gpio_led_polarity); |
| 5577 | |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5578 | if (spec->gpio_led) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5579 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5580 | spec->gpio_mask |= spec->gpio_led; |
| 5581 | spec->gpio_dir |= spec->gpio_led; |
| 5582 | spec->gpio_data |= spec->gpio_led; |
| 5583 | } else { |
| 5584 | codec->patch_ops.set_power_state = |
| 5585 | stac92xx_set_power_state; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5586 | } |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5587 | #ifdef CONFIG_PM |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5588 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5589 | #endif |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5590 | } |
Takashi Iwai | b4e8187 | 2009-11-18 17:20:24 +0100 | [diff] [blame] | 5591 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5592 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5593 | if (!err) { |
| 5594 | if (spec->board_config < 0) { |
| 5595 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5596 | "available, default to model=ref\n"); |
| 5597 | spec->board_config = STAC_92HD83XXX_REF; |
| 5598 | goto again; |
| 5599 | } |
| 5600 | err = -EINVAL; |
| 5601 | } |
| 5602 | |
| 5603 | if (err < 0) { |
| 5604 | stac92xx_free(codec); |
| 5605 | return err; |
| 5606 | } |
| 5607 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5608 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 5609 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5610 | return 0; |
| 5611 | } |
| 5612 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5613 | static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, |
| 5614 | hda_nid_t dig0pin) |
| 5615 | { |
| 5616 | struct sigmatel_spec *spec = codec->spec; |
| 5617 | int idx; |
| 5618 | |
| 5619 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5620 | if (spec->pin_nids[idx] == dig0pin) |
| 5621 | break; |
| 5622 | if ((idx + 2) >= spec->num_pins) |
| 5623 | return 0; |
| 5624 | |
| 5625 | /* dig1pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5626 | if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5627 | return 2; |
| 5628 | |
| 5629 | /* dig0pin + dig2pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5630 | if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5631 | return 2; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5632 | if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5633 | return 1; |
| 5634 | else |
| 5635 | return 0; |
| 5636 | } |
| 5637 | |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5638 | /* HP dv7 bass switch - GPIO5 */ |
| 5639 | #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info |
| 5640 | static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol, |
| 5641 | struct snd_ctl_elem_value *ucontrol) |
| 5642 | { |
| 5643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5644 | struct sigmatel_spec *spec = codec->spec; |
| 5645 | ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20); |
| 5646 | return 0; |
| 5647 | } |
| 5648 | |
| 5649 | static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol, |
| 5650 | struct snd_ctl_elem_value *ucontrol) |
| 5651 | { |
| 5652 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5653 | struct sigmatel_spec *spec = codec->spec; |
| 5654 | unsigned int gpio_data; |
| 5655 | |
| 5656 | gpio_data = (spec->gpio_data & ~0x20) | |
| 5657 | (ucontrol->value.integer.value[0] ? 0x20 : 0); |
| 5658 | if (gpio_data == spec->gpio_data) |
| 5659 | return 0; |
| 5660 | spec->gpio_data = gpio_data; |
| 5661 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); |
| 5662 | return 1; |
| 5663 | } |
| 5664 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5665 | static const struct snd_kcontrol_new stac_hp_bass_sw_ctrl = { |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5666 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5667 | .info = stac_hp_bass_gpio_info, |
| 5668 | .get = stac_hp_bass_gpio_get, |
| 5669 | .put = stac_hp_bass_gpio_put, |
| 5670 | }; |
| 5671 | |
| 5672 | static int stac_add_hp_bass_switch(struct hda_codec *codec) |
| 5673 | { |
| 5674 | struct sigmatel_spec *spec = codec->spec; |
| 5675 | |
| 5676 | if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl, |
| 5677 | "Bass Speaker Playback Switch", 0)) |
| 5678 | return -ENOMEM; |
| 5679 | |
| 5680 | spec->gpio_mask |= 0x20; |
| 5681 | spec->gpio_dir |= 0x20; |
| 5682 | spec->gpio_data |= 0x20; |
| 5683 | return 0; |
| 5684 | } |
| 5685 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5686 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 5687 | { |
| 5688 | struct sigmatel_spec *spec; |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5689 | const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5690 | unsigned int pin_cfg; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5691 | int err = 0; |
| 5692 | |
| 5693 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5694 | if (spec == NULL) |
| 5695 | return -ENOMEM; |
| 5696 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5697 | codec->no_trigger_sense = 1; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5698 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5699 | spec->linear_tone_beep = 0; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5700 | codec->patch_ops = stac92xx_patch_ops; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 5701 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
| 5702 | switch (codec->vendor_id) { |
| 5703 | case 0x111d76b6: |
| 5704 | case 0x111d76b7: |
| 5705 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; |
| 5706 | break; |
| 5707 | case 0x111d7603: |
| 5708 | case 0x111d7608: |
| 5709 | /* On 92HD75Bx 0x27 isn't a pin nid */ |
| 5710 | spec->num_pins--; |
| 5711 | /* fallthrough */ |
| 5712 | default: |
| 5713 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; |
| 5714 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5715 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5716 | spec->board_config = snd_hda_check_board_config(codec, |
| 5717 | STAC_92HD71BXX_MODELS, |
| 5718 | stac92hd71bxx_models, |
| 5719 | stac92hd71bxx_cfg_tbl); |
| 5720 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5721 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5722 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5723 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5724 | else |
| 5725 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5726 | stac92hd71bxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5727 | |
Takashi Iwai | fc64b26 | 2009-09-14 15:33:01 +0200 | [diff] [blame] | 5728 | if (spec->board_config != STAC_92HD71BXX_REF) { |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 5729 | /* GPIO0 = EAPD */ |
| 5730 | spec->gpio_mask = 0x01; |
| 5731 | spec->gpio_dir = 0x01; |
| 5732 | spec->gpio_data = 0x01; |
| 5733 | } |
| 5734 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5735 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
| 5736 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
| 5737 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5738 | spec->num_caps = STAC92HD71BXX_NUM_CAPS; |
| 5739 | spec->capvols = stac92hd71bxx_capvols; |
| 5740 | spec->capsws = stac92hd71bxx_capsws; |
| 5741 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5742 | switch (codec->vendor_id) { |
| 5743 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 5744 | case 0x111d76b7: |
Herton Ronaldo Krzesinski | 23c7b52 | 2009-02-08 19:51:28 -0200 | [diff] [blame] | 5745 | unmute_init++; |
| 5746 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5747 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 5748 | case 0x111d76b5: |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5749 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5750 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5751 | spec->num_dmics = stac92xx_connected_ports(codec, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5752 | stac92hd71bxx_dmic_nids, |
| 5753 | STAC92HD71BXX_NUM_DMICS); |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5754 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5755 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 5756 | switch (spec->board_config) { |
| 5757 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5758 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 5759 | err = stac_add_event(codec, codec->afg, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5760 | STAC_VREF_EVENT, 0x02); |
| 5761 | if (err < 0) |
| 5762 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5763 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5764 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 5765 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5766 | spec->gpio_mask |= 0x02; |
| 5767 | break; |
| 5768 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5769 | if ((codec->revision_id & 0xf) == 0 || |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5770 | (codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5771 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5772 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5773 | /* disable VSW */ |
Takashi Iwai | 26a2798 | 2009-07-29 16:28:09 +0200 | [diff] [blame] | 5774 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5775 | unmute_init++; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5776 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); |
| 5777 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5778 | spec->dmic_nids = stac92hd71bxx_dmic_5port_nids; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5779 | spec->num_dmics = stac92xx_connected_ports(codec, |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 5780 | stac92hd71bxx_dmic_5port_nids, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5781 | STAC92HD71BXX_NUM_DMICS - 1); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5782 | break; |
| 5783 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5784 | if ((codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5785 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5786 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5787 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5788 | default: |
Takashi Iwai | 26a2798 | 2009-07-29 16:28:09 +0200 | [diff] [blame] | 5789 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5790 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 5791 | spec->num_dmics = stac92xx_connected_ports(codec, |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5792 | stac92hd71bxx_dmic_nids, |
| 5793 | STAC92HD71BXX_NUM_DMICS); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5794 | break; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5795 | } |
| 5796 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5797 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
| 5798 | snd_hda_sequence_write_cache(codec, unmute_init); |
| 5799 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5800 | spec->aloopback_ctl = stac92hd71bxx_loopback; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5801 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5802 | spec->aloopback_shift = 0; |
| 5803 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5804 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5805 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5806 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 5807 | spec->adc_nids = stac92hd71bxx_adc_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5808 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5809 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5810 | |
| 5811 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 5812 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Takashi Iwai | 5207e10 | 2009-07-30 13:09:08 +0200 | [diff] [blame] | 5813 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5814 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5815 | |
Kunal Gangakhedkar | d38cce7 | 2010-01-15 21:01:47 +0530 | [diff] [blame] | 5816 | snd_printdd("Found board config: %d\n", spec->board_config); |
| 5817 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5818 | switch (spec->board_config) { |
| 5819 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5820 | /* enable internal microphone */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5821 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea715 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 5822 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 5823 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 5824 | /* fallthru */ |
| 5825 | case STAC_DELL_M4_2: |
| 5826 | spec->num_dmics = 0; |
| 5827 | spec->num_smuxes = 0; |
| 5828 | spec->num_dmuxes = 0; |
| 5829 | break; |
| 5830 | case STAC_DELL_M4_1: |
| 5831 | case STAC_DELL_M4_3: |
| 5832 | spec->num_dmics = 1; |
| 5833 | spec->num_smuxes = 0; |
Takashi Iwai | ea18aa4 | 2009-02-27 17:36:33 +0100 | [diff] [blame] | 5834 | spec->num_dmuxes = 1; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5835 | break; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5836 | case STAC_HP_DV4_1222NR: |
| 5837 | spec->num_dmics = 1; |
| 5838 | /* I don't know if it needs 1 or 2 smuxes - will wait for |
| 5839 | * bug reports to fix if needed |
| 5840 | */ |
| 5841 | spec->num_smuxes = 1; |
| 5842 | spec->num_dmuxes = 1; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5843 | /* fallthrough */ |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 5844 | case STAC_HP_DV4: |
| 5845 | spec->gpio_led = 0x01; |
| 5846 | /* fallthrough */ |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5847 | case STAC_HP_DV5: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5848 | snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5849 | stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); |
Takashi Iwai | 6e34c03 | 2009-09-14 15:42:18 +0200 | [diff] [blame] | 5850 | /* HP dv6 gives the headphone pin as a line-out. Thus we |
| 5851 | * need to set hp_detect flag here to force to enable HP |
| 5852 | * detection. |
| 5853 | */ |
| 5854 | spec->hp_detect = 1; |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5855 | break; |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5856 | case STAC_HP_HDX: |
| 5857 | spec->num_dmics = 1; |
| 5858 | spec->num_dmuxes = 1; |
| 5859 | spec->num_smuxes = 1; |
Takashi Iwai | 26ebe0a | 2010-05-11 08:36:29 +0200 | [diff] [blame] | 5860 | spec->gpio_led = 0x08; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5861 | break; |
| 5862 | } |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5863 | |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 5864 | if (hp_blike_system(codec->subsystem_id)) { |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5865 | pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f); |
| 5866 | if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT || |
| 5867 | get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER || |
| 5868 | get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) { |
| 5869 | /* It was changed in the BIOS to just satisfy MS DTM. |
| 5870 | * Lets turn it back into slaved HP |
| 5871 | */ |
| 5872 | pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE)) |
| 5873 | | (AC_JACK_HP_OUT << |
| 5874 | AC_DEFCFG_DEVICE_SHIFT); |
| 5875 | pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC |
| 5876 | | AC_DEFCFG_SEQUENCE))) |
| 5877 | | 0x1f; |
| 5878 | snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg); |
| 5879 | } |
| 5880 | } |
| 5881 | |
Vitaliy Kulikov | 6a557c9 | 2011-12-12 17:35:13 -0600 | [diff] [blame] | 5882 | if (find_mute_led_cfg(codec, 1)) |
Vitaliy Kulikov | c357aab | 2009-12-11 07:51:54 +0100 | [diff] [blame] | 5883 | snd_printd("mute LED gpio %d polarity %d\n", |
| 5884 | spec->gpio_led, |
| 5885 | spec->gpio_led_polarity); |
Vitaliy Kulikov | 5bdaaad | 2009-11-04 07:57:45 +0100 | [diff] [blame] | 5886 | |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5887 | if (spec->gpio_led) { |
Takashi Iwai | f1a7374 | 2011-12-04 13:44:06 +0100 | [diff] [blame] | 5888 | if (!spec->vref_mute_led_nid) { |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5889 | spec->gpio_mask |= spec->gpio_led; |
| 5890 | spec->gpio_dir |= spec->gpio_led; |
| 5891 | spec->gpio_data |= spec->gpio_led; |
| 5892 | } else { |
| 5893 | codec->patch_ops.set_power_state = |
| 5894 | stac92xx_set_power_state; |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5895 | } |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5896 | #ifdef CONFIG_PM |
Vitaliy Kulikov | 45eebda | 2011-07-26 16:56:20 -0500 | [diff] [blame] | 5897 | codec->patch_ops.pre_resume = stac92xx_pre_resume; |
Takashi Iwai | 350eba43 | 2012-03-16 16:09:03 +0100 | [diff] [blame] | 5898 | #endif |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5899 | } |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5900 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5901 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5902 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 5903 | err = stac92xx_parse_auto_config(codec); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5904 | if (!err) { |
| 5905 | if (spec->board_config < 0) { |
| 5906 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5907 | "available, default to model=ref\n"); |
| 5908 | spec->board_config = STAC_92HD71BXX_REF; |
| 5909 | goto again; |
| 5910 | } |
| 5911 | err = -EINVAL; |
| 5912 | } |
| 5913 | |
| 5914 | if (err < 0) { |
| 5915 | stac92xx_free(codec); |
| 5916 | return err; |
| 5917 | } |
| 5918 | |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5919 | /* enable bass on HP dv7 */ |
Takashi Iwai | 2a6ce6e | 2010-05-12 10:16:20 +0200 | [diff] [blame] | 5920 | if (spec->board_config == STAC_HP_DV4 || |
| 5921 | spec->board_config == STAC_HP_DV5) { |
Takashi Iwai | 75d1aeb | 2009-12-22 11:56:32 +0100 | [diff] [blame] | 5922 | unsigned int cap; |
| 5923 | cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP); |
| 5924 | cap &= AC_GPIO_IO_COUNT; |
| 5925 | if (cap >= 6) |
| 5926 | stac_add_hp_bass_switch(codec); |
| 5927 | } |
| 5928 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5929 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5930 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5931 | return 0; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5932 | } |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5933 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5934 | static int patch_stac922x(struct hda_codec *codec) |
| 5935 | { |
| 5936 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5937 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5938 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5939 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5940 | if (spec == NULL) |
| 5941 | return -ENOMEM; |
| 5942 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 5943 | codec->no_trigger_sense = 1; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5944 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 5945 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5946 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5947 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5948 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 5949 | stac922x_models, |
| 5950 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5951 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5952 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 5953 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5954 | /* Intel Macs have all same PCI SSID, so we need to check |
| 5955 | * codec SSID to distinguish the exact models |
| 5956 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5957 | printk(KERN_INFO "hda_codec: STAC922x, Apple subsys_id=%x\n", codec->subsystem_id); |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5958 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5959 | |
| 5960 | case 0x106b0800: |
| 5961 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 5962 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5963 | case 0x106b0600: |
| 5964 | case 0x106b0700: |
| 5965 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5966 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5967 | case 0x106b0e00: |
| 5968 | case 0x106b0f00: |
| 5969 | case 0x106b1600: |
| 5970 | case 0x106b1700: |
| 5971 | case 0x106b0200: |
| 5972 | case 0x106b1e00: |
| 5973 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5974 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5975 | case 0x106b1a00: |
| 5976 | case 0x00000100: |
| 5977 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 5978 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5979 | case 0x106b0a00: |
| 5980 | case 0x106b2200: |
| 5981 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 5982 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5983 | default: |
| 5984 | spec->board_config = STAC_INTEL_MAC_V3; |
| 5985 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5986 | } |
| 5987 | } |
| 5988 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5989 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5990 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5991 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5992 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5993 | else |
| 5994 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5995 | stac922x_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5996 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5997 | spec->adc_nids = stac922x_adc_nids; |
| 5998 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5999 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 6000 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 6001 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 6002 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 6003 | |
| 6004 | spec->init = stac922x_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6005 | |
| 6006 | spec->num_caps = STAC922X_NUM_CAPS; |
| 6007 | spec->capvols = stac922x_capvols; |
| 6008 | spec->capsws = stac922x_capsws; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 6009 | |
| 6010 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 6011 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6012 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6013 | if (!err) { |
| 6014 | if (spec->board_config < 0) { |
| 6015 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 6016 | "available, default to model=ref\n"); |
| 6017 | spec->board_config = STAC_D945_REF; |
| 6018 | goto again; |
| 6019 | } |
| 6020 | err = -EINVAL; |
| 6021 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6022 | if (err < 0) { |
| 6023 | stac92xx_free(codec); |
| 6024 | return err; |
| 6025 | } |
| 6026 | |
| 6027 | codec->patch_ops = stac92xx_patch_ops; |
| 6028 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 6029 | /* Fix Mux capture level; max to 2 */ |
| 6030 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 6031 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 6032 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 6033 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 6034 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 6035 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6036 | return 0; |
| 6037 | } |
| 6038 | |
| 6039 | static int patch_stac927x(struct hda_codec *codec) |
| 6040 | { |
| 6041 | struct sigmatel_spec *spec; |
| 6042 | int err; |
| 6043 | |
| 6044 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6045 | if (spec == NULL) |
| 6046 | return -ENOMEM; |
| 6047 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6048 | codec->no_trigger_sense = 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6049 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6050 | spec->linear_tone_beep = 1; |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 6051 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 6052 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 6053 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6054 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 6055 | stac927x_models, |
| 6056 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6057 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6058 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6059 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6060 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6061 | else |
| 6062 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 6063 | stac927x_brd_tbl[spec->board_config]); |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6064 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 6065 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6066 | spec->adc_nids = stac927x_adc_nids; |
| 6067 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 6068 | spec->mux_nids = stac927x_mux_nids; |
| 6069 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 6070 | spec->smux_nids = stac927x_smux_nids; |
| 6071 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 6072 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 6073 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6074 | spec->multiout.dac_nids = spec->dac_nids; |
| 6075 | |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6076 | if (spec->board_config != STAC_D965_REF) { |
| 6077 | /* GPIO0 High = Enable EAPD */ |
| 6078 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 6079 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 6080 | } |
| 6081 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6082 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 6083 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6084 | case STAC_D965_5ST: |
| 6085 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6086 | spec->num_dmics = 0; |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 6087 | spec->init = d965_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6088 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6089 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 6090 | switch (codec->subsystem_id) { |
| 6091 | case 0x10280209: |
| 6092 | case 0x1028022e: |
| 6093 | /* correct the device field to SPDIF out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6094 | snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 6095 | break; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 6096 | } |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 6097 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6098 | snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 6099 | /* correct the front output jack as a hp out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6100 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 6101 | /* correct the front input jack as a mic */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6102 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 6103 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6104 | case STAC_DELL_3ST: |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6105 | if (codec->subsystem_id != 0x1028022f) { |
| 6106 | /* GPIO2 High = Enable EAPD */ |
| 6107 | spec->eapd_mask = spec->gpio_mask = 0x04; |
| 6108 | spec->gpio_dir = spec->gpio_data = 0x04; |
| 6109 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6110 | spec->dmic_nids = stac927x_dmic_nids; |
| 6111 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 6112 | |
Takashi Iwai | ccca7cd | 2009-10-13 15:32:21 +0200 | [diff] [blame] | 6113 | spec->init = dell_3st_core_init; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6114 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 6115 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6116 | break; |
Takashi Iwai | 5493053 | 2009-10-11 17:38:29 +0200 | [diff] [blame] | 6117 | case STAC_927X_VOLKNOB: |
| 6118 | spec->num_dmics = 0; |
| 6119 | spec->init = stac927x_volknob_core_init; |
| 6120 | break; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6121 | default: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6122 | spec->num_dmics = 0; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6123 | spec->init = stac927x_core_init; |
Takashi Iwai | af6ee30 | 2009-09-14 15:03:12 +0200 | [diff] [blame] | 6124 | break; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 6125 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6126 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6127 | spec->num_caps = STAC927X_NUM_CAPS; |
| 6128 | spec->capvols = stac927x_capvols; |
| 6129 | spec->capsws = stac927x_capsws; |
| 6130 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 6131 | spec->num_pwrs = 0; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 6132 | spec->aloopback_ctl = stac927x_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6133 | spec->aloopback_mask = 0x40; |
| 6134 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 6135 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 6136 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6137 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6138 | if (!err) { |
| 6139 | if (spec->board_config < 0) { |
| 6140 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 6141 | "available, default to model=ref\n"); |
| 6142 | spec->board_config = STAC_D965_REF; |
| 6143 | goto again; |
| 6144 | } |
| 6145 | err = -EINVAL; |
| 6146 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 6147 | if (err < 0) { |
| 6148 | stac92xx_free(codec); |
| 6149 | return err; |
| 6150 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6151 | |
| 6152 | codec->patch_ops = stac92xx_patch_ops; |
| 6153 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 6154 | codec->proc_widget_hook = stac927x_proc_hook; |
| 6155 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 6156 | /* |
| 6157 | * !!FIXME!! |
| 6158 | * The STAC927x seem to require fairly long delays for certain |
| 6159 | * command sequences. With too short delays (even if the answer |
| 6160 | * is set to RIRB properly), it results in the silence output |
| 6161 | * on some hardwares like Dell. |
| 6162 | * |
| 6163 | * The below flag enables the longer delay (see get_response |
| 6164 | * in hda_intel.c). |
| 6165 | */ |
| 6166 | codec->bus->needs_damn_long_delay = 1; |
| 6167 | |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 6168 | /* no jack detecion for ref-no-jd model */ |
| 6169 | if (spec->board_config == STAC_D965_REF_NO_JD) |
| 6170 | spec->hp_detect = 0; |
| 6171 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6172 | return 0; |
| 6173 | } |
| 6174 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6175 | static int patch_stac9205(struct hda_codec *codec) |
| 6176 | { |
| 6177 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 6178 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6179 | |
| 6180 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6181 | if (spec == NULL) |
| 6182 | return -ENOMEM; |
| 6183 | |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6184 | codec->no_trigger_sense = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6185 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6186 | spec->linear_tone_beep = 1; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 6187 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 6188 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6189 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 6190 | stac9205_models, |
| 6191 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6192 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6193 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6194 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6195 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6196 | else |
| 6197 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 6198 | stac9205_brd_tbl[spec->board_config]); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6199 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 6200 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6201 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 6202 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6203 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 6204 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 6205 | spec->smux_nids = stac9205_smux_nids; |
| 6206 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 6207 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 6208 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6209 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 6210 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 6211 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6212 | |
| 6213 | spec->init = stac9205_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 6214 | spec->aloopback_ctl = stac9205_loopback; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6215 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6216 | spec->num_caps = STAC9205_NUM_CAPS; |
| 6217 | spec->capvols = stac9205_capvols; |
| 6218 | spec->capsws = stac9205_capsws; |
| 6219 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6220 | spec->aloopback_mask = 0x40; |
| 6221 | spec->aloopback_shift = 0; |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 6222 | /* Turn on/off EAPD per HP plugging */ |
| 6223 | if (spec->board_config != STAC_9205_EAPD) |
| 6224 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6225 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6226 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6227 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6228 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6229 | /* Enable SPDIF in/out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 6230 | snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); |
| 6231 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 6232 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6233 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 6234 | err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 6235 | if (err < 0) |
| 6236 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 6237 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6238 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
Takashi Iwai | 3a93897 | 2011-10-28 01:16:55 +0200 | [diff] [blame] | 6239 | snd_hda_jack_detect_enable(codec, codec->afg, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6240 | |
| 6241 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 6242 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6243 | spec->gpio_mask = 0x1b; |
| 6244 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 6245 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6246 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6247 | */ |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6248 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6249 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 6250 | case STAC_9205_REF: |
| 6251 | /* SPDIF-In enabled */ |
| 6252 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6253 | default: |
| 6254 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 6255 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 6256 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 6257 | break; |
| 6258 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 6259 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6260 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 6261 | if (!err) { |
| 6262 | if (spec->board_config < 0) { |
| 6263 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 6264 | "available, default to model=ref\n"); |
| 6265 | spec->board_config = STAC_9205_REF; |
| 6266 | goto again; |
| 6267 | } |
| 6268 | err = -EINVAL; |
| 6269 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6270 | if (err < 0) { |
| 6271 | stac92xx_free(codec); |
| 6272 | return err; |
| 6273 | } |
| 6274 | |
| 6275 | codec->patch_ops = stac92xx_patch_ops; |
| 6276 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 6277 | codec->proc_widget_hook = stac9205_proc_hook; |
| 6278 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6279 | return 0; |
| 6280 | } |
| 6281 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6282 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6283 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6284 | */ |
| 6285 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6286 | static const struct hda_verb stac9872_core_init[] = { |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 6287 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6288 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 6289 | {} |
| 6290 | }; |
| 6291 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6292 | static const hda_nid_t stac9872_pin_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6293 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 6294 | 0x11, 0x13, 0x14, |
| 6295 | }; |
| 6296 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6297 | static const hda_nid_t stac9872_adc_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6298 | 0x8 /*,0x6*/ |
| 6299 | }; |
| 6300 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6301 | static const hda_nid_t stac9872_mux_nids[] = { |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6302 | 0x15 |
| 6303 | }; |
| 6304 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6305 | static const unsigned long stac9872_capvols[] = { |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6306 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 6307 | }; |
| 6308 | #define stac9872_capsws stac9872_capvols |
| 6309 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6310 | static const unsigned int stac9872_vaio_pin_configs[9] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6311 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
| 6312 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
| 6313 | 0x90a7013e |
| 6314 | }; |
| 6315 | |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 6316 | static const char * const stac9872_models[STAC_9872_MODELS] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6317 | [STAC_9872_AUTO] = "auto", |
| 6318 | [STAC_9872_VAIO] = "vaio", |
| 6319 | }; |
| 6320 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6321 | static const unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6322 | [STAC_9872_VAIO] = stac9872_vaio_pin_configs, |
| 6323 | }; |
| 6324 | |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6325 | static const struct snd_pci_quirk stac9872_cfg_tbl[] = { |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6326 | SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0, |
| 6327 | "Sony VAIO F/S", STAC_9872_VAIO), |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6328 | {} /* terminator */ |
| 6329 | }; |
| 6330 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6331 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6332 | { |
| 6333 | struct sigmatel_spec *spec; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6334 | int err; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6335 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6336 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6337 | if (spec == NULL) |
| 6338 | return -ENOMEM; |
Takashi Iwai | a252c81 | 2009-12-25 22:56:20 +0100 | [diff] [blame] | 6339 | codec->no_trigger_sense = 1; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6340 | codec->spec = spec; |
Daniel J Blueman | 1b0e372 | 2010-08-03 11:09:13 +0100 | [diff] [blame] | 6341 | spec->linear_tone_beep = 1; |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6342 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
| 6343 | spec->pin_nids = stac9872_pin_nids; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6344 | |
| 6345 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 6346 | stac9872_models, |
| 6347 | stac9872_cfg_tbl); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6348 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6349 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6350 | codec->chip_name); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6351 | else |
| 6352 | stac92xx_set_config_regs(codec, |
| 6353 | stac9872_brd_tbl[spec->board_config]); |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6354 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6355 | spec->multiout.dac_nids = spec->dac_nids; |
| 6356 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); |
| 6357 | spec->adc_nids = stac9872_adc_nids; |
| 6358 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
| 6359 | spec->mux_nids = stac9872_mux_nids; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6360 | spec->init = stac9872_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6361 | spec->num_caps = 1; |
| 6362 | spec->capvols = stac9872_capvols; |
| 6363 | spec->capsws = stac9872_capsws; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6364 | |
Charles Chin | 9009b0e | 2011-11-03 10:27:27 +0100 | [diff] [blame] | 6365 | err = stac92xx_parse_auto_config(codec); |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6366 | if (err < 0) { |
| 6367 | stac92xx_free(codec); |
| 6368 | return -EINVAL; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6369 | } |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6370 | spec->input_mux = &spec->private_imux; |
| 6371 | codec->patch_ops = stac92xx_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6372 | return 0; |
| 6373 | } |
| 6374 | |
| 6375 | |
| 6376 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6377 | * patch entries |
| 6378 | */ |
Takashi Iwai | 2b63536 | 2011-05-02 12:33:43 +0200 | [diff] [blame] | 6379 | static const struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6380 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 6381 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 6382 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 6383 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 6384 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 6385 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 6386 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 6387 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 6388 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 6389 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 6390 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 6391 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 6392 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6393 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 6394 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 6395 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 6396 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 6397 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 6398 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 6399 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 6400 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 6401 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 6402 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 6403 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 6404 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 6405 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 6406 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 6407 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 6408 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 6409 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 6410 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6411 | /* The following does not take into account .id=0x83847661 when subsys = |
| 6412 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 6413 | * currently not fully supported. |
| 6414 | */ |
| 6415 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 6416 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 6417 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Simos Xenitellis | a5c0f88 | 2009-06-10 16:33:31 +0100 | [diff] [blame] | 6418 | { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6419 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 6420 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 6421 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 6422 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 6423 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 6424 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 6425 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 6426 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6427 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 6428 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | a9694fa | 2010-02-04 08:58:23 +0100 | [diff] [blame] | 6429 | { .id = 0x111d76d4, .name = "92HD83C1C5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 6430 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 6431 | { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, |
Charles Chin | 8a345a0 | 2010-08-10 11:43:25 +0200 | [diff] [blame] | 6432 | { .id = 0x111d76d1, .name = "92HD87B1/3", .patch = patch_stac92hd83xxx}, |
| 6433 | { .id = 0x111d76d9, .name = "92HD87B2/4", .patch = patch_stac92hd83xxx}, |
Charles Chin | 3670600 | 2010-01-29 12:05:51 +0100 | [diff] [blame] | 6434 | { .id = 0x111d7666, .name = "92HD88B3", .patch = patch_stac92hd83xxx}, |
| 6435 | { .id = 0x111d7667, .name = "92HD88B1", .patch = patch_stac92hd83xxx}, |
| 6436 | { .id = 0x111d7668, .name = "92HD88B2", .patch = patch_stac92hd83xxx}, |
| 6437 | { .id = 0x111d7669, .name = "92HD88B4", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6438 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6439 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 6440 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6441 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6442 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6443 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6444 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6445 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6446 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6447 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6448 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 6449 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Charles Chin | 4d8ec5f | 2010-08-19 08:06:16 +0200 | [diff] [blame] | 6450 | { .id = 0x111d76c0, .name = "92HD89C3", .patch = patch_stac92hd73xx }, |
| 6451 | { .id = 0x111d76c1, .name = "92HD89C2", .patch = patch_stac92hd73xx }, |
| 6452 | { .id = 0x111d76c2, .name = "92HD89C1", .patch = patch_stac92hd73xx }, |
| 6453 | { .id = 0x111d76c3, .name = "92HD89B3", .patch = patch_stac92hd73xx }, |
| 6454 | { .id = 0x111d76c4, .name = "92HD89B2", .patch = patch_stac92hd73xx }, |
| 6455 | { .id = 0x111d76c5, .name = "92HD89B1", .patch = patch_stac92hd73xx }, |
| 6456 | { .id = 0x111d76c6, .name = "92HD89E3", .patch = patch_stac92hd73xx }, |
| 6457 | { .id = 0x111d76c7, .name = "92HD89E2", .patch = patch_stac92hd73xx }, |
| 6458 | { .id = 0x111d76c8, .name = "92HD89E1", .patch = patch_stac92hd73xx }, |
| 6459 | { .id = 0x111d76c9, .name = "92HD89D3", .patch = patch_stac92hd73xx }, |
| 6460 | { .id = 0x111d76ca, .name = "92HD89D2", .patch = patch_stac92hd73xx }, |
| 6461 | { .id = 0x111d76cb, .name = "92HD89D1", .patch = patch_stac92hd73xx }, |
| 6462 | { .id = 0x111d76cc, .name = "92HD89F3", .patch = patch_stac92hd73xx }, |
| 6463 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, |
| 6464 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, |
David Henningsson | 46724c2 | 2011-09-20 09:02:22 +0200 | [diff] [blame] | 6465 | { .id = 0x111d76df, .name = "92HD93BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 6466 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | 4dfb8a4 | 2011-02-22 17:32:19 -0600 | [diff] [blame] | 6467 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, |
| 6468 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, |
Vitaliy Kulikov | ab5a6eb | 2010-09-08 09:00:17 +0200 | [diff] [blame] | 6469 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
Charles Chin | ad5d875 | 2011-11-02 07:56:58 +0100 | [diff] [blame] | 6470 | { .id = 0x111d76e8, .name = "92HD66B1X5", .patch = patch_stac92hd83xxx}, |
| 6471 | { .id = 0x111d76e9, .name = "92HD66B2X5", .patch = patch_stac92hd83xxx}, |
| 6472 | { .id = 0x111d76ea, .name = "92HD66B3X5", .patch = patch_stac92hd83xxx}, |
| 6473 | { .id = 0x111d76eb, .name = "92HD66C1X5", .patch = patch_stac92hd83xxx}, |
| 6474 | { .id = 0x111d76ec, .name = "92HD66C2X5", .patch = patch_stac92hd83xxx}, |
| 6475 | { .id = 0x111d76ed, .name = "92HD66C3X5", .patch = patch_stac92hd83xxx}, |
| 6476 | { .id = 0x111d76ee, .name = "92HD66B1X3", .patch = patch_stac92hd83xxx}, |
| 6477 | { .id = 0x111d76ef, .name = "92HD66B2X3", .patch = patch_stac92hd83xxx}, |
| 6478 | { .id = 0x111d76f0, .name = "92HD66B3X3", .patch = patch_stac92hd83xxx}, |
| 6479 | { .id = 0x111d76f1, .name = "92HD66C1X3", .patch = patch_stac92hd83xxx}, |
| 6480 | { .id = 0x111d76f2, .name = "92HD66C2X3", .patch = patch_stac92hd83xxx}, |
| 6481 | { .id = 0x111d76f3, .name = "92HD66C3/65", .patch = patch_stac92hd83xxx}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6482 | {} /* terminator */ |
| 6483 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 6484 | |
| 6485 | MODULE_ALIAS("snd-hda-codec-id:8384*"); |
| 6486 | MODULE_ALIAS("snd-hda-codec-id:111d*"); |
| 6487 | |
| 6488 | MODULE_LICENSE("GPL"); |
| 6489 | MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); |
| 6490 | |
| 6491 | static struct hda_codec_preset_list sigmatel_list = { |
| 6492 | .preset = snd_hda_preset_sigmatel, |
| 6493 | .owner = THIS_MODULE, |
| 6494 | }; |
| 6495 | |
| 6496 | static int __init patch_sigmatel_init(void) |
| 6497 | { |
| 6498 | return snd_hda_add_codec_preset(&sigmatel_list); |
| 6499 | } |
| 6500 | |
| 6501 | static void __exit patch_sigmatel_exit(void) |
| 6502 | { |
| 6503 | snd_hda_delete_codec_preset(&sigmatel_list); |
| 6504 | } |
| 6505 | |
| 6506 | module_init(patch_sigmatel_init) |
| 6507 | module_exit(patch_sigmatel_exit) |