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> |
| 31 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 32 | #include <sound/asoundef.h> |
Matthew Ranostay | 45a6ac1 | 2008-10-15 14:45:38 -0400 | [diff] [blame] | 33 | #include <sound/jack.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 34 | #include "hda_codec.h" |
| 35 | #include "hda_local.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 36 | #include "hda_beep.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 37 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 38 | enum { |
| 39 | STAC_VREF_EVENT = 1, |
| 40 | STAC_INSERT_EVENT, |
| 41 | STAC_PWR_EVENT, |
| 42 | STAC_HP_EVENT, |
| 43 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 44 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 45 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 46 | STAC_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 47 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 48 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 49 | STAC_9200_DELL_D21, |
| 50 | STAC_9200_DELL_D22, |
| 51 | STAC_9200_DELL_D23, |
| 52 | STAC_9200_DELL_M21, |
| 53 | STAC_9200_DELL_M22, |
| 54 | STAC_9200_DELL_M23, |
| 55 | STAC_9200_DELL_M24, |
| 56 | STAC_9200_DELL_M25, |
| 57 | STAC_9200_DELL_M26, |
| 58 | STAC_9200_DELL_M27, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 59 | STAC_9200_M4, |
| 60 | STAC_9200_M4_2, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 61 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 62 | STAC_9200_MODELS |
| 63 | }; |
| 64 | |
| 65 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 66 | STAC_9205_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 67 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 68 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 69 | STAC_9205_DELL_M43, |
| 70 | STAC_9205_DELL_M44, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 71 | STAC_9205_EAPD, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 72 | STAC_9205_MODELS |
| 73 | }; |
| 74 | |
| 75 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 76 | STAC_92HD73XX_AUTO, |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 77 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 78 | STAC_92HD73XX_REF, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 79 | STAC_DELL_M6_AMIC, |
| 80 | STAC_DELL_M6_DMIC, |
| 81 | STAC_DELL_M6_BOTH, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 82 | STAC_DELL_EQ, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 83 | STAC_92HD73XX_MODELS |
| 84 | }; |
| 85 | |
| 86 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 87 | STAC_92HD83XXX_AUTO, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 88 | STAC_92HD83XXX_REF, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 89 | STAC_92HD83XXX_PWR_REF, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 90 | STAC_DELL_S14, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 91 | STAC_92HD83XXX_MODELS |
| 92 | }; |
| 93 | |
| 94 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 95 | STAC_92HD71BXX_AUTO, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 96 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 97 | STAC_DELL_M4_1, |
| 98 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 99 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 100 | STAC_HP_M4, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 101 | STAC_HP_DV5, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 102 | STAC_HP_HDX, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 103 | STAC_92HD71BXX_MODELS |
| 104 | }; |
| 105 | |
| 106 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 107 | STAC_925x_AUTO, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 108 | STAC_925x_REF, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 109 | STAC_M1, |
| 110 | STAC_M1_2, |
| 111 | STAC_M2, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 112 | STAC_M2_2, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 113 | STAC_M3, |
| 114 | STAC_M5, |
| 115 | STAC_M6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 116 | STAC_925x_MODELS |
| 117 | }; |
| 118 | |
| 119 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 120 | STAC_922X_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 121 | STAC_D945_REF, |
| 122 | STAC_D945GTP3, |
| 123 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 124 | STAC_INTEL_MAC_V1, |
| 125 | STAC_INTEL_MAC_V2, |
| 126 | STAC_INTEL_MAC_V3, |
| 127 | STAC_INTEL_MAC_V4, |
| 128 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 129 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 130 | * is given, one of the above models will be |
| 131 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 132 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 133 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 134 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 135 | STAC_MACBOOK_PRO_V1, |
| 136 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 137 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 138 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 139 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 140 | STAC_922X_DELL_D81, |
| 141 | STAC_922X_DELL_D82, |
| 142 | STAC_922X_DELL_M81, |
| 143 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 144 | STAC_922X_MODELS |
| 145 | }; |
| 146 | |
| 147 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 148 | STAC_927X_AUTO, |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 149 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 150 | STAC_D965_REF, |
| 151 | STAC_D965_3ST, |
| 152 | STAC_D965_5ST, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame^] | 153 | STAC_D965_5ST_NO_FP, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 154 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 155 | STAC_DELL_BIOS, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 156 | STAC_927X_MODELS |
| 157 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 158 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 159 | enum { |
| 160 | STAC_9872_AUTO, |
| 161 | STAC_9872_VAIO, |
| 162 | STAC_9872_MODELS |
| 163 | }; |
| 164 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 165 | struct sigmatel_event { |
| 166 | hda_nid_t nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 167 | unsigned char type; |
| 168 | unsigned char tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 169 | int data; |
| 170 | }; |
| 171 | |
| 172 | struct sigmatel_jack { |
| 173 | hda_nid_t nid; |
| 174 | int type; |
| 175 | struct snd_jack *jack; |
| 176 | }; |
| 177 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 178 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 179 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 180 | unsigned int num_mixers; |
| 181 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 182 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 183 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 184 | unsigned int surr_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 185 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 186 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 187 | unsigned int spdif_mute: 1; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 188 | unsigned int check_volume_offset:1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 189 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 190 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 191 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 192 | unsigned int gpio_mask; |
| 193 | unsigned int gpio_dir; |
| 194 | unsigned int gpio_data; |
| 195 | unsigned int gpio_mute; |
| 196 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 197 | /* stream */ |
| 198 | unsigned int stream_delay; |
| 199 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 200 | /* analog loopback */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 201 | struct snd_kcontrol_new *aloopback_ctl; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 202 | unsigned char aloopback_mask; |
| 203 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 204 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 205 | /* power management */ |
| 206 | unsigned int num_pwrs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 207 | unsigned int *pwr_mapping; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 208 | hda_nid_t *pwr_nids; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 209 | hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 210 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 211 | /* jack detection */ |
| 212 | struct snd_array jacks; |
| 213 | |
| 214 | /* events */ |
| 215 | struct snd_array events; |
| 216 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 217 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 218 | struct hda_input_mux *mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 219 | struct hda_input_mux *amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 220 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 221 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 222 | hda_nid_t dac_nids[5]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 223 | hda_nid_t hp_dacs[5]; |
| 224 | hda_nid_t speaker_dacs[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 225 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 226 | int volume_offset; |
| 227 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 228 | /* capture */ |
| 229 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 230 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 231 | hda_nid_t *mux_nids; |
| 232 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 233 | hda_nid_t *dmic_nids; |
| 234 | unsigned int num_dmics; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 235 | hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 236 | unsigned int num_dmuxes; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 237 | hda_nid_t *smux_nids; |
| 238 | unsigned int num_smuxes; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 239 | const char **spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 240 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 241 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 242 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 243 | hda_nid_t anabeep_nid; |
| 244 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 245 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 246 | /* pin widgets */ |
| 247 | hda_nid_t *pin_nids; |
| 248 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 249 | |
| 250 | /* codec specific stuff */ |
| 251 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 252 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 253 | |
| 254 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 255 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 256 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 257 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 258 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 259 | struct hda_input_mux *sinput_mux; |
| 260 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 261 | unsigned int cur_amux; |
| 262 | hda_nid_t *amp_nids; |
| 263 | unsigned int num_amps; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 264 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 265 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 266 | /* i/o switches */ |
| 267 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 268 | unsigned int clfe_swap; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 269 | hda_nid_t line_switch; /* shared line-in for input and output */ |
| 270 | hda_nid_t mic_switch; /* shared mic-in for input and output */ |
| 271 | hda_nid_t hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 272 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 273 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 274 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 275 | |
| 276 | /* dynamic controls and input_mux */ |
| 277 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 278 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 279 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 280 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 281 | struct hda_input_mux private_smux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 282 | struct hda_input_mux private_amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 283 | struct hda_input_mux private_mono_mux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 284 | }; |
| 285 | |
| 286 | static hda_nid_t stac9200_adc_nids[1] = { |
| 287 | 0x03, |
| 288 | }; |
| 289 | |
| 290 | static hda_nid_t stac9200_mux_nids[1] = { |
| 291 | 0x0c, |
| 292 | }; |
| 293 | |
| 294 | static hda_nid_t stac9200_dac_nids[1] = { |
| 295 | 0x02, |
| 296 | }; |
| 297 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 298 | static hda_nid_t stac92hd73xx_pwr_nids[8] = { |
| 299 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 300 | 0x0f, 0x10, 0x11 |
| 301 | }; |
| 302 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 303 | static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
| 304 | 0x26, 0, |
| 305 | }; |
| 306 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 307 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
| 308 | 0x1a, 0x1b |
| 309 | }; |
| 310 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 311 | #define DELL_M6_AMP 2 |
| 312 | static hda_nid_t stac92hd73xx_amp_nids[3] = { |
| 313 | 0x0b, 0x0c, 0x0e |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 314 | }; |
| 315 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 316 | #define STAC92HD73XX_NUM_DMICS 2 |
| 317 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
| 318 | 0x13, 0x14, 0 |
| 319 | }; |
| 320 | |
| 321 | #define STAC92HD73_DAC_COUNT 5 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 322 | |
| 323 | static hda_nid_t stac92hd73xx_mux_nids[4] = { |
| 324 | 0x28, 0x29, 0x2a, 0x2b, |
| 325 | }; |
| 326 | |
| 327 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
| 328 | 0x20, 0x21, |
| 329 | }; |
| 330 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 331 | static hda_nid_t stac92hd73xx_smux_nids[2] = { |
| 332 | 0x22, 0x23, |
| 333 | }; |
| 334 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 335 | #define STAC92HD83XXX_NUM_DMICS 2 |
| 336 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { |
| 337 | 0x11, 0x12, 0 |
| 338 | }; |
| 339 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 340 | #define STAC92HD83_DAC_COUNT 3 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 341 | |
| 342 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { |
| 343 | 0x17, 0x18, |
| 344 | }; |
| 345 | |
| 346 | static hda_nid_t stac92hd83xxx_adc_nids[2] = { |
| 347 | 0x15, 0x16, |
| 348 | }; |
| 349 | |
| 350 | static hda_nid_t stac92hd83xxx_pwr_nids[4] = { |
| 351 | 0xa, 0xb, 0xd, 0xe, |
| 352 | }; |
| 353 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 354 | static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
| 355 | 0x1e, 0, |
| 356 | }; |
| 357 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 358 | static unsigned int stac92hd83xxx_pwr_mapping[4] = { |
Matthew Ranostay | 87e88a7 | 2009-01-22 20:38:42 -0500 | [diff] [blame] | 359 | 0x03, 0x0c, 0x20, 0x40, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 360 | }; |
| 361 | |
Takashi Iwai | 9248f26 | 2009-01-14 09:40:25 +0100 | [diff] [blame] | 362 | static hda_nid_t stac92hd83xxx_amp_nids[1] = { |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 363 | 0xc, |
| 364 | }; |
| 365 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 366 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
| 367 | 0x0a, 0x0d, 0x0f |
| 368 | }; |
| 369 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 370 | static hda_nid_t stac92hd71bxx_adc_nids[2] = { |
| 371 | 0x12, 0x13, |
| 372 | }; |
| 373 | |
| 374 | static hda_nid_t stac92hd71bxx_mux_nids[2] = { |
| 375 | 0x1a, 0x1b |
| 376 | }; |
| 377 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 378 | static hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
| 379 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 380 | }; |
| 381 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 382 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { |
| 383 | 0x24, 0x25, |
| 384 | }; |
| 385 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 386 | #define STAC92HD71BXX_NUM_DMICS 2 |
| 387 | static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
| 388 | 0x18, 0x19, 0 |
| 389 | }; |
| 390 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 391 | static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
| 392 | 0x22, 0 |
| 393 | }; |
| 394 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 395 | static hda_nid_t stac925x_adc_nids[1] = { |
| 396 | 0x03, |
| 397 | }; |
| 398 | |
| 399 | static hda_nid_t stac925x_mux_nids[1] = { |
| 400 | 0x0f, |
| 401 | }; |
| 402 | |
| 403 | static hda_nid_t stac925x_dac_nids[1] = { |
| 404 | 0x02, |
| 405 | }; |
| 406 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 407 | #define STAC925X_NUM_DMICS 1 |
| 408 | static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
| 409 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 410 | }; |
| 411 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 412 | static hda_nid_t stac925x_dmux_nids[1] = { |
| 413 | 0x14, |
| 414 | }; |
| 415 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 416 | static hda_nid_t stac922x_adc_nids[2] = { |
| 417 | 0x06, 0x07, |
| 418 | }; |
| 419 | |
| 420 | static hda_nid_t stac922x_mux_nids[2] = { |
| 421 | 0x12, 0x13, |
| 422 | }; |
| 423 | |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 424 | static hda_nid_t stac927x_slave_dig_outs[2] = { |
| 425 | 0x1f, 0, |
| 426 | }; |
| 427 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 428 | static hda_nid_t stac927x_adc_nids[3] = { |
| 429 | 0x07, 0x08, 0x09 |
| 430 | }; |
| 431 | |
| 432 | static hda_nid_t stac927x_mux_nids[3] = { |
| 433 | 0x15, 0x16, 0x17 |
| 434 | }; |
| 435 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 436 | static hda_nid_t stac927x_smux_nids[1] = { |
| 437 | 0x21, |
| 438 | }; |
| 439 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 440 | static hda_nid_t stac927x_dac_nids[6] = { |
| 441 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 442 | }; |
| 443 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 444 | static hda_nid_t stac927x_dmux_nids[1] = { |
| 445 | 0x1b, |
| 446 | }; |
| 447 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 448 | #define STAC927X_NUM_DMICS 2 |
| 449 | static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
| 450 | 0x13, 0x14, 0 |
| 451 | }; |
| 452 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 453 | static const char *stac927x_spdif_labels[5] = { |
| 454 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 455 | "Analog Mux 2", "Analog Mux 3" |
| 456 | }; |
| 457 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 458 | static hda_nid_t stac9205_adc_nids[2] = { |
| 459 | 0x12, 0x13 |
| 460 | }; |
| 461 | |
| 462 | static hda_nid_t stac9205_mux_nids[2] = { |
| 463 | 0x19, 0x1a |
| 464 | }; |
| 465 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 466 | static hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 467 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 468 | }; |
| 469 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 470 | static hda_nid_t stac9205_smux_nids[1] = { |
| 471 | 0x21, |
| 472 | }; |
| 473 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 474 | #define STAC9205_NUM_DMICS 2 |
| 475 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
| 476 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 477 | }; |
| 478 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 479 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 480 | 0x08, 0x09, 0x0d, 0x0e, |
| 481 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 482 | }; |
| 483 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 484 | static hda_nid_t stac925x_pin_nids[8] = { |
| 485 | 0x07, 0x08, 0x0a, 0x0b, |
| 486 | 0x0c, 0x0d, 0x10, 0x11, |
| 487 | }; |
| 488 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 489 | static hda_nid_t stac922x_pin_nids[10] = { |
| 490 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 491 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 492 | }; |
| 493 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 494 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 495 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 496 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 497 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 498 | }; |
| 499 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 500 | static hda_nid_t stac92hd83xxx_pin_nids[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 501 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 502 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 503 | }; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 504 | |
| 505 | #define STAC92HD71BXX_NUM_PINS 13 |
| 506 | static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { |
| 507 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, |
| 508 | 0x00, 0x14, 0x18, 0x19, 0x1e, |
| 509 | 0x1f, 0x20, 0x27 |
| 510 | }; |
| 511 | static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 512 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 513 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 514 | 0x1f, 0x20, 0x27 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 515 | }; |
| 516 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 517 | static hda_nid_t stac927x_pin_nids[14] = { |
| 518 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 519 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 520 | 0x14, 0x21, 0x22, 0x23, |
| 521 | }; |
| 522 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 523 | static hda_nid_t stac9205_pin_nids[12] = { |
| 524 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 525 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 526 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 527 | }; |
| 528 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 529 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info |
| 530 | |
| 531 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, |
| 532 | struct snd_ctl_elem_value *ucontrol) |
| 533 | { |
| 534 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 535 | struct sigmatel_spec *spec = codec->spec; |
| 536 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 537 | |
| 538 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 539 | kcontrol->private_value |= nid; |
| 540 | |
| 541 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); |
| 542 | } |
| 543 | |
| 544 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, |
| 545 | struct snd_ctl_elem_value *ucontrol) |
| 546 | { |
| 547 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 548 | struct sigmatel_spec *spec = codec->spec; |
| 549 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 550 | |
| 551 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 552 | kcontrol->private_value |= nid; |
| 553 | |
| 554 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); |
| 555 | } |
| 556 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 557 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 558 | struct snd_ctl_elem_info *uinfo) |
| 559 | { |
| 560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 561 | struct sigmatel_spec *spec = codec->spec; |
| 562 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 563 | } |
| 564 | |
| 565 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 566 | struct snd_ctl_elem_value *ucontrol) |
| 567 | { |
| 568 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 569 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 570 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 571 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 572 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 573 | return 0; |
| 574 | } |
| 575 | |
| 576 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 577 | struct snd_ctl_elem_value *ucontrol) |
| 578 | { |
| 579 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 580 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 581 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 582 | |
| 583 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 584 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 585 | } |
| 586 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 587 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 588 | struct snd_ctl_elem_info *uinfo) |
| 589 | { |
| 590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 591 | struct sigmatel_spec *spec = codec->spec; |
| 592 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 593 | } |
| 594 | |
| 595 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 596 | struct snd_ctl_elem_value *ucontrol) |
| 597 | { |
| 598 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 599 | struct sigmatel_spec *spec = codec->spec; |
| 600 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 601 | |
| 602 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 603 | return 0; |
| 604 | } |
| 605 | |
| 606 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 607 | struct snd_ctl_elem_value *ucontrol) |
| 608 | { |
| 609 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 610 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 611 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 612 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 613 | int err, val; |
| 614 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 615 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 616 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 617 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 618 | if (err < 0) |
| 619 | return err; |
| 620 | |
| 621 | if (spec->spdif_mute) { |
| 622 | if (smux_idx == 0) |
| 623 | nid = spec->multiout.dig_out_nid; |
| 624 | else |
| 625 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 626 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 627 | val = HDA_AMP_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 628 | else |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 629 | val = 0; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 630 | /* un/mute SPDIF out */ |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 631 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 632 | HDA_AMP_MUTE, val); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 633 | } |
| 634 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 635 | } |
| 636 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 637 | 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] | 638 | { |
| 639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 640 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 641 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 642 | } |
| 643 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 644 | 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] | 645 | { |
| 646 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 647 | struct sigmatel_spec *spec = codec->spec; |
| 648 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 649 | |
| 650 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 651 | return 0; |
| 652 | } |
| 653 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 654 | 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] | 655 | { |
| 656 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 657 | struct sigmatel_spec *spec = codec->spec; |
| 658 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 659 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 660 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 661 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 662 | } |
| 663 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 664 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 665 | struct snd_ctl_elem_info *uinfo) |
| 666 | { |
| 667 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 668 | struct sigmatel_spec *spec = codec->spec; |
| 669 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 670 | } |
| 671 | |
| 672 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_value *ucontrol) |
| 674 | { |
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 676 | struct sigmatel_spec *spec = codec->spec; |
| 677 | |
| 678 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 679 | return 0; |
| 680 | } |
| 681 | |
| 682 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 683 | struct snd_ctl_elem_value *ucontrol) |
| 684 | { |
| 685 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 686 | struct sigmatel_spec *spec = codec->spec; |
| 687 | |
| 688 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 689 | spec->mono_nid, &spec->cur_mmux); |
| 690 | } |
| 691 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 692 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 693 | struct snd_ctl_elem_info *uinfo) |
| 694 | { |
| 695 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 696 | struct sigmatel_spec *spec = codec->spec; |
| 697 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); |
| 698 | } |
| 699 | |
| 700 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 701 | struct snd_ctl_elem_value *ucontrol) |
| 702 | { |
| 703 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 704 | struct sigmatel_spec *spec = codec->spec; |
| 705 | |
| 706 | ucontrol->value.enumerated.item[0] = spec->cur_amux; |
| 707 | return 0; |
| 708 | } |
| 709 | |
| 710 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 711 | struct snd_ctl_elem_value *ucontrol) |
| 712 | { |
| 713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 714 | struct sigmatel_spec *spec = codec->spec; |
| 715 | struct snd_kcontrol *ctl = |
| 716 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); |
| 717 | if (!ctl) |
| 718 | return -EINVAL; |
| 719 | |
| 720 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | |
| 721 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
| 722 | |
| 723 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, |
| 724 | 0, &spec->cur_amux); |
| 725 | } |
| 726 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 727 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 728 | |
| 729 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 730 | struct snd_ctl_elem_value *ucontrol) |
| 731 | { |
| 732 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 733 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 734 | struct sigmatel_spec *spec = codec->spec; |
| 735 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 736 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 737 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 738 | return 0; |
| 739 | } |
| 740 | |
| 741 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 742 | struct snd_ctl_elem_value *ucontrol) |
| 743 | { |
| 744 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 745 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 746 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 747 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 748 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 749 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 750 | idx_val = spec->aloopback_mask << idx; |
| 751 | if (ucontrol->value.integer.value[0]) |
| 752 | val = spec->aloopback | idx_val; |
| 753 | else |
| 754 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 755 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 756 | return 0; |
| 757 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 758 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 759 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 760 | /* Only return the bits defined by the shift value of the |
| 761 | * first two bytes of the mask |
| 762 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 763 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 764 | kcontrol->private_value & 0xFFFF, 0x0); |
| 765 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 766 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 767 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 768 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 769 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 770 | } else { |
| 771 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 772 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 773 | } |
| 774 | |
| 775 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 776 | kcontrol->private_value >> 16, dac_mode); |
| 777 | |
| 778 | return 1; |
| 779 | } |
| 780 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 781 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 782 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 783 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 784 | {} |
| 785 | }; |
| 786 | |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 787 | static struct hda_verb stac9200_eapd_init[] = { |
| 788 | /* set dac0mux for dac converter */ |
| 789 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 790 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 791 | {} |
| 792 | }; |
| 793 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 794 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { |
| 795 | /* set master volume and direct control */ |
| 796 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 797 | /* setup adcs to point to mixer */ |
| 798 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 799 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 800 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 801 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 802 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 803 | /* setup import muxs */ |
| 804 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 805 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 806 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 807 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 808 | {} |
| 809 | }; |
| 810 | |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 811 | static struct hda_verb dell_eq_core_init[] = { |
| 812 | /* set master volume to max value without distortion |
| 813 | * and direct control */ |
| 814 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 815 | /* setup adcs to point to mixer */ |
| 816 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 817 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 818 | /* setup import muxs */ |
| 819 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 820 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 821 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 822 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 823 | {} |
| 824 | }; |
| 825 | |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 826 | static struct hda_verb dell_m6_core_init[] = { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 827 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 828 | /* setup adcs to point to mixer */ |
| 829 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 830 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 831 | /* setup import muxs */ |
| 832 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 833 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 834 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 835 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 836 | {} |
| 837 | }; |
| 838 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 839 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
| 840 | /* set master volume and direct control */ |
| 841 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 842 | /* setup adcs to point to mixer */ |
| 843 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 844 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 845 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 846 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 847 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 848 | /* setup import muxs */ |
| 849 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 850 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 851 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 852 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 853 | {} |
| 854 | }; |
| 855 | |
| 856 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { |
| 857 | /* set master volume and direct control */ |
| 858 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 859 | /* dac3 is connected to import3 mux */ |
| 860 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 861 | /* setup adcs to point to mixer */ |
| 862 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 863 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 864 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 865 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 866 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 867 | /* setup import muxs */ |
| 868 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 869 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 870 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 871 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 872 | {} |
| 873 | }; |
| 874 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 875 | static struct hda_verb stac92hd83xxx_core_init[] = { |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 876 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 877 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 878 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 879 | |
| 880 | /* power state controls amps */ |
| 881 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 882 | {} |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 883 | }; |
| 884 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 885 | static struct hda_verb stac92hd71bxx_core_init[] = { |
| 886 | /* set master volume and direct control */ |
| 887 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 888 | {} |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 889 | }; |
| 890 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 891 | #define HD_DISABLE_PORTF 1 |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 892 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 893 | /* start of config #1 */ |
| 894 | |
| 895 | /* connect port 0f to audio mixer */ |
| 896 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 897 | /* start of config #2 */ |
| 898 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 899 | /* set master volume and direct control */ |
| 900 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 901 | {} |
| 902 | }; |
| 903 | |
| 904 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
| 905 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
| 906 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 907 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 908 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 909 | {} |
| 910 | }; |
| 911 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 912 | static struct hda_verb stac925x_core_init[] = { |
| 913 | /* set dac0mux for dac converter */ |
| 914 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 915 | /* mute the master volume */ |
| 916 | { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 917 | {} |
| 918 | }; |
| 919 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 920 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 921 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 922 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 923 | {} |
| 924 | }; |
| 925 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 926 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 927 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 928 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 929 | /* unmute node 0x1b */ |
| 930 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 931 | /* select node 0x03 as DAC */ |
| 932 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 933 | {} |
| 934 | }; |
| 935 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 936 | static struct hda_verb stac927x_core_init[] = { |
| 937 | /* set master volume and direct control */ |
| 938 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 939 | /* enable analog pc beep path */ |
| 940 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 941 | {} |
| 942 | }; |
| 943 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 944 | static struct hda_verb stac9205_core_init[] = { |
| 945 | /* set master volume and direct control */ |
| 946 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 947 | /* enable analog pc beep path */ |
| 948 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 949 | {} |
| 950 | }; |
| 951 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 952 | #define STAC_MONO_MUX \ |
| 953 | { \ |
| 954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 955 | .name = "Mono Mux", \ |
| 956 | .count = 1, \ |
| 957 | .info = stac92xx_mono_mux_enum_info, \ |
| 958 | .get = stac92xx_mono_mux_enum_get, \ |
| 959 | .put = stac92xx_mono_mux_enum_put, \ |
| 960 | } |
| 961 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 962 | #define STAC_AMP_MUX \ |
| 963 | { \ |
| 964 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 965 | .name = "Amp Selector Capture Switch", \ |
| 966 | .count = 1, \ |
| 967 | .info = stac92xx_amp_mux_enum_info, \ |
| 968 | .get = stac92xx_amp_mux_enum_get, \ |
| 969 | .put = stac92xx_amp_mux_enum_put, \ |
| 970 | } |
| 971 | |
| 972 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ |
| 973 | { \ |
| 974 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 975 | .name = xname, \ |
| 976 | .index = 0, \ |
| 977 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 978 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 979 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
| 980 | .info = stac92xx_amp_volume_info, \ |
| 981 | .get = stac92xx_amp_volume_get, \ |
| 982 | .put = stac92xx_amp_volume_put, \ |
| 983 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ |
| 984 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ |
| 985 | } |
| 986 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 987 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 988 | { \ |
| 989 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 990 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 991 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 992 | .info = stac92xx_aloopback_info, \ |
| 993 | .get = stac92xx_aloopback_get, \ |
| 994 | .put = stac92xx_aloopback_put, \ |
| 995 | .private_value = verb_read | (verb_write << 16), \ |
| 996 | } |
| 997 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 998 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 999 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 1000 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1001 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 1002 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1003 | { } /* end */ |
| 1004 | }; |
| 1005 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1006 | #define DELL_M6_MIXER 6 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1007 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1008 | /* start of config #1 */ |
| 1009 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1010 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1011 | |
| 1012 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1013 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1014 | |
| 1015 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1016 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1017 | |
| 1018 | /* start of config #2 */ |
| 1019 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1020 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1021 | |
| 1022 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1023 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1024 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1025 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1026 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1027 | |
| 1028 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1029 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1030 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1031 | { } /* end */ |
| 1032 | }; |
| 1033 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1034 | static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
| 1035 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1036 | {} |
| 1037 | }; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1038 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1039 | static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { |
| 1040 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1041 | {} |
| 1042 | }; |
| 1043 | |
| 1044 | static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { |
| 1045 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 1046 | {} |
| 1047 | }; |
| 1048 | |
| 1049 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1051 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1052 | |
| 1053 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1054 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1055 | |
| 1056 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1058 | |
| 1059 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1060 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1061 | |
| 1062 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1064 | |
| 1065 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1066 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1067 | |
| 1068 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1069 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1070 | { } /* end */ |
| 1071 | }; |
| 1072 | |
| 1073 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1074 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1075 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1076 | |
| 1077 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1078 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1079 | |
| 1080 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1081 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1082 | |
| 1083 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1084 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1085 | |
| 1086 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1087 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1088 | |
| 1089 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1090 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1091 | |
| 1092 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1093 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1094 | { } /* end */ |
| 1095 | }; |
| 1096 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1097 | |
| 1098 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { |
| 1099 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1100 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1101 | |
| 1102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1103 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1104 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1105 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), |
| 1106 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1107 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1108 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT), |
| 1109 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1110 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1111 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT), |
| 1112 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1113 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1114 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT), |
| 1115 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1116 | |
| 1117 | /* |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1118 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT), |
| 1119 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1120 | */ |
| 1121 | { } /* end */ |
| 1122 | }; |
| 1123 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1124 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 1125 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 1126 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 1127 | |
| 1128 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 1129 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 1130 | /* analog pc-beep replaced with digital beep support */ |
| 1131 | /* |
Matthew Ranostay | f7c5dda | 2008-07-10 17:49:11 +0200 | [diff] [blame] | 1132 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), |
| 1133 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 1134 | */ |
Matthew Ranostay | f7c5dda | 2008-07-10 17:49:11 +0200 | [diff] [blame] | 1135 | |
Matthew Ranostay | 687cb98 | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1136 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), |
| 1137 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1138 | |
Matthew Ranostay | 687cb98 | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1139 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), |
| 1140 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1141 | |
| 1142 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), |
| 1143 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), |
| 1144 | |
| 1145 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), |
| 1146 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1147 | { } /* end */ |
| 1148 | }; |
| 1149 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1150 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
| 1151 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
| 1152 | }; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1153 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1154 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1155 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 1156 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1157 | |
| 1158 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 1159 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1160 | { } /* end */ |
| 1161 | }; |
| 1162 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1163 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 1164 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), |
| 1165 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1166 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
Mauro Carvalho Chehab | 587755f | 2008-05-25 18:20:06 +0200 | [diff] [blame] | 1167 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1168 | { } /* end */ |
| 1169 | }; |
| 1170 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 1171 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1172 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
| 1173 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1174 | |
| 1175 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
| 1176 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1177 | { } /* end */ |
| 1178 | }; |
| 1179 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1180 | static struct snd_kcontrol_new stac9205_loopback[] = { |
| 1181 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
| 1182 | {} |
| 1183 | }; |
| 1184 | |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1185 | /* This needs to be generated dynamically based on sequence */ |
| 1186 | static struct snd_kcontrol_new stac922x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1187 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
| 1188 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1189 | |
| 1190 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
| 1191 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1192 | { } /* end */ |
| 1193 | }; |
| 1194 | |
| 1195 | |
| 1196 | static struct snd_kcontrol_new stac927x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1197 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
| 1198 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1199 | |
| 1200 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1202 | |
| 1203 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1205 | { } /* end */ |
| 1206 | }; |
| 1207 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1208 | static struct snd_kcontrol_new stac927x_loopback[] = { |
| 1209 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
| 1210 | {} |
| 1211 | }; |
| 1212 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1213 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1214 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1215 | .name = "Digital Input Source", |
| 1216 | /* count set later */ |
| 1217 | .info = stac92xx_dmux_enum_info, |
| 1218 | .get = stac92xx_dmux_enum_get, |
| 1219 | .put = stac92xx_dmux_enum_put, |
| 1220 | }; |
| 1221 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1222 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1223 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1224 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1225 | /* count set later */ |
| 1226 | .info = stac92xx_smux_enum_info, |
| 1227 | .get = stac92xx_smux_enum_get, |
| 1228 | .put = stac92xx_smux_enum_put, |
| 1229 | }; |
| 1230 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1231 | static const char *slave_vols[] = { |
| 1232 | "Front Playback Volume", |
| 1233 | "Surround Playback Volume", |
| 1234 | "Center Playback Volume", |
| 1235 | "LFE Playback Volume", |
| 1236 | "Side Playback Volume", |
| 1237 | "Headphone Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1238 | "Speaker Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1239 | NULL |
| 1240 | }; |
| 1241 | |
| 1242 | static const char *slave_sws[] = { |
| 1243 | "Front Playback Switch", |
| 1244 | "Surround Playback Switch", |
| 1245 | "Center Playback Switch", |
| 1246 | "LFE Playback Switch", |
| 1247 | "Side Playback Switch", |
| 1248 | "Headphone Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1249 | "Speaker Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1250 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1251 | NULL |
| 1252 | }; |
| 1253 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1254 | static void stac92xx_free_kctls(struct hda_codec *codec); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1255 | static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type); |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1256 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1257 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1258 | { |
| 1259 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1260 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1261 | hda_nid_t nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1262 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1263 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1264 | |
| 1265 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1266 | if (err < 0) |
| 1267 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1268 | |
| 1269 | for (i = 0; i < spec->num_mixers; i++) { |
| 1270 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1271 | if (err < 0) |
| 1272 | return err; |
| 1273 | } |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1274 | if (spec->num_dmuxes > 0) { |
| 1275 | stac_dmux_mixer.count = spec->num_dmuxes; |
Takashi Iwai | d13bd41 | 2008-07-30 15:01:45 +0200 | [diff] [blame] | 1276 | err = snd_hda_ctl_add(codec, |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1277 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1278 | if (err < 0) |
| 1279 | return err; |
| 1280 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1281 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1282 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1283 | struct hda_input_mux *smux = &spec->private_smux; |
| 1284 | /* check for mute support on SPDIF out */ |
| 1285 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 1286 | smux->items[smux->num_items].label = "Off"; |
| 1287 | smux->items[smux->num_items].index = 0; |
| 1288 | smux->num_items++; |
| 1289 | spec->spdif_mute = 1; |
| 1290 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1291 | stac_smux_mixer.count = spec->num_smuxes; |
Takashi Iwai | 4f2d23e | 2008-12-19 10:14:13 +0100 | [diff] [blame] | 1292 | err = snd_hda_ctl_add(codec, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1293 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1294 | if (err < 0) |
| 1295 | return err; |
| 1296 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1297 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1298 | if (spec->multiout.dig_out_nid) { |
| 1299 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 1300 | if (err < 0) |
| 1301 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1302 | err = snd_hda_create_spdif_share_sw(codec, |
| 1303 | &spec->multiout); |
| 1304 | if (err < 0) |
| 1305 | return err; |
| 1306 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1307 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1308 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1309 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1310 | if (err < 0) |
| 1311 | return err; |
| 1312 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1313 | |
| 1314 | /* if we have no master control, let's create it */ |
| 1315 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1316 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1317 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1318 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 1319 | /* correct volume offset */ |
| 1320 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1321 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1322 | vmaster_tlv, slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1323 | if (err < 0) |
| 1324 | return err; |
| 1325 | } |
| 1326 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1327 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1328 | NULL, slave_sws); |
| 1329 | if (err < 0) |
| 1330 | return err; |
| 1331 | } |
| 1332 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1333 | if (spec->aloopback_ctl && |
| 1334 | snd_hda_get_bool_hint(codec, "loopback") == 1) { |
| 1335 | err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); |
| 1336 | if (err < 0) |
| 1337 | return err; |
| 1338 | } |
| 1339 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1340 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1341 | |
| 1342 | /* create jack input elements */ |
| 1343 | if (spec->hp_detect) { |
| 1344 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1345 | int type = SND_JACK_HEADPHONE; |
| 1346 | nid = cfg->hp_pins[i]; |
| 1347 | /* jack detection */ |
| 1348 | if (cfg->hp_outs == i) |
| 1349 | type |= SND_JACK_LINEOUT; |
| 1350 | err = stac92xx_add_jack(codec, nid, type); |
| 1351 | if (err < 0) |
| 1352 | return err; |
| 1353 | } |
| 1354 | } |
| 1355 | for (i = 0; i < cfg->line_outs; i++) { |
| 1356 | err = stac92xx_add_jack(codec, cfg->line_out_pins[i], |
| 1357 | SND_JACK_LINEOUT); |
| 1358 | if (err < 0) |
| 1359 | return err; |
| 1360 | } |
| 1361 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 1362 | nid = cfg->input_pins[i]; |
| 1363 | if (nid) { |
| 1364 | err = stac92xx_add_jack(codec, nid, |
| 1365 | SND_JACK_MICROPHONE); |
| 1366 | if (err < 0) |
| 1367 | return err; |
| 1368 | } |
| 1369 | } |
| 1370 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1371 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1372 | } |
| 1373 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1374 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1375 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1376 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1377 | }; |
| 1378 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1379 | static unsigned int gateway9200_m4_pin_configs[8] = { |
| 1380 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1381 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1382 | }; |
| 1383 | static unsigned int gateway9200_m4_2_pin_configs[8] = { |
| 1384 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1385 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1386 | }; |
| 1387 | |
| 1388 | /* |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1389 | STAC 9200 pin configs for |
| 1390 | 102801A8 |
| 1391 | 102801DE |
| 1392 | 102801E8 |
| 1393 | */ |
| 1394 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1395 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1396 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1397 | }; |
| 1398 | |
| 1399 | /* |
| 1400 | STAC 9200 pin configs for |
| 1401 | 102801C0 |
| 1402 | 102801C1 |
| 1403 | */ |
| 1404 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1405 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1406 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1407 | }; |
| 1408 | |
| 1409 | /* |
| 1410 | STAC 9200 pin configs for |
| 1411 | 102801C4 (Dell Dimension E310) |
| 1412 | 102801C5 |
| 1413 | 102801C7 |
| 1414 | 102801D9 |
| 1415 | 102801DA |
| 1416 | 102801E3 |
| 1417 | */ |
| 1418 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1419 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1420 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1421 | }; |
| 1422 | |
| 1423 | |
| 1424 | /* |
| 1425 | STAC 9200-32 pin configs for |
| 1426 | 102801B5 (Dell Inspiron 630m) |
| 1427 | 102801D8 (Dell Inspiron 640m) |
| 1428 | */ |
| 1429 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1430 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1431 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1432 | }; |
| 1433 | |
| 1434 | /* |
| 1435 | STAC 9200-32 pin configs for |
| 1436 | 102801C2 (Dell Latitude D620) |
| 1437 | 102801C8 |
| 1438 | 102801CC (Dell Latitude D820) |
| 1439 | 102801D4 |
| 1440 | 102801D6 |
| 1441 | */ |
| 1442 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1443 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1444 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1445 | }; |
| 1446 | |
| 1447 | /* |
| 1448 | STAC 9200-32 pin configs for |
| 1449 | 102801CE (Dell XPS M1710) |
| 1450 | 102801CF (Dell Precision M90) |
| 1451 | */ |
| 1452 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 1453 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1454 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1455 | }; |
| 1456 | |
| 1457 | /* |
| 1458 | STAC 9200-32 pin configs for |
| 1459 | 102801C9 |
| 1460 | 102801CA |
| 1461 | 102801CB (Dell Latitude 120L) |
| 1462 | 102801D3 |
| 1463 | */ |
| 1464 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1465 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1466 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1467 | }; |
| 1468 | |
| 1469 | /* |
| 1470 | STAC 9200-32 pin configs for |
| 1471 | 102801BD (Dell Inspiron E1505n) |
| 1472 | 102801EE |
| 1473 | 102801EF |
| 1474 | */ |
| 1475 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1476 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1477 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1478 | }; |
| 1479 | |
| 1480 | /* |
| 1481 | STAC 9200-32 pin configs for |
| 1482 | 102801F5 (Dell Inspiron 1501) |
| 1483 | 102801F6 |
| 1484 | */ |
| 1485 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1486 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1487 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1488 | }; |
| 1489 | |
| 1490 | /* |
| 1491 | STAC 9200-32 |
| 1492 | 102801CD (Dell Inspiron E1705/9400) |
| 1493 | */ |
| 1494 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1495 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1496 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1497 | }; |
| 1498 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1499 | static unsigned int oqo9200_pin_configs[8] = { |
| 1500 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1501 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1502 | }; |
| 1503 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1504 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1505 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 1506 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1507 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1508 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1509 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1510 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1511 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1512 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1513 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1514 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1515 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1516 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1517 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1518 | [STAC_9200_M4] = gateway9200_m4_pin_configs, |
| 1519 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1520 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1521 | }; |
| 1522 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1523 | static const char *stac9200_models[STAC_9200_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1524 | [STAC_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1525 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1526 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1527 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1528 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1529 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1530 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1531 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1532 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1533 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1534 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1535 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1536 | [STAC_9200_DELL_M27] = "dell-m27", |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1537 | [STAC_9200_M4] = "gateway-m4", |
| 1538 | [STAC_9200_M4_2] = "gateway-m4-2", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1539 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1540 | }; |
| 1541 | |
| 1542 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 1543 | /* SigmaTel reference board */ |
| 1544 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1545 | "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1546 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1547 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1548 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1549 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1550 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1551 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1552 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1553 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1554 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1555 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1556 | "unknown Dell", STAC_9200_DELL_D22), |
| 1557 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1558 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1559 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1560 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1561 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1562 | "unknown Dell", STAC_9200_DELL_D23), |
| 1563 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1564 | "unknown Dell", STAC_9200_DELL_D23), |
| 1565 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1566 | "unknown Dell", STAC_9200_DELL_M22), |
| 1567 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1568 | "unknown Dell", STAC_9200_DELL_M24), |
| 1569 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1570 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1571 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1572 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1573 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1574 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1575 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1576 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1577 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1578 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1579 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1580 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1581 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1582 | "unknown Dell", STAC_9200_DELL_M22), |
| 1583 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1584 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1585 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1586 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1587 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1588 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1589 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1590 | "unknown Dell", STAC_9200_DELL_D23), |
| 1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1592 | "unknown Dell", STAC_9200_DELL_D23), |
| 1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1594 | "unknown Dell", STAC_9200_DELL_D21), |
| 1595 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1596 | "unknown Dell", STAC_9200_DELL_D23), |
| 1597 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1598 | "unknown Dell", STAC_9200_DELL_D21), |
| 1599 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1600 | "unknown Dell", STAC_9200_DELL_M25), |
| 1601 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1602 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1603 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1604 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1605 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1606 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1607 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1608 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1609 | /* Gateway machines needs EAPD to be set on resume */ |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1610 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
| 1611 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
| 1612 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1613 | /* OQO Mobile */ |
| 1614 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1615 | {} /* terminator */ |
| 1616 | }; |
| 1617 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1618 | static unsigned int ref925x_pin_configs[8] = { |
| 1619 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1620 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1621 | }; |
| 1622 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1623 | static unsigned int stac925xM1_pin_configs[8] = { |
| 1624 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1625 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1626 | }; |
| 1627 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1628 | static unsigned int stac925xM1_2_pin_configs[8] = { |
| 1629 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1630 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1631 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1632 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1633 | static unsigned int stac925xM2_pin_configs[8] = { |
| 1634 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1635 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1636 | }; |
| 1637 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1638 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1639 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1640 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1641 | }; |
| 1642 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1643 | static unsigned int stac925xM3_pin_configs[8] = { |
| 1644 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1645 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, |
| 1646 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1647 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1648 | static unsigned int stac925xM5_pin_configs[8] = { |
| 1649 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1650 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1651 | }; |
| 1652 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1653 | static unsigned int stac925xM6_pin_configs[8] = { |
| 1654 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1655 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1656 | }; |
| 1657 | |
| 1658 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 1659 | [STAC_REF] = ref925x_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1660 | [STAC_M1] = stac925xM1_pin_configs, |
| 1661 | [STAC_M1_2] = stac925xM1_2_pin_configs, |
| 1662 | [STAC_M2] = stac925xM2_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1663 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1664 | [STAC_M3] = stac925xM3_pin_configs, |
| 1665 | [STAC_M5] = stac925xM5_pin_configs, |
| 1666 | [STAC_M6] = stac925xM6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1667 | }; |
| 1668 | |
| 1669 | static const char *stac925x_models[STAC_925x_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1670 | [STAC_925x_AUTO] = "auto", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1671 | [STAC_REF] = "ref", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1672 | [STAC_M1] = "m1", |
| 1673 | [STAC_M1_2] = "m1-2", |
| 1674 | [STAC_M2] = "m2", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1675 | [STAC_M2_2] = "m2-2", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1676 | [STAC_M3] = "m3", |
| 1677 | [STAC_M5] = "m5", |
| 1678 | [STAC_M6] = "m6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1679 | }; |
| 1680 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1681 | static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1682 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), |
| 1683 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), |
| 1684 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), |
| 1685 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1686 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1687 | /* Not sure about the brand name for those */ |
| 1688 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), |
| 1689 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), |
| 1690 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), |
| 1691 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1692 | {} /* terminator */ |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1693 | }; |
| 1694 | |
| 1695 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 1696 | /* SigmaTel reference board */ |
| 1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1698 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1699 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1700 | |
| 1701 | /* Default table for unknown ID */ |
| 1702 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
| 1703 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1704 | {} /* terminator */ |
| 1705 | }; |
| 1706 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1707 | static unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1708 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1709 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1710 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1711 | 0x01452050, |
| 1712 | }; |
| 1713 | |
| 1714 | static unsigned int dell_m6_pin_configs[13] = { |
| 1715 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1716 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1717 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1718 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1719 | }; |
| 1720 | |
| 1721 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1722 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1723 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
| 1724 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
| 1725 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1726 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1727 | }; |
| 1728 | |
| 1729 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1730 | [STAC_92HD73XX_AUTO] = "auto", |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 1731 | [STAC_92HD73XX_NO_JD] = "no-jd", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1732 | [STAC_92HD73XX_REF] = "ref", |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1733 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
| 1734 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
| 1735 | [STAC_DELL_M6_BOTH] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1736 | [STAC_DELL_EQ] = "dell-eq", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1737 | }; |
| 1738 | |
| 1739 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
| 1740 | /* SigmaTel reference board */ |
| 1741 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1742 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1743 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1744 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1745 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1746 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1747 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1748 | "unknown Dell", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1749 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1750 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1751 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1752 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1753 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1754 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1755 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1756 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1757 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1758 | "unknown Dell", STAC_DELL_M6_DMIC), |
| 1759 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, |
| 1760 | "unknown Dell", STAC_DELL_M6_DMIC), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1761 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1762 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
Joerg Schirottke | fa620e9 | 2008-12-19 08:13:49 +0100 | [diff] [blame] | 1763 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, |
| 1764 | "Dell Studio 17", STAC_DELL_M6_DMIC), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1765 | {} /* terminator */ |
| 1766 | }; |
| 1767 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1768 | static unsigned int ref92hd83xxx_pin_configs[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1769 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1770 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1771 | 0x01451160, 0x98560170, |
| 1772 | }; |
| 1773 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1774 | static unsigned int dell_s14_pin_configs[10] = { |
| 1775 | 0x02214030, 0x02211010, 0x02a19020, 0x01014050, |
| 1776 | 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160, |
| 1777 | 0x40f000f0, 0x40f000f0, |
| 1778 | }; |
| 1779 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1780 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
| 1781 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1782 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1783 | [STAC_DELL_S14] = dell_s14_pin_configs, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1784 | }; |
| 1785 | |
| 1786 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1787 | [STAC_92HD83XXX_AUTO] = "auto", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1788 | [STAC_92HD83XXX_REF] = "ref", |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1789 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1790 | [STAC_DELL_S14] = "dell-s14", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1791 | }; |
| 1792 | |
| 1793 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
| 1794 | /* SigmaTel reference board */ |
| 1795 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Takashi Iwai | f9d088b | 2009-01-13 11:54:49 +0100 | [diff] [blame] | 1796 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1797 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1798 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1799 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
| 1800 | "unknown Dell", STAC_DELL_S14), |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 1801 | {} /* terminator */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1802 | }; |
| 1803 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1804 | static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1805 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1806 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1807 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
| 1808 | 0x00000000 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1809 | }; |
| 1810 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1811 | static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1812 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1813 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1814 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
| 1815 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1816 | }; |
| 1817 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1818 | static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1819 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1820 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1821 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1822 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1823 | }; |
| 1824 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1825 | static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1826 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1827 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1828 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1829 | 0x00000000 |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1830 | }; |
| 1831 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1832 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
| 1833 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1834 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1835 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1836 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1837 | [STAC_HP_M4] = NULL, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1838 | [STAC_HP_DV5] = NULL, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1839 | [STAC_HP_HDX] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1840 | }; |
| 1841 | |
| 1842 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1843 | [STAC_92HD71BXX_AUTO] = "auto", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1844 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1845 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1846 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1847 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1848 | [STAC_HP_M4] = "hp-m4", |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1849 | [STAC_HP_DV5] = "hp-dv5", |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1850 | [STAC_HP_HDX] = "hp-hdx", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1851 | }; |
| 1852 | |
| 1853 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
| 1854 | /* SigmaTel reference board */ |
| 1855 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1856 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1857 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1858 | "DFI LanParty", STAC_92HD71BXX_REF), |
Takashi Iwai | 58d8395 | 2009-03-13 17:04:34 +0100 | [diff] [blame] | 1859 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
| 1860 | "HP", STAC_HP_DV5), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1861 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
| 1862 | "HP dv4-7", STAC_HP_DV5), |
| 1863 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, |
| 1864 | "HP dv4-7", STAC_HP_DV5), |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1865 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, |
| 1866 | "HP HDX", STAC_HP_HDX), /* HDX18 */ |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1867 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1868 | "HP mini 1000", STAC_HP_M4), |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1869 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1870 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1871 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1872 | "unknown Dell", STAC_DELL_M4_1), |
| 1873 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1874 | "unknown Dell", STAC_DELL_M4_1), |
| 1875 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1876 | "unknown Dell", STAC_DELL_M4_1), |
| 1877 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1878 | "unknown Dell", STAC_DELL_M4_1), |
| 1879 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1880 | "unknown Dell", STAC_DELL_M4_1), |
| 1881 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1882 | "unknown Dell", STAC_DELL_M4_1), |
| 1883 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1884 | "unknown Dell", STAC_DELL_M4_1), |
| 1885 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1886 | "unknown Dell", STAC_DELL_M4_2), |
| 1887 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1888 | "unknown Dell", STAC_DELL_M4_2), |
| 1889 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1890 | "unknown Dell", STAC_DELL_M4_2), |
| 1891 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1892 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1893 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1894 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1895 | {} /* terminator */ |
| 1896 | }; |
| 1897 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1898 | static unsigned int ref922x_pin_configs[10] = { |
| 1899 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1900 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1901 | 0x40000100, 0x40000100, |
| 1902 | }; |
| 1903 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1904 | /* |
| 1905 | STAC 922X pin configs for |
| 1906 | 102801A7 |
| 1907 | 102801AB |
| 1908 | 102801A9 |
| 1909 | 102801D1 |
| 1910 | 102801D2 |
| 1911 | */ |
| 1912 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 1913 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1914 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1915 | 0x01813122, 0x400001f2, |
| 1916 | }; |
| 1917 | |
| 1918 | /* |
| 1919 | STAC 922X pin configs for |
| 1920 | 102801AC |
| 1921 | 102801D0 |
| 1922 | */ |
| 1923 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 1924 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1925 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1926 | 0x01813122, 0x400001f1, |
| 1927 | }; |
| 1928 | |
| 1929 | /* |
| 1930 | STAC 922X pin configs for |
| 1931 | 102801BF |
| 1932 | */ |
| 1933 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 1934 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1935 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1936 | 0x40C003f1, 0x405003f0, |
| 1937 | }; |
| 1938 | |
| 1939 | /* |
| 1940 | STAC 9221 A1 pin configs for |
| 1941 | 102801D7 (Dell XPS M1210) |
| 1942 | */ |
| 1943 | static unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1944 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1945 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1946 | 0x508003f3, 0x405003f4, |
| 1947 | }; |
| 1948 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1949 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1950 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1951 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1952 | 0x02a19120, 0x40000100, |
| 1953 | }; |
| 1954 | |
| 1955 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1956 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1957 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1958 | 0x02a19320, 0x40000100, |
| 1959 | }; |
| 1960 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1961 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 1962 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1963 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1964 | 0x400000fc, 0x400000fb, |
| 1965 | }; |
| 1966 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1967 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 1968 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1969 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1970 | 0x400000fc, 0x400000fb, |
| 1971 | }; |
| 1972 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1973 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 1974 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1975 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1976 | 0x400000fc, 0x400000fb, |
| 1977 | }; |
| 1978 | |
| 1979 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 1980 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1981 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1982 | 0x400000fc, 0x400000fb, |
| 1983 | }; |
| 1984 | |
| 1985 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 1986 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1987 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1988 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1989 | }; |
| 1990 | |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1991 | static unsigned int ecs202_pin_configs[10] = { |
| 1992 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 1993 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 1994 | 0x9037012e, 0x40e000f2, |
| 1995 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1996 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1997 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1998 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1999 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 2000 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2001 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 2002 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 2003 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 2004 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 2005 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2006 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2007 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2008 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 2009 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 2010 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 2011 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 2012 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 2013 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2014 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2015 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 2016 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 2017 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 2018 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2019 | }; |
| 2020 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2021 | static const char *stac922x_models[STAC_922X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2022 | [STAC_922X_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2023 | [STAC_D945_REF] = "ref", |
| 2024 | [STAC_D945GTP5] = "5stack", |
| 2025 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2026 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 2027 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 2028 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 2029 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 2030 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2031 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2032 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2033 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2034 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 2035 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 2036 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 2037 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 2038 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2039 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2040 | [STAC_922X_DELL_D81] = "dell-d81", |
| 2041 | [STAC_922X_DELL_D82] = "dell-d82", |
| 2042 | [STAC_922X_DELL_M81] = "dell-m81", |
| 2043 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2044 | }; |
| 2045 | |
| 2046 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 2047 | /* SigmaTel reference board */ |
| 2048 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2049 | "DFI LanParty", STAC_D945_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2050 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2051 | "DFI LanParty", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2052 | /* Intel 945G based systems */ |
| 2053 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 2054 | "Intel D945G", STAC_D945GTP3), |
| 2055 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 2056 | "Intel D945G", STAC_D945GTP3), |
| 2057 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 2058 | "Intel D945G", STAC_D945GTP3), |
| 2059 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 2060 | "Intel D945G", STAC_D945GTP3), |
| 2061 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 2062 | "Intel D945G", STAC_D945GTP3), |
| 2063 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 2064 | "Intel D945G", STAC_D945GTP3), |
| 2065 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 2066 | "Intel D945G", STAC_D945GTP3), |
| 2067 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 2068 | "Intel D945G", STAC_D945GTP3), |
| 2069 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 2070 | "Intel D945G", STAC_D945GTP3), |
| 2071 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 2072 | "Intel D945G", STAC_D945GTP3), |
| 2073 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 2074 | "Intel D945G", STAC_D945GTP3), |
| 2075 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 2076 | "Intel D945G", STAC_D945GTP3), |
| 2077 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 2078 | "Intel D945G", STAC_D945GTP3), |
| 2079 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 2080 | "Intel D945G", STAC_D945GTP3), |
| 2081 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 2082 | "Intel D945G", STAC_D945GTP3), |
| 2083 | /* Intel D945G 5-stack systems */ |
| 2084 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 2085 | "Intel D945G", STAC_D945GTP5), |
| 2086 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 2087 | "Intel D945G", STAC_D945GTP5), |
| 2088 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 2089 | "Intel D945G", STAC_D945GTP5), |
| 2090 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 2091 | "Intel D945G", STAC_D945GTP5), |
| 2092 | /* Intel 945P based systems */ |
| 2093 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 2094 | "Intel D945P", STAC_D945GTP3), |
| 2095 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 2096 | "Intel D945P", STAC_D945GTP3), |
| 2097 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 2098 | "Intel D945P", STAC_D945GTP3), |
| 2099 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 2100 | "Intel D945P", STAC_D945GTP3), |
| 2101 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 2102 | "Intel D945P", STAC_D945GTP3), |
| 2103 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 2104 | "Intel D945P", STAC_D945GTP5), |
Takashi Iwai | 8056d47 | 2009-01-23 09:09:43 +0100 | [diff] [blame] | 2105 | /* other intel */ |
| 2106 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, |
| 2107 | "Intel D945", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2108 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2109 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2110 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2111 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2112 | /* Dell systems */ |
| 2113 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2114 | "unknown Dell", STAC_922X_DELL_D81), |
| 2115 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2116 | "unknown Dell", STAC_922X_DELL_D81), |
| 2117 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2118 | "unknown Dell", STAC_922X_DELL_D81), |
| 2119 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2120 | "unknown Dell", STAC_922X_DELL_D82), |
| 2121 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2122 | "unknown Dell", STAC_922X_DELL_M81), |
| 2123 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2124 | "unknown Dell", STAC_922X_DELL_D82), |
| 2125 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2126 | "unknown Dell", STAC_922X_DELL_D81), |
| 2127 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2128 | "unknown Dell", STAC_922X_DELL_D81), |
| 2129 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2130 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2131 | /* ECS/PC Chips boards */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2132 | SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, |
Herton Ronaldo Krzesinski | 8663ae5 | 2009-02-08 19:50:34 -0200 | [diff] [blame] | 2133 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2134 | {} /* terminator */ |
| 2135 | }; |
| 2136 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2137 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2138 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2139 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2140 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2141 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2142 | }; |
| 2143 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2144 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2145 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2146 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2147 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2148 | 0x40000100, 0x40000100 |
| 2149 | }; |
| 2150 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2151 | static unsigned int d965_5st_pin_configs[14] = { |
| 2152 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2153 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2154 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2155 | 0x40000100, 0x40000100 |
| 2156 | }; |
| 2157 | |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame^] | 2158 | static unsigned int d965_5st_no_fp_pin_configs[14] = { |
| 2159 | 0x40000100, 0x40000100, 0x0181304e, 0x01014010, |
| 2160 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2161 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2162 | 0x40000100, 0x40000100 |
| 2163 | }; |
| 2164 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2165 | static unsigned int dell_3st_pin_configs[14] = { |
| 2166 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2167 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2168 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2169 | 0x40c003fc, 0x40000100 |
| 2170 | }; |
| 2171 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2172 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2173 | [STAC_D965_REF_NO_JD] = ref927x_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2174 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2175 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2176 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame^] | 2177 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2178 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2179 | [STAC_DELL_BIOS] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2180 | }; |
| 2181 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2182 | static const char *stac927x_models[STAC_927X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2183 | [STAC_927X_AUTO] = "auto", |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2184 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2185 | [STAC_D965_REF] = "ref", |
| 2186 | [STAC_D965_3ST] = "3stack", |
| 2187 | [STAC_D965_5ST] = "5stack", |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame^] | 2188 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2189 | [STAC_DELL_3ST] = "dell-3stack", |
| 2190 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2191 | }; |
| 2192 | |
| 2193 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 2194 | /* SigmaTel reference board */ |
| 2195 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2196 | "DFI LanParty", STAC_D965_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2197 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2198 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2199 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2200 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2201 | 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] | 2202 | /* 965 based 3 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2203 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, |
| 2204 | "Intel D965", STAC_D965_3ST), |
| 2205 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, |
| 2206 | "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2207 | /* Dell 3 stack systems */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2208 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2209 | 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] | 2210 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2211 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2212 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2213 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
| 2214 | 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] | 2215 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Takashi Iwai | 24918b6 | 2008-09-30 12:58:54 +0200 | [diff] [blame] | 2216 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2217 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2218 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2219 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2220 | 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] | 2221 | /* 965 based 5 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2222 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, |
| 2223 | "Intel D965", STAC_D965_5ST), |
| 2224 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
| 2225 | "Intel D965", STAC_D965_5ST), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2226 | {} /* terminator */ |
| 2227 | }; |
| 2228 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2229 | static unsigned int ref9205_pin_configs[12] = { |
| 2230 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2231 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2232 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2233 | }; |
| 2234 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2235 | /* |
| 2236 | STAC 9205 pin configs for |
| 2237 | 102801F1 |
| 2238 | 102801F2 |
| 2239 | 102801FC |
| 2240 | 102801FD |
| 2241 | 10280204 |
| 2242 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2243 | 10280228 (Dell Vostro 1500) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2244 | */ |
| 2245 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 2246 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2247 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2248 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2249 | }; |
| 2250 | |
| 2251 | /* |
| 2252 | STAC 9205 pin configs for |
| 2253 | 102801F9 |
| 2254 | 102801FA |
| 2255 | 102801FE |
| 2256 | 102801FF (Dell Precision M4300) |
| 2257 | 10280206 |
| 2258 | 10280200 |
| 2259 | 10280201 |
| 2260 | */ |
| 2261 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2262 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2263 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2264 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2265 | }; |
| 2266 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2267 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2268 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2269 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2270 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2271 | }; |
| 2272 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2273 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2274 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2275 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2276 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2277 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2278 | [STAC_9205_EAPD] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2279 | }; |
| 2280 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2281 | static const char *stac9205_models[STAC_9205_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2282 | [STAC_9205_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2283 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2284 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2285 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2286 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2287 | [STAC_9205_EAPD] = "eapd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2288 | }; |
| 2289 | |
| 2290 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 2291 | /* SigmaTel reference board */ |
| 2292 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2293 | "DFI LanParty", STAC_9205_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2294 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2295 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2296 | /* Dell */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2297 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2298 | "unknown Dell", STAC_9205_DELL_M42), |
| 2299 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2300 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2301 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2302 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2303 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2304 | "Dell Precision", STAC_9205_DELL_M43), |
| 2305 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2306 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2307 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2308 | "unknown Dell", STAC_9205_DELL_M42), |
| 2309 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2310 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2311 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2312 | "Dell Precision", STAC_9205_DELL_M43), |
| 2313 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2314 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2315 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2316 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2317 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2318 | "Dell Precision", STAC_9205_DELL_M43), |
| 2319 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2320 | "Dell Precision", STAC_9205_DELL_M43), |
| 2321 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2322 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2323 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2324 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2325 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2326 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2327 | /* Gateway */ |
| 2328 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2329 | {} /* terminator */ |
| 2330 | }; |
| 2331 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2332 | static void stac92xx_set_config_regs(struct hda_codec *codec, |
| 2333 | unsigned int *pincfgs) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2334 | { |
| 2335 | int i; |
| 2336 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2337 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2338 | if (!pincfgs) |
| 2339 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2340 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2341 | for (i = 0; i < spec->num_pins; i++) |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2342 | if (spec->pin_nids[i] && pincfgs[i]) |
| 2343 | snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], |
| 2344 | pincfgs[i]); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2345 | } |
| 2346 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2347 | /* |
| 2348 | * Analog playback callbacks |
| 2349 | */ |
| 2350 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2351 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2352 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2353 | { |
| 2354 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2355 | if (spec->stream_delay) |
| 2356 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2357 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2358 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2359 | } |
| 2360 | |
| 2361 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2362 | struct hda_codec *codec, |
| 2363 | unsigned int stream_tag, |
| 2364 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2365 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2366 | { |
| 2367 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2368 | 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] | 2369 | } |
| 2370 | |
| 2371 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2372 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2373 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2374 | { |
| 2375 | struct sigmatel_spec *spec = codec->spec; |
| 2376 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2377 | } |
| 2378 | |
| 2379 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2380 | * Digital playback callbacks |
| 2381 | */ |
| 2382 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2383 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2384 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2385 | { |
| 2386 | struct sigmatel_spec *spec = codec->spec; |
| 2387 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2388 | } |
| 2389 | |
| 2390 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2391 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2392 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2393 | { |
| 2394 | struct sigmatel_spec *spec = codec->spec; |
| 2395 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2396 | } |
| 2397 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2398 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2399 | struct hda_codec *codec, |
| 2400 | unsigned int stream_tag, |
| 2401 | unsigned int format, |
| 2402 | struct snd_pcm_substream *substream) |
| 2403 | { |
| 2404 | struct sigmatel_spec *spec = codec->spec; |
| 2405 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2406 | stream_tag, format, substream); |
| 2407 | } |
| 2408 | |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2409 | static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2410 | struct hda_codec *codec, |
| 2411 | struct snd_pcm_substream *substream) |
| 2412 | { |
| 2413 | struct sigmatel_spec *spec = codec->spec; |
| 2414 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2415 | } |
| 2416 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2417 | |
| 2418 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2419 | * Analog capture callbacks |
| 2420 | */ |
| 2421 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2422 | struct hda_codec *codec, |
| 2423 | unsigned int stream_tag, |
| 2424 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2425 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2426 | { |
| 2427 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2428 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2429 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2430 | if (spec->powerdown_adcs) { |
| 2431 | msleep(40); |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2432 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2433 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2434 | } |
| 2435 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2436 | return 0; |
| 2437 | } |
| 2438 | |
| 2439 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2440 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2441 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2442 | { |
| 2443 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2444 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2445 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2446 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2447 | if (spec->powerdown_adcs) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2448 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2449 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2450 | return 0; |
| 2451 | } |
| 2452 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2453 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 2454 | .substreams = 1, |
| 2455 | .channels_min = 2, |
| 2456 | .channels_max = 2, |
| 2457 | /* NID is set in stac92xx_build_pcms */ |
| 2458 | .ops = { |
| 2459 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2460 | .close = stac92xx_dig_playback_pcm_close, |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2461 | .prepare = stac92xx_dig_playback_pcm_prepare, |
| 2462 | .cleanup = stac92xx_dig_playback_pcm_cleanup |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2463 | }, |
| 2464 | }; |
| 2465 | |
| 2466 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 2467 | .substreams = 1, |
| 2468 | .channels_min = 2, |
| 2469 | .channels_max = 2, |
| 2470 | /* NID is set in stac92xx_build_pcms */ |
| 2471 | }; |
| 2472 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2473 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 2474 | .substreams = 1, |
| 2475 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2476 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2477 | .nid = 0x02, /* NID to query formats and rates */ |
| 2478 | .ops = { |
| 2479 | .open = stac92xx_playback_pcm_open, |
| 2480 | .prepare = stac92xx_playback_pcm_prepare, |
| 2481 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2482 | }, |
| 2483 | }; |
| 2484 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2485 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 2486 | .substreams = 1, |
| 2487 | .channels_min = 2, |
| 2488 | .channels_max = 2, |
| 2489 | .nid = 0x06, /* NID to query formats and rates */ |
| 2490 | .ops = { |
| 2491 | .open = stac92xx_playback_pcm_open, |
| 2492 | .prepare = stac92xx_playback_pcm_prepare, |
| 2493 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2494 | }, |
| 2495 | }; |
| 2496 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2497 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2498 | .channels_min = 2, |
| 2499 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2500 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2501 | .ops = { |
| 2502 | .prepare = stac92xx_capture_pcm_prepare, |
| 2503 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2504 | }, |
| 2505 | }; |
| 2506 | |
| 2507 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2508 | { |
| 2509 | struct sigmatel_spec *spec = codec->spec; |
| 2510 | struct hda_pcm *info = spec->pcm_rec; |
| 2511 | |
| 2512 | codec->num_pcms = 1; |
| 2513 | codec->pcm_info = info; |
| 2514 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2515 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2516 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Takashi Iwai | 00a602d | 2009-01-23 11:55:42 +0100 | [diff] [blame] | 2517 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2518 | spec->multiout.dac_nids[0]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2519 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2520 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2521 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2522 | |
| 2523 | if (spec->alt_switch) { |
| 2524 | codec->num_pcms++; |
| 2525 | info++; |
| 2526 | info->name = "STAC92xx Analog Alt"; |
| 2527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2528 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2529 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2530 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2531 | codec->num_pcms++; |
| 2532 | info++; |
| 2533 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 2534 | info->pcm_type = spec->autocfg.dig_out_type[0]; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2535 | if (spec->multiout.dig_out_nid) { |
| 2536 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2537 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2538 | } |
| 2539 | if (spec->dig_in_nid) { |
| 2540 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2541 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2542 | } |
| 2543 | } |
| 2544 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2545 | return 0; |
| 2546 | } |
| 2547 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2548 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 2549 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2550 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2551 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2552 | if (pincap & AC_PINCAP_VREF_100) |
| 2553 | return AC_PINCTL_VREF_100; |
| 2554 | if (pincap & AC_PINCAP_VREF_80) |
| 2555 | return AC_PINCTL_VREF_80; |
| 2556 | if (pincap & AC_PINCAP_VREF_50) |
| 2557 | return AC_PINCTL_VREF_50; |
| 2558 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2559 | return AC_PINCTL_VREF_GRD; |
| 2560 | return 0; |
| 2561 | } |
| 2562 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2563 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2564 | |
| 2565 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2566 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2567 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2568 | } |
| 2569 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2570 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2571 | |
| 2572 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2573 | struct snd_ctl_elem_value *ucontrol) |
| 2574 | { |
| 2575 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2576 | struct sigmatel_spec *spec = codec->spec; |
| 2577 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2578 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2579 | return 0; |
| 2580 | } |
| 2581 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2582 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 2583 | unsigned char type); |
| 2584 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2585 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2586 | struct snd_ctl_elem_value *ucontrol) |
| 2587 | { |
| 2588 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2589 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2590 | int nid = kcontrol->private_value; |
| 2591 | |
| 2592 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2593 | |
| 2594 | /* check to be sure that the ports are upto date with |
| 2595 | * switch changes |
| 2596 | */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2597 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2598 | |
| 2599 | return 1; |
| 2600 | } |
| 2601 | |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 2602 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2603 | |
| 2604 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2605 | { |
| 2606 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2607 | struct sigmatel_spec *spec = codec->spec; |
| 2608 | int io_idx = kcontrol-> private_value & 0xff; |
| 2609 | |
| 2610 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 2611 | return 0; |
| 2612 | } |
| 2613 | |
| 2614 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2615 | { |
| 2616 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2617 | struct sigmatel_spec *spec = codec->spec; |
| 2618 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 2619 | int io_idx = kcontrol-> private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2620 | unsigned short val = !!ucontrol->value.integer.value[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2621 | |
| 2622 | spec->io_switch[io_idx] = val; |
| 2623 | |
| 2624 | if (val) |
| 2625 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2626 | else { |
| 2627 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2628 | if (io_idx) /* set VREF for mic */ |
| 2629 | pinctl |= stac92xx_get_vref(codec, nid); |
| 2630 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2631 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2632 | |
| 2633 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2634 | * appropriately according to the pin direction |
| 2635 | */ |
| 2636 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2637 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2638 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2639 | return 1; |
| 2640 | } |
| 2641 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2642 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2643 | |
| 2644 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2645 | struct snd_ctl_elem_value *ucontrol) |
| 2646 | { |
| 2647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2648 | struct sigmatel_spec *spec = codec->spec; |
| 2649 | |
| 2650 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2651 | return 0; |
| 2652 | } |
| 2653 | |
| 2654 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2655 | struct snd_ctl_elem_value *ucontrol) |
| 2656 | { |
| 2657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2658 | struct sigmatel_spec *spec = codec->spec; |
| 2659 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2660 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2661 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2662 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2663 | return 0; |
| 2664 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2665 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2666 | |
| 2667 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2668 | spec->clfe_swap ? 0x4 : 0x0); |
| 2669 | |
| 2670 | return 1; |
| 2671 | } |
| 2672 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2673 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2674 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2675 | .name = xname, \ |
| 2676 | .index = 0, \ |
| 2677 | .info = stac92xx_hp_switch_info, \ |
| 2678 | .get = stac92xx_hp_switch_get, \ |
| 2679 | .put = stac92xx_hp_switch_put, \ |
| 2680 | } |
| 2681 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2682 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2683 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2684 | .name = xname, \ |
| 2685 | .index = 0, \ |
| 2686 | .info = stac92xx_io_switch_info, \ |
| 2687 | .get = stac92xx_io_switch_get, \ |
| 2688 | .put = stac92xx_io_switch_put, \ |
| 2689 | .private_value = xpval, \ |
| 2690 | } |
| 2691 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2692 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2693 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2694 | .name = xname, \ |
| 2695 | .index = 0, \ |
| 2696 | .info = stac92xx_clfe_switch_info, \ |
| 2697 | .get = stac92xx_clfe_switch_get, \ |
| 2698 | .put = stac92xx_clfe_switch_put, \ |
| 2699 | .private_value = xpval, \ |
| 2700 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2701 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2702 | enum { |
| 2703 | STAC_CTL_WIDGET_VOL, |
| 2704 | STAC_CTL_WIDGET_MUTE, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2705 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2706 | STAC_CTL_WIDGET_AMP_MUX, |
| 2707 | STAC_CTL_WIDGET_AMP_VOL, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2708 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2709 | STAC_CTL_WIDGET_IO_SWITCH, |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2710 | STAC_CTL_WIDGET_CLFE_SWITCH |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2711 | }; |
| 2712 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2713 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2714 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2715 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2716 | STAC_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2717 | STAC_AMP_MUX, |
| 2718 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2719 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2720 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2721 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2722 | }; |
| 2723 | |
| 2724 | /* add dynamic controls */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2725 | static struct snd_kcontrol_new * |
| 2726 | stac_control_new(struct sigmatel_spec *spec, |
| 2727 | struct snd_kcontrol_new *ktemp, |
| 2728 | const char *name) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2729 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2730 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2731 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2732 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2733 | knew = snd_array_new(&spec->kctls); |
| 2734 | if (!knew) |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2735 | return NULL; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2736 | *knew = *ktemp; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2737 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2738 | if (!knew->name) { |
| 2739 | /* roolback */ |
| 2740 | memset(knew, 0, sizeof(*knew)); |
| 2741 | spec->kctls.alloced--; |
| 2742 | return NULL; |
| 2743 | } |
| 2744 | return knew; |
| 2745 | } |
| 2746 | |
| 2747 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
| 2748 | struct snd_kcontrol_new *ktemp, |
| 2749 | int idx, const char *name, |
| 2750 | unsigned long val) |
| 2751 | { |
| 2752 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); |
| 2753 | if (!knew) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2754 | return -ENOMEM; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2755 | knew->index = idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2756 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2757 | return 0; |
| 2758 | } |
| 2759 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2760 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2761 | int type, int idx, const char *name, |
| 2762 | unsigned long val) |
| 2763 | { |
| 2764 | return stac92xx_add_control_temp(spec, |
| 2765 | &stac92xx_control_templates[type], |
| 2766 | idx, name, val); |
| 2767 | } |
| 2768 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2769 | |
| 2770 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2771 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2772 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2773 | { |
| 2774 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2775 | } |
| 2776 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2777 | static struct snd_kcontrol_new stac_input_src_temp = { |
| 2778 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2779 | .name = "Input Source", |
| 2780 | .info = stac92xx_mux_enum_info, |
| 2781 | .get = stac92xx_mux_enum_get, |
| 2782 | .put = stac92xx_mux_enum_put, |
| 2783 | }; |
| 2784 | |
| 2785 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) |
| 2786 | { |
| 2787 | struct snd_kcontrol_new *knew; |
| 2788 | struct hda_input_mux *imux = &spec->private_imux; |
| 2789 | |
| 2790 | if (!spec->num_adcs || imux->num_items <= 1) |
| 2791 | return 0; /* no need for input source control */ |
| 2792 | knew = stac_control_new(spec, &stac_input_src_temp, |
| 2793 | stac_input_src_temp.name); |
| 2794 | if (!knew) |
| 2795 | return -ENOMEM; |
| 2796 | knew->count = spec->num_adcs; |
| 2797 | return 0; |
| 2798 | } |
| 2799 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2800 | /* check whether the line-input can be used as line-out */ |
| 2801 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2802 | { |
| 2803 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2804 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2805 | hda_nid_t nid; |
| 2806 | unsigned int pincap; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2807 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2808 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2809 | return 0; |
| 2810 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2811 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2812 | if (pincap & AC_PINCAP_OUT) |
| 2813 | return nid; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2814 | return 0; |
| 2815 | } |
| 2816 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2817 | /* check whether the mic-input can be used as line-out */ |
| 2818 | static hda_nid_t check_mic_out_switch(struct hda_codec *codec) |
| 2819 | { |
| 2820 | struct sigmatel_spec *spec = codec->spec; |
| 2821 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2822 | unsigned int def_conf, pincap; |
| 2823 | unsigned int mic_pin; |
| 2824 | |
| 2825 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2826 | return 0; |
| 2827 | mic_pin = AUTO_PIN_MIC; |
| 2828 | for (;;) { |
| 2829 | hda_nid_t nid = cfg->input_pins[mic_pin]; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2830 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2831 | /* some laptops have an internal analog microphone |
| 2832 | * which can't be used as a output */ |
| 2833 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2834 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2835 | if (pincap & AC_PINCAP_OUT) |
| 2836 | return nid; |
| 2837 | } |
| 2838 | if (mic_pin == AUTO_PIN_MIC) |
| 2839 | mic_pin = AUTO_PIN_FRONT_MIC; |
| 2840 | else |
| 2841 | break; |
| 2842 | } |
| 2843 | return 0; |
| 2844 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2845 | |
| 2846 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2847 | { |
| 2848 | int i; |
| 2849 | |
| 2850 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2851 | if (spec->multiout.dac_nids[i] == nid) |
| 2852 | return 1; |
| 2853 | } |
| 2854 | |
| 2855 | return 0; |
| 2856 | } |
| 2857 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2858 | static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2859 | { |
| 2860 | int i; |
| 2861 | if (is_in_dac_nids(spec, nid)) |
| 2862 | return 1; |
| 2863 | for (i = 0; i < spec->autocfg.hp_outs; i++) |
| 2864 | if (spec->hp_dacs[i] == nid) |
| 2865 | return 1; |
| 2866 | for (i = 0; i < spec->autocfg.speaker_outs; i++) |
| 2867 | if (spec->speaker_dacs[i] == nid) |
| 2868 | return 1; |
| 2869 | return 0; |
| 2870 | } |
| 2871 | |
| 2872 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
| 2873 | { |
| 2874 | struct sigmatel_spec *spec = codec->spec; |
| 2875 | int j, conn_len; |
| 2876 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
| 2877 | unsigned int wcaps, wtype; |
| 2878 | |
| 2879 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2880 | HDA_MAX_CONNECTIONS); |
| 2881 | for (j = 0; j < conn_len; j++) { |
Takashi Iwai | 14bafe3 | 2009-03-23 16:35:39 +0100 | [diff] [blame] | 2882 | wcaps = get_wcaps(codec, conn[j]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2883 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 2884 | /* we check only analog outputs */ |
| 2885 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
| 2886 | continue; |
| 2887 | /* if this route has a free DAC, assign it */ |
| 2888 | if (!check_all_dac_nids(spec, conn[j])) { |
| 2889 | if (conn_len > 1) { |
| 2890 | /* select this DAC in the pin's input mux */ |
| 2891 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2892 | AC_VERB_SET_CONNECT_SEL, j); |
| 2893 | } |
| 2894 | return conn[j]; |
| 2895 | } |
| 2896 | } |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 2897 | /* if all DACs are already assigned, connect to the primary DAC */ |
| 2898 | if (conn_len > 1) { |
| 2899 | for (j = 0; j < conn_len; j++) { |
| 2900 | if (conn[j] == spec->multiout.dac_nids[0]) { |
| 2901 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2902 | AC_VERB_SET_CONNECT_SEL, j); |
| 2903 | break; |
| 2904 | } |
| 2905 | } |
| 2906 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2907 | return 0; |
| 2908 | } |
| 2909 | |
| 2910 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 2911 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 2912 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2913 | /* |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2914 | * Fill in the dac_nids table from the parsed pin configuration |
| 2915 | * This function only works when every pin in line_out_pins[] |
| 2916 | * contains atleast one DAC in its connection list. Some 92xx |
| 2917 | * codecs are not connected directly to a DAC, such as the 9200 |
| 2918 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2919 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2920 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2921 | { |
| 2922 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2923 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2924 | int i; |
| 2925 | hda_nid_t nid, dac; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2926 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2927 | for (i = 0; i < cfg->line_outs; i++) { |
| 2928 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2929 | dac = get_unassigned_dac(codec, nid); |
| 2930 | if (!dac) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2931 | if (spec->multiout.num_dacs > 0) { |
| 2932 | /* we have already working output pins, |
| 2933 | * so let's drop the broken ones again |
| 2934 | */ |
| 2935 | cfg->line_outs = spec->multiout.num_dacs; |
| 2936 | break; |
| 2937 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2938 | /* error out, no available DAC found */ |
| 2939 | snd_printk(KERN_ERR |
| 2940 | "%s: No available DAC for pin 0x%x\n", |
| 2941 | __func__, nid); |
| 2942 | return -ENODEV; |
| 2943 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2944 | add_spec_dacs(spec, dac); |
| 2945 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2946 | |
Takashi Iwai | 139e071 | 2009-03-06 12:10:41 +0100 | [diff] [blame] | 2947 | for (i = 0; i < cfg->hp_outs; i++) { |
| 2948 | nid = cfg->hp_pins[i]; |
| 2949 | dac = get_unassigned_dac(codec, nid); |
| 2950 | if (dac) { |
| 2951 | if (!spec->multiout.hp_nid) |
| 2952 | spec->multiout.hp_nid = dac; |
| 2953 | else |
| 2954 | add_spec_extra_dacs(spec, dac); |
| 2955 | } |
| 2956 | spec->hp_dacs[i] = dac; |
| 2957 | } |
| 2958 | |
| 2959 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 2960 | nid = cfg->speaker_pins[i]; |
| 2961 | dac = get_unassigned_dac(codec, nid); |
| 2962 | if (dac) |
| 2963 | add_spec_extra_dacs(spec, dac); |
| 2964 | spec->speaker_dacs[i] = dac; |
| 2965 | } |
| 2966 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2967 | /* add line-in as output */ |
| 2968 | nid = check_line_out_switch(codec); |
| 2969 | if (nid) { |
| 2970 | dac = get_unassigned_dac(codec, nid); |
| 2971 | if (dac) { |
| 2972 | snd_printdd("STAC: Add line-in 0x%x as output %d\n", |
| 2973 | nid, cfg->line_outs); |
| 2974 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 2975 | cfg->line_outs++; |
| 2976 | spec->line_switch = nid; |
| 2977 | add_spec_dacs(spec, dac); |
| 2978 | } |
| 2979 | } |
| 2980 | /* add mic as output */ |
| 2981 | nid = check_mic_out_switch(codec); |
| 2982 | if (nid) { |
| 2983 | dac = get_unassigned_dac(codec, nid); |
| 2984 | if (dac) { |
| 2985 | snd_printdd("STAC: Add mic-in 0x%x as output %d\n", |
| 2986 | nid, cfg->line_outs); |
| 2987 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 2988 | cfg->line_outs++; |
| 2989 | spec->mic_switch = nid; |
| 2990 | add_spec_dacs(spec, dac); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2991 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2992 | } |
| 2993 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2994 | 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] | 2995 | spec->multiout.num_dacs, |
| 2996 | spec->multiout.dac_nids[0], |
| 2997 | spec->multiout.dac_nids[1], |
| 2998 | spec->multiout.dac_nids[2], |
| 2999 | spec->multiout.dac_nids[3], |
| 3000 | spec->multiout.dac_nids[4]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3001 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3002 | return 0; |
| 3003 | } |
| 3004 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3005 | /* create volume control/switch for the given prefx type */ |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3006 | static int create_controls_idx(struct hda_codec *codec, const char *pfx, |
| 3007 | int idx, hda_nid_t nid, int chs) |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3008 | { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3009 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3010 | char name[32]; |
| 3011 | int err; |
| 3012 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3013 | if (!spec->check_volume_offset) { |
| 3014 | unsigned int caps, step, nums, db_scale; |
| 3015 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3016 | step = (caps & AC_AMPCAP_STEP_SIZE) >> |
| 3017 | AC_AMPCAP_STEP_SIZE_SHIFT; |
| 3018 | step = (step + 1) * 25; /* in .01dB unit */ |
| 3019 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> |
| 3020 | AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3021 | db_scale = nums * step; |
| 3022 | /* if dB scale is over -64dB, and finer enough, |
| 3023 | * let's reduce it to half |
| 3024 | */ |
| 3025 | if (db_scale > 6400 && nums >= 0x1f) |
| 3026 | spec->volume_offset = nums / 2; |
| 3027 | spec->check_volume_offset = 1; |
| 3028 | } |
| 3029 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3030 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3031 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3032 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
| 3033 | spec->volume_offset)); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3034 | if (err < 0) |
| 3035 | return err; |
| 3036 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3037 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3038 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 3039 | if (err < 0) |
| 3040 | return err; |
| 3041 | return 0; |
| 3042 | } |
| 3043 | |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3044 | #define create_controls(codec, pfx, nid, chs) \ |
| 3045 | create_controls_idx(codec, pfx, 0, nid, chs) |
| 3046 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3047 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3048 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3049 | if (spec->multiout.num_dacs > 4) { |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3050 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 3051 | return 1; |
| 3052 | } else { |
| 3053 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 3054 | spec->multiout.num_dacs++; |
| 3055 | } |
| 3056 | return 0; |
| 3057 | } |
| 3058 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3059 | 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] | 3060 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3061 | int i; |
| 3062 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { |
| 3063 | if (!spec->multiout.extra_out_nid[i]) { |
| 3064 | spec->multiout.extra_out_nid[i] = nid; |
| 3065 | return 0; |
| 3066 | } |
| 3067 | } |
| 3068 | printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); |
| 3069 | return 1; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3070 | } |
| 3071 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3072 | /* Create output controls |
| 3073 | * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) |
| 3074 | */ |
| 3075 | static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, |
| 3076 | const hda_nid_t *pins, |
| 3077 | const hda_nid_t *dac_nids, |
| 3078 | int type) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3079 | { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3080 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3081 | static const char *chname[4] = { |
| 3082 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3083 | }; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3084 | hda_nid_t nid; |
Takashi Iwai | 9158923 | 2008-12-19 15:59:40 +0100 | [diff] [blame] | 3085 | int i, err; |
| 3086 | unsigned int wid_caps; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3087 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3088 | for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3089 | if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { |
| 3090 | wid_caps = get_wcaps(codec, pins[i]); |
| 3091 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 3092 | spec->hp_detect = 1; |
| 3093 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3094 | nid = dac_nids[i]; |
| 3095 | if (!nid) |
| 3096 | continue; |
| 3097 | if (type != AUTO_PIN_HP_OUT && i == 2) { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3098 | /* Center/LFE */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3099 | err = create_controls(codec, "Center", nid, 1); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3100 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3101 | return err; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3102 | err = create_controls(codec, "LFE", nid, 2); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3103 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3104 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3105 | |
| 3106 | wid_caps = get_wcaps(codec, nid); |
| 3107 | |
| 3108 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 3109 | err = stac92xx_add_control(spec, |
| 3110 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 3111 | "Swap Center/LFE Playback Switch", nid); |
| 3112 | |
| 3113 | if (err < 0) |
| 3114 | return err; |
| 3115 | } |
| 3116 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3117 | } else { |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3118 | const char *name; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3119 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3120 | switch (type) { |
| 3121 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3122 | name = "Headphone"; |
| 3123 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3124 | break; |
| 3125 | case AUTO_PIN_SPEAKER_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3126 | name = "Speaker"; |
| 3127 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3128 | break; |
| 3129 | default: |
| 3130 | name = chname[i]; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3131 | idx = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3132 | break; |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3133 | } |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3134 | err = create_controls_idx(codec, name, idx, nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3135 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3136 | return err; |
| 3137 | } |
| 3138 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3139 | return 0; |
| 3140 | } |
| 3141 | |
| 3142 | /* add playback controls from the parsed DAC table */ |
| 3143 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 3144 | const struct auto_pin_cfg *cfg) |
| 3145 | { |
| 3146 | struct sigmatel_spec *spec = codec->spec; |
| 3147 | int err; |
| 3148 | |
| 3149 | err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, |
| 3150 | spec->multiout.dac_nids, |
| 3151 | cfg->line_out_type); |
| 3152 | if (err < 0) |
| 3153 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3154 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 3155 | 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] | 3156 | err = stac92xx_add_control(spec, |
| 3157 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 3158 | "Headphone as Line Out Switch", |
| 3159 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3160 | if (err < 0) |
| 3161 | return err; |
| 3162 | } |
| 3163 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3164 | if (spec->line_switch) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3165 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, |
| 3166 | "Line In as Output Switch", |
| 3167 | spec->line_switch << 8); |
| 3168 | if (err < 0) |
| 3169 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3170 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3171 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3172 | if (spec->mic_switch) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3173 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, |
| 3174 | "Mic as Output Switch", |
| 3175 | (spec->mic_switch << 8) | 1); |
| 3176 | if (err < 0) |
| 3177 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3178 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3179 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3180 | return 0; |
| 3181 | } |
| 3182 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3183 | /* add playback controls for Speaker and HP outputs */ |
| 3184 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3185 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3186 | { |
| 3187 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3188 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3189 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3190 | err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, |
| 3191 | spec->hp_dacs, AUTO_PIN_HP_OUT); |
| 3192 | if (err < 0) |
| 3193 | return err; |
| 3194 | |
| 3195 | err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, |
| 3196 | spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); |
| 3197 | if (err < 0) |
| 3198 | return err; |
| 3199 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3200 | return 0; |
| 3201 | } |
| 3202 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3203 | /* labels for mono mux outputs */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3204 | static const char *stac92xx_mono_labels[4] = { |
| 3205 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3206 | }; |
| 3207 | |
| 3208 | /* create mono mux for mono out on capable codecs */ |
| 3209 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3210 | { |
| 3211 | struct sigmatel_spec *spec = codec->spec; |
| 3212 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3213 | int i, num_cons; |
| 3214 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3215 | |
| 3216 | num_cons = snd_hda_get_connections(codec, |
| 3217 | spec->mono_nid, |
| 3218 | con_lst, |
| 3219 | HDA_MAX_NUM_INPUTS); |
| 3220 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
| 3221 | return -EINVAL; |
| 3222 | |
| 3223 | for (i = 0; i < num_cons; i++) { |
| 3224 | mono_mux->items[mono_mux->num_items].label = |
| 3225 | stac92xx_mono_labels[i]; |
| 3226 | mono_mux->items[mono_mux->num_items].index = i; |
| 3227 | mono_mux->num_items++; |
| 3228 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3229 | |
| 3230 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3231 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3232 | } |
| 3233 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3234 | /* labels for amp mux outputs */ |
| 3235 | static const char *stac92xx_amp_labels[3] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 3236 | "Front Microphone", "Microphone", "Line In", |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3237 | }; |
| 3238 | |
| 3239 | /* create amp out controls mux on capable codecs */ |
| 3240 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) |
| 3241 | { |
| 3242 | struct sigmatel_spec *spec = codec->spec; |
| 3243 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; |
| 3244 | int i, err; |
| 3245 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3246 | for (i = 0; i < spec->num_amps; i++) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3247 | amp_mux->items[amp_mux->num_items].label = |
| 3248 | stac92xx_amp_labels[i]; |
| 3249 | amp_mux->items[amp_mux->num_items].index = i; |
| 3250 | amp_mux->num_items++; |
| 3251 | } |
| 3252 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3253 | if (spec->num_amps > 1) { |
| 3254 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, |
| 3255 | "Amp Selector Capture Switch", 0); |
| 3256 | if (err < 0) |
| 3257 | return err; |
| 3258 | } |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3259 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, |
| 3260 | "Amp Capture Volume", |
| 3261 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); |
| 3262 | } |
| 3263 | |
| 3264 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3265 | /* create PC beep volume controls */ |
| 3266 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3267 | hda_nid_t nid) |
| 3268 | { |
| 3269 | struct sigmatel_spec *spec = codec->spec; |
| 3270 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3271 | int err; |
| 3272 | |
| 3273 | /* check for mute support for the the amp */ |
| 3274 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
| 3275 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3276 | "PC Beep Playback Switch", |
| 3277 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3278 | if (err < 0) |
| 3279 | return err; |
| 3280 | } |
| 3281 | |
| 3282 | /* check to see if there is volume support for the amp */ |
| 3283 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3284 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
| 3285 | "PC Beep Playback Volume", |
| 3286 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3287 | if (err < 0) |
| 3288 | return err; |
| 3289 | } |
| 3290 | return 0; |
| 3291 | } |
| 3292 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3293 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3294 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3295 | |
| 3296 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3297 | struct snd_ctl_elem_value *ucontrol) |
| 3298 | { |
| 3299 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3300 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3301 | return 0; |
| 3302 | } |
| 3303 | |
| 3304 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3305 | struct snd_ctl_elem_value *ucontrol) |
| 3306 | { |
| 3307 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3308 | int enabled = !!ucontrol->value.integer.value[0]; |
| 3309 | if (codec->beep->enabled != enabled) { |
| 3310 | codec->beep->enabled = enabled; |
| 3311 | return 1; |
| 3312 | } |
| 3313 | return 0; |
| 3314 | } |
| 3315 | |
| 3316 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
| 3317 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3318 | .info = stac92xx_dig_beep_switch_info, |
| 3319 | .get = stac92xx_dig_beep_switch_get, |
| 3320 | .put = stac92xx_dig_beep_switch_put, |
| 3321 | }; |
| 3322 | |
| 3323 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3324 | { |
| 3325 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
| 3326 | 0, "PC Beep Playback Switch", 0); |
| 3327 | } |
| 3328 | #endif |
| 3329 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3330 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3331 | { |
| 3332 | struct sigmatel_spec *spec = codec->spec; |
| 3333 | int wcaps, nid, i, err = 0; |
| 3334 | |
| 3335 | for (i = 0; i < spec->num_muxes; i++) { |
| 3336 | nid = spec->mux_nids[i]; |
| 3337 | wcaps = get_wcaps(codec, nid); |
| 3338 | |
| 3339 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 3340 | err = stac92xx_add_control_idx(spec, |
| 3341 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", |
| 3342 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3343 | if (err < 0) |
| 3344 | return err; |
| 3345 | } |
| 3346 | } |
| 3347 | return 0; |
| 3348 | }; |
| 3349 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3350 | static const char *stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3351 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3352 | }; |
| 3353 | |
| 3354 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3355 | { |
| 3356 | struct sigmatel_spec *spec = codec->spec; |
| 3357 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3358 | const char **labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3359 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3360 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3361 | |
| 3362 | num_cons = snd_hda_get_connections(codec, |
| 3363 | spec->smux_nids[0], |
| 3364 | con_lst, |
| 3365 | HDA_MAX_NUM_INPUTS); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3366 | if (!num_cons) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3367 | return -EINVAL; |
| 3368 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3369 | if (!labels) |
| 3370 | labels = stac92xx_spdif_labels; |
| 3371 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3372 | for (i = 0; i < num_cons; i++) { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3373 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3374 | spdif_mux->items[spdif_mux->num_items].index = i; |
| 3375 | spdif_mux->num_items++; |
| 3376 | } |
| 3377 | |
| 3378 | return 0; |
| 3379 | } |
| 3380 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3381 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 3382 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3383 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3384 | "Digital Mic 3", "Digital Mic 4" |
| 3385 | }; |
| 3386 | |
| 3387 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3388 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3389 | const struct auto_pin_cfg *cfg) |
| 3390 | { |
| 3391 | struct sigmatel_spec *spec = codec->spec; |
| 3392 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 3393 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3394 | int err, i, j; |
| 3395 | char name[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3396 | |
| 3397 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 3398 | dimux->items[dimux->num_items].index = 0; |
| 3399 | dimux->num_items++; |
| 3400 | |
| 3401 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3402 | hda_nid_t nid; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3403 | int index; |
| 3404 | int num_cons; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3405 | unsigned int wcaps; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3406 | unsigned int def_conf; |
| 3407 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 3408 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3409 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3410 | continue; |
| 3411 | |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3412 | nid = spec->dmic_nids[i]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3413 | num_cons = snd_hda_get_connections(codec, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3414 | spec->dmux_nids[0], |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3415 | con_lst, |
| 3416 | HDA_MAX_NUM_INPUTS); |
| 3417 | for (j = 0; j < num_cons; j++) |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3418 | if (con_lst[j] == nid) { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3419 | index = j; |
| 3420 | goto found; |
| 3421 | } |
| 3422 | continue; |
| 3423 | found: |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3424 | wcaps = get_wcaps(codec, nid) & |
| 3425 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3426 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3427 | if (wcaps) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3428 | sprintf(name, "%s Capture Volume", |
| 3429 | stac92xx_dmic_labels[dimux->num_items]); |
| 3430 | |
| 3431 | err = stac92xx_add_control(spec, |
| 3432 | STAC_CTL_WIDGET_VOL, |
| 3433 | name, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3434 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3435 | (wcaps & AC_WCAP_OUT_AMP) ? |
| 3436 | HDA_OUTPUT : HDA_INPUT)); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3437 | if (err < 0) |
| 3438 | return err; |
| 3439 | } |
| 3440 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3441 | dimux->items[dimux->num_items].label = |
| 3442 | stac92xx_dmic_labels[dimux->num_items]; |
| 3443 | dimux->items[dimux->num_items].index = index; |
| 3444 | dimux->num_items++; |
| 3445 | } |
| 3446 | |
| 3447 | return 0; |
| 3448 | } |
| 3449 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3450 | /* create playback/capture controls for input pins */ |
| 3451 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3452 | { |
| 3453 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3454 | struct hda_input_mux *imux = &spec->private_imux; |
| 3455 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 3456 | int i, j, k; |
| 3457 | |
| 3458 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3459 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3460 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3461 | if (!cfg->input_pins[i]) |
| 3462 | continue; |
| 3463 | index = -1; |
| 3464 | for (j = 0; j < spec->num_muxes; j++) { |
| 3465 | int num_cons; |
| 3466 | num_cons = snd_hda_get_connections(codec, |
| 3467 | spec->mux_nids[j], |
| 3468 | con_lst, |
| 3469 | HDA_MAX_NUM_INPUTS); |
| 3470 | for (k = 0; k < num_cons; k++) |
| 3471 | if (con_lst[k] == cfg->input_pins[i]) { |
| 3472 | index = k; |
| 3473 | goto found; |
| 3474 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3475 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3476 | continue; |
| 3477 | found: |
| 3478 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 3479 | imux->items[imux->num_items].index = index; |
| 3480 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3481 | } |
| 3482 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3483 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3484 | /* |
| 3485 | * Set the current input for the muxes. |
| 3486 | * The STAC9221 has two input muxes with identical source |
| 3487 | * NID lists. Hopefully this won't get confused. |
| 3488 | */ |
| 3489 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3490 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3491 | AC_VERB_SET_CONNECT_SEL, |
| 3492 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3493 | } |
| 3494 | } |
| 3495 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3496 | return 0; |
| 3497 | } |
| 3498 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3499 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3500 | { |
| 3501 | struct sigmatel_spec *spec = codec->spec; |
| 3502 | int i; |
| 3503 | |
| 3504 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3505 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3506 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3507 | } |
| 3508 | } |
| 3509 | |
| 3510 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3511 | { |
| 3512 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3513 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3514 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3515 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3516 | hda_nid_t pin; |
| 3517 | pin = spec->autocfg.hp_pins[i]; |
| 3518 | if (pin) /* connect to front */ |
| 3519 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3520 | } |
| 3521 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3522 | hda_nid_t pin; |
| 3523 | pin = spec->autocfg.speaker_pins[i]; |
| 3524 | if (pin) /* connect to front */ |
| 3525 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3526 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3527 | } |
| 3528 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3529 | static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3530 | { |
| 3531 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3532 | int hp_swap = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3533 | int err; |
| 3534 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3535 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3536 | &spec->autocfg, |
| 3537 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3538 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3539 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3540 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3541 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3542 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3543 | * be set up as multi-channel outputs. |
| 3544 | */ |
| 3545 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && |
| 3546 | spec->autocfg.hp_outs > 1) { |
| 3547 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3548 | * speaker_outs so that the following routines can handle |
| 3549 | * HP pins as primary outputs. |
| 3550 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3551 | snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3552 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3553 | sizeof(spec->autocfg.line_out_pins)); |
| 3554 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3555 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3556 | sizeof(spec->autocfg.hp_pins)); |
| 3557 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3558 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3559 | spec->autocfg.hp_outs = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3560 | hp_swap = 1; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3561 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3562 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3563 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3564 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3565 | u32 caps = query_amp_caps(codec, |
| 3566 | spec->autocfg.mono_out_pin, dir); |
| 3567 | hda_nid_t conn_list[1]; |
| 3568 | |
| 3569 | /* get the mixer node and then the mono mux if it exists */ |
| 3570 | if (snd_hda_get_connections(codec, |
| 3571 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3572 | snd_hda_get_connections(codec, conn_list[0], |
| 3573 | conn_list, 1)) { |
| 3574 | |
| 3575 | int wcaps = get_wcaps(codec, conn_list[0]); |
| 3576 | int wid_type = (wcaps & AC_WCAP_TYPE) |
| 3577 | >> AC_WCAP_TYPE_SHIFT; |
| 3578 | /* LR swap check, some stac925x have a mux that |
| 3579 | * changes the DACs output path instead of the |
| 3580 | * mono-mux path. |
| 3581 | */ |
| 3582 | if (wid_type == AC_WID_AUD_SEL && |
| 3583 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3584 | spec->mono_nid = conn_list[0]; |
| 3585 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3586 | if (dir) { |
| 3587 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3588 | |
| 3589 | /* most mono outs have a least a mute/unmute switch */ |
| 3590 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3591 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3592 | "Mono Playback Switch", |
| 3593 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3594 | if (err < 0) |
| 3595 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3596 | /* check for volume support for the amp */ |
| 3597 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3598 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3599 | err = stac92xx_add_control(spec, |
| 3600 | STAC_CTL_WIDGET_VOL, |
| 3601 | "Mono Playback Volume", |
| 3602 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3603 | if (err < 0) |
| 3604 | return err; |
| 3605 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3606 | } |
| 3607 | |
| 3608 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3609 | AC_PINCTL_OUT_EN); |
| 3610 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3611 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3612 | if (!spec->multiout.num_dacs) { |
| 3613 | err = stac92xx_auto_fill_dac_nids(codec); |
| 3614 | if (err < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3615 | return err; |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 3616 | err = stac92xx_auto_create_multi_out_ctls(codec, |
| 3617 | &spec->autocfg); |
| 3618 | if (err < 0) |
| 3619 | return err; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3620 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3621 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3622 | /* setup analog beep controls */ |
| 3623 | if (spec->anabeep_nid > 0) { |
| 3624 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3625 | spec->anabeep_nid); |
| 3626 | if (err < 0) |
| 3627 | return err; |
| 3628 | } |
| 3629 | |
| 3630 | /* setup digital beep controls and input device */ |
| 3631 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3632 | if (spec->digbeep_nid > 0) { |
| 3633 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3634 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3635 | |
| 3636 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3637 | if (err < 0) |
| 3638 | return err; |
| 3639 | err = snd_hda_attach_beep_device(codec, nid); |
| 3640 | if (err < 0) |
| 3641 | return err; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3642 | /* if no beep switch is available, make its own one */ |
| 3643 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3644 | if (codec->beep && |
| 3645 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { |
| 3646 | err = stac92xx_beep_switch_ctl(codec); |
| 3647 | if (err < 0) |
| 3648 | return err; |
| 3649 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3650 | } |
| 3651 | #endif |
| 3652 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3653 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3654 | if (err < 0) |
| 3655 | return err; |
| 3656 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3657 | /* All output parsing done, now restore the swapped hp pins */ |
| 3658 | if (hp_swap) { |
| 3659 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 3660 | sizeof(spec->autocfg.hp_pins)); |
| 3661 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 3662 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3663 | spec->autocfg.line_outs = 0; |
| 3664 | } |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3665 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3666 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3667 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3668 | return err; |
| 3669 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3670 | if (spec->mono_nid > 0) { |
| 3671 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3672 | if (err < 0) |
| 3673 | return err; |
| 3674 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3675 | if (spec->num_amps > 0) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3676 | err = stac92xx_auto_create_amp_output_ctls(codec); |
| 3677 | if (err < 0) |
| 3678 | return err; |
| 3679 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3680 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3681 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3682 | &spec->autocfg)) < 0) |
| 3683 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3684 | if (spec->num_muxes > 0) { |
| 3685 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3686 | if (err < 0) |
| 3687 | return err; |
| 3688 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3689 | if (spec->num_smuxes > 0) { |
| 3690 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3691 | if (err < 0) |
| 3692 | return err; |
| 3693 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3694 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3695 | err = stac92xx_add_input_source(spec); |
| 3696 | if (err < 0) |
| 3697 | return err; |
| 3698 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3699 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3700 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3701 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3702 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 3703 | if (spec->autocfg.dig_outs) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3704 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3705 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3706 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3707 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3708 | if (spec->kctls.list) |
| 3709 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3710 | |
| 3711 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | f8ccbf6 | 2008-12-20 17:36:28 -0500 | [diff] [blame] | 3712 | if (!spec->dinput_mux) |
| 3713 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3714 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3715 | spec->mono_mux = &spec->private_mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3716 | spec->amp_mux = &spec->private_amp_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3717 | return 1; |
| 3718 | } |
| 3719 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3720 | /* add playback controls for HP output */ |
| 3721 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 3722 | struct auto_pin_cfg *cfg) |
| 3723 | { |
| 3724 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3725 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3726 | unsigned int wid_caps; |
| 3727 | |
| 3728 | if (! pin) |
| 3729 | return 0; |
| 3730 | |
| 3731 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 3732 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3733 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3734 | |
| 3735 | return 0; |
| 3736 | } |
| 3737 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3738 | /* add playback controls for LFE output */ |
| 3739 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 3740 | struct auto_pin_cfg *cfg) |
| 3741 | { |
| 3742 | struct sigmatel_spec *spec = codec->spec; |
| 3743 | int err; |
| 3744 | hda_nid_t lfe_pin = 0x0; |
| 3745 | int i; |
| 3746 | |
| 3747 | /* |
| 3748 | * search speaker outs and line outs for a mono speaker pin |
| 3749 | * with an amp. If one is found, add LFE controls |
| 3750 | * for it. |
| 3751 | */ |
| 3752 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 3753 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3754 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3755 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3756 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3757 | /* found a mono speaker with an amp, must be lfe */ |
| 3758 | lfe_pin = pin; |
| 3759 | } |
| 3760 | |
| 3761 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 3762 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 3763 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 3764 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3765 | unsigned int defcfg; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 3766 | defcfg = snd_hda_codec_get_pincfg(codec, pin); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 3767 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3768 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3769 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3770 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3771 | /* found a mono speaker with an amp, |
| 3772 | must be lfe */ |
| 3773 | lfe_pin = pin; |
| 3774 | } |
| 3775 | } |
| 3776 | } |
| 3777 | |
| 3778 | if (lfe_pin) { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3779 | err = create_controls(codec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3780 | if (err < 0) |
| 3781 | return err; |
| 3782 | } |
| 3783 | |
| 3784 | return 0; |
| 3785 | } |
| 3786 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3787 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 3788 | { |
| 3789 | struct sigmatel_spec *spec = codec->spec; |
| 3790 | int err; |
| 3791 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3792 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3793 | return err; |
| 3794 | |
| 3795 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 3796 | return err; |
| 3797 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3798 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 3799 | return err; |
| 3800 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3801 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 3802 | return err; |
| 3803 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 3804 | if (spec->num_muxes > 0) { |
| 3805 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3806 | if (err < 0) |
| 3807 | return err; |
| 3808 | } |
| 3809 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3810 | err = stac92xx_add_input_source(spec); |
| 3811 | if (err < 0) |
| 3812 | return err; |
| 3813 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 3814 | if (spec->autocfg.dig_outs) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3815 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3816 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3817 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3818 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3819 | if (spec->kctls.list) |
| 3820 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3821 | |
| 3822 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3823 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3824 | |
| 3825 | return 1; |
| 3826 | } |
| 3827 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3828 | /* |
| 3829 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 3830 | * funky external mute control using GPIO pins. |
| 3831 | */ |
| 3832 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3833 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3834 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3835 | { |
| 3836 | unsigned int gpiostate, gpiomask, gpiodir; |
| 3837 | |
| 3838 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 3839 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3840 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3841 | |
| 3842 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 3843 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3844 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3845 | |
| 3846 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 3847 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3848 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3849 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3850 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3851 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 3852 | |
| 3853 | snd_hda_codec_write(codec, codec->afg, 0, |
| 3854 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3855 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3856 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3857 | |
| 3858 | msleep(1); |
| 3859 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3860 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3861 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3862 | } |
| 3863 | |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 3864 | #ifdef CONFIG_SND_JACK |
| 3865 | static void stac92xx_free_jack_priv(struct snd_jack *jack) |
| 3866 | { |
| 3867 | struct sigmatel_jack *jacks = jack->private_data; |
| 3868 | jacks->nid = 0; |
| 3869 | jacks->jack = NULL; |
| 3870 | } |
| 3871 | #endif |
| 3872 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3873 | static int stac92xx_add_jack(struct hda_codec *codec, |
| 3874 | hda_nid_t nid, int type) |
| 3875 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3876 | #ifdef CONFIG_SND_JACK |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3877 | struct sigmatel_spec *spec = codec->spec; |
| 3878 | struct sigmatel_jack *jack; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 3879 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3880 | int connectivity = get_defcfg_connect(def_conf); |
| 3881 | char name[32]; |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 3882 | int err; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3883 | |
| 3884 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
| 3885 | return 0; |
| 3886 | |
| 3887 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 3888 | jack = snd_array_new(&spec->jacks); |
| 3889 | if (!jack) |
| 3890 | return -ENOMEM; |
| 3891 | jack->nid = nid; |
| 3892 | jack->type = type; |
| 3893 | |
| 3894 | sprintf(name, "%s at %s %s Jack", |
| 3895 | snd_hda_get_jack_type(def_conf), |
| 3896 | snd_hda_get_jack_connectivity(def_conf), |
| 3897 | snd_hda_get_jack_location(def_conf)); |
| 3898 | |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 3899 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 3900 | if (err < 0) { |
| 3901 | jack->nid = 0; |
| 3902 | return err; |
| 3903 | } |
| 3904 | jack->jack->private_data = jack; |
| 3905 | jack->jack->private_free = stac92xx_free_jack_priv; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3906 | #endif |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 3907 | return 0; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3908 | } |
| 3909 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3910 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, |
| 3911 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3912 | { |
| 3913 | struct sigmatel_event *event; |
| 3914 | |
| 3915 | snd_array_init(&spec->events, sizeof(*event), 32); |
| 3916 | event = snd_array_new(&spec->events); |
| 3917 | if (!event) |
| 3918 | return -ENOMEM; |
| 3919 | event->nid = nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3920 | event->type = type; |
| 3921 | event->tag = spec->events.used; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3922 | event->data = data; |
| 3923 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3924 | return event->tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3925 | } |
| 3926 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3927 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, |
| 3928 | hda_nid_t nid, unsigned char type) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3929 | { |
| 3930 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3931 | struct sigmatel_event *event = spec->events.list; |
| 3932 | int i; |
| 3933 | |
| 3934 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3935 | if (event->nid == nid && event->type == type) |
| 3936 | return event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3937 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3938 | return NULL; |
| 3939 | } |
| 3940 | |
| 3941 | static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, |
| 3942 | unsigned char tag) |
| 3943 | { |
| 3944 | struct sigmatel_spec *spec = codec->spec; |
| 3945 | struct sigmatel_event *event = spec->events.list; |
| 3946 | int i; |
| 3947 | |
| 3948 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3949 | if (event->tag == tag) |
| 3950 | return event; |
| 3951 | } |
| 3952 | return NULL; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3953 | } |
| 3954 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3955 | static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3956 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3957 | { |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3958 | struct sigmatel_event *event; |
| 3959 | int tag; |
| 3960 | |
| 3961 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
| 3962 | return; |
| 3963 | event = stac_get_event(codec, nid, type); |
| 3964 | if (event) |
| 3965 | tag = event->tag; |
| 3966 | else |
| 3967 | tag = stac_add_event(codec->spec, nid, type, 0); |
| 3968 | if (tag < 0) |
| 3969 | return; |
| 3970 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3971 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 3972 | AC_USRSP_EN | tag); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3973 | } |
| 3974 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3975 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
| 3976 | { |
| 3977 | int i; |
| 3978 | for (i = 0; i < cfg->hp_outs; i++) |
| 3979 | if (cfg->hp_pins[i] == nid) |
| 3980 | return 1; /* nid is a HP-Out */ |
| 3981 | |
| 3982 | return 0; /* nid is not a HP-Out */ |
| 3983 | }; |
| 3984 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3985 | static void stac92xx_power_down(struct hda_codec *codec) |
| 3986 | { |
| 3987 | struct sigmatel_spec *spec = codec->spec; |
| 3988 | |
| 3989 | /* power down inactive DACs */ |
| 3990 | hda_nid_t *dac; |
| 3991 | for (dac = spec->dac_list; *dac; dac++) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3992 | if (!check_all_dac_nids(spec, *dac)) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 3993 | snd_hda_codec_write(codec, *dac, 0, |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3994 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 3995 | } |
| 3996 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3997 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 3998 | int enable); |
| 3999 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4000 | /* override some hints from the hwdep entry */ |
| 4001 | static void stac_store_hints(struct hda_codec *codec) |
| 4002 | { |
| 4003 | struct sigmatel_spec *spec = codec->spec; |
| 4004 | const char *p; |
| 4005 | int val; |
| 4006 | |
| 4007 | val = snd_hda_get_bool_hint(codec, "hp_detect"); |
| 4008 | if (val >= 0) |
| 4009 | spec->hp_detect = val; |
| 4010 | p = snd_hda_get_hint(codec, "gpio_mask"); |
| 4011 | if (p) { |
| 4012 | spec->gpio_mask = simple_strtoul(p, NULL, 0); |
| 4013 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = |
| 4014 | spec->gpio_mask; |
| 4015 | } |
| 4016 | p = snd_hda_get_hint(codec, "gpio_dir"); |
| 4017 | if (p) |
| 4018 | spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4019 | p = snd_hda_get_hint(codec, "gpio_data"); |
| 4020 | if (p) |
| 4021 | spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4022 | p = snd_hda_get_hint(codec, "eapd_mask"); |
| 4023 | if (p) |
| 4024 | spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4025 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); |
| 4026 | if (val >= 0) |
| 4027 | spec->eapd_switch = val; |
| 4028 | } |
| 4029 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4030 | static int stac92xx_init(struct hda_codec *codec) |
| 4031 | { |
| 4032 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4033 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4034 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4035 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4036 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4037 | snd_hda_sequence_write(codec, spec->init); |
| 4038 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4039 | /* power down adcs initially */ |
| 4040 | if (spec->powerdown_adcs) |
| 4041 | for (i = 0; i < spec->num_adcs; i++) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4042 | snd_hda_codec_write(codec, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4043 | spec->adc_nids[i], 0, |
| 4044 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4045 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4046 | /* override some hints */ |
| 4047 | stac_store_hints(codec); |
| 4048 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4049 | /* set up GPIO */ |
| 4050 | gpio = spec->gpio_data; |
| 4051 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 4052 | * otherwise, unsol event will turn it on/off dynamically |
| 4053 | */ |
| 4054 | if (!spec->eapd_switch) |
| 4055 | gpio |= spec->eapd_mask; |
| 4056 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 4057 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4058 | /* set up pins */ |
| 4059 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4060 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4061 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4062 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4063 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4064 | } |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 4065 | /* force to enable the first line-out; the others are set up |
| 4066 | * in unsol_event |
| 4067 | */ |
| 4068 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4069 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4070 | /* fake event to set up pins */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4071 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 4072 | STAC_HP_EVENT); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4073 | } else { |
| 4074 | stac92xx_auto_init_multi_out(codec); |
| 4075 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4076 | for (i = 0; i < cfg->hp_outs; i++) |
| 4077 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4078 | } |
| 4079 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4080 | hda_nid_t nid = cfg->input_pins[i]; |
| 4081 | if (nid) { |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4082 | unsigned int pinctl, conf; |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4083 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
| 4084 | /* for mic pins, force to initialize */ |
| 4085 | pinctl = stac92xx_get_vref(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4086 | pinctl |= AC_PINCTL_IN_EN; |
| 4087 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4088 | } else { |
| 4089 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4090 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4091 | /* if PINCTL already set then skip */ |
Takashi Iwai | 5dd17cb | 2009-05-07 16:22:53 +0200 | [diff] [blame] | 4092 | /* Also, if both INPUT and OUTPUT are set, |
| 4093 | * it must be a BIOS bug; need to override, too |
| 4094 | */ |
| 4095 | if (!(pinctl & AC_PINCTL_IN_EN) || |
| 4096 | (pinctl & AC_PINCTL_OUT_EN)) { |
| 4097 | pinctl &= ~AC_PINCTL_OUT_EN; |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4098 | pinctl |= AC_PINCTL_IN_EN; |
| 4099 | stac92xx_auto_set_pinctl(codec, nid, |
| 4100 | pinctl); |
| 4101 | } |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4102 | } |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4103 | conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4104 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
| 4105 | enable_pin_detect(codec, nid, |
| 4106 | STAC_INSERT_EVENT); |
| 4107 | stac_issue_unsol_event(codec, nid, |
| 4108 | STAC_INSERT_EVENT); |
| 4109 | } |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4110 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4111 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4112 | for (i = 0; i < spec->num_dmics; i++) |
| 4113 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 4114 | AC_PINCTL_IN_EN); |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4115 | if (cfg->dig_out_pins[0]) |
| 4116 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4117 | AC_PINCTL_OUT_EN); |
| 4118 | if (cfg->dig_in_pin) |
| 4119 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 4120 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4121 | for (i = 0; i < spec->num_pwrs; i++) { |
| 4122 | hda_nid_t nid = spec->pwr_nids[i]; |
| 4123 | int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4124 | |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4125 | /* power on when no jack detection is available */ |
| 4126 | if (!spec->hp_detect) { |
| 4127 | stac_toggle_power_map(codec, nid, 1); |
| 4128 | continue; |
| 4129 | } |
| 4130 | |
| 4131 | if (is_nid_hp_pin(cfg, nid)) |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4132 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4133 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4134 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4135 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4136 | /* outputs are only ports capable of power management |
| 4137 | * any attempts on powering down a input port cause the |
| 4138 | * referenced VREF to act quirky. |
| 4139 | */ |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4140 | if (pinctl & AC_PINCTL_IN_EN) { |
| 4141 | stac_toggle_power_map(codec, nid, 1); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4142 | continue; |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4143 | } |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4144 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4145 | def_conf = get_defcfg_connect(def_conf); |
| 4146 | /* skip any ports that don't have jacks since presence |
| 4147 | * detection is useless */ |
| 4148 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
| 4149 | if (def_conf != AC_JACK_PORT_NONE) |
| 4150 | stac_toggle_power_map(codec, nid, 1); |
| 4151 | continue; |
| 4152 | } |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4153 | if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { |
| 4154 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); |
| 4155 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); |
| 4156 | } |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4157 | } |
| 4158 | if (spec->dac_list) |
| 4159 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4160 | return 0; |
| 4161 | } |
| 4162 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4163 | static void stac92xx_free_jacks(struct hda_codec *codec) |
| 4164 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4165 | #ifdef CONFIG_SND_JACK |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4166 | /* free jack instances manually when clearing/reconfiguring */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4167 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4168 | if (!codec->bus->shutdown && spec->jacks.list) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4169 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4170 | int i; |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4171 | for (i = 0; i < spec->jacks.used; i++, jacks++) { |
| 4172 | if (jacks->jack) |
| 4173 | snd_device_free(codec->bus->card, jacks->jack); |
| 4174 | } |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4175 | } |
| 4176 | snd_array_free(&spec->jacks); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4177 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4178 | } |
| 4179 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4180 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 4181 | { |
| 4182 | struct sigmatel_spec *spec = codec->spec; |
| 4183 | |
| 4184 | if (spec->kctls.list) { |
| 4185 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4186 | int i; |
| 4187 | for (i = 0; i < spec->kctls.used; i++) |
| 4188 | kfree(kctl[i].name); |
| 4189 | } |
| 4190 | snd_array_free(&spec->kctls); |
| 4191 | } |
| 4192 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4193 | static void stac92xx_free(struct hda_codec *codec) |
| 4194 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4195 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4196 | |
| 4197 | if (! spec) |
| 4198 | return; |
| 4199 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4200 | stac92xx_free_jacks(codec); |
| 4201 | snd_array_free(&spec->events); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4202 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4203 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4204 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4205 | } |
| 4206 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4207 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4208 | unsigned int flag) |
| 4209 | { |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4210 | unsigned int old_ctl, pin_ctl; |
| 4211 | |
| 4212 | pin_ctl = snd_hda_codec_read(codec, nid, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4213 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4214 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4215 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4216 | /* |
| 4217 | * we need to check the current set-up direction of |
| 4218 | * shared input pins since they can be switched via |
| 4219 | * "xxx as Output" mixer switch |
| 4220 | */ |
| 4221 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4222 | if (nid == spec->line_switch || nid == spec->mic_switch) |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4223 | return; |
| 4224 | } |
| 4225 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4226 | old_ctl = pin_ctl; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4227 | /* if setting pin direction bits, clear the current |
| 4228 | direction bits first */ |
| 4229 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4230 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4231 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4232 | pin_ctl |= flag; |
| 4233 | if (old_ctl != pin_ctl) |
| 4234 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4235 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4236 | pin_ctl); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4237 | } |
| 4238 | |
| 4239 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4240 | unsigned int flag) |
| 4241 | { |
| 4242 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4243 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4244 | if (pin_ctl & flag) |
| 4245 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4246 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4247 | pin_ctl & ~flag); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4248 | } |
| 4249 | |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4250 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4251 | { |
| 4252 | if (!nid) |
| 4253 | return 0; |
| 4254 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4255 | & (1 << 31)) |
| 4256 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4257 | return 0; |
| 4258 | } |
| 4259 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4260 | /* return non-zero if the hp-pin of the given array index isn't |
| 4261 | * a jack-detection target |
| 4262 | */ |
| 4263 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4264 | { |
| 4265 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4266 | |
| 4267 | /* ignore sensing of shared line and mic jacks */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4268 | if (cfg->hp_pins[i] == spec->line_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4269 | return 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4270 | if (cfg->hp_pins[i] == spec->mic_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4271 | return 1; |
| 4272 | /* ignore if the pin is set as line-out */ |
| 4273 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4274 | return 1; |
| 4275 | return 0; |
| 4276 | } |
| 4277 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4278 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4279 | { |
| 4280 | struct sigmatel_spec *spec = codec->spec; |
| 4281 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4282 | int i, presence; |
| 4283 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4284 | presence = 0; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4285 | if (spec->gpio_mute) |
| 4286 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4287 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4288 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4289 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4290 | if (presence) |
| 4291 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4292 | if (no_hp_sensing(spec, i)) |
| 4293 | continue; |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4294 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 4295 | if (presence) { |
| 4296 | unsigned int pinctl; |
| 4297 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 4298 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4299 | if (pinctl & AC_PINCTL_IN_EN) |
| 4300 | presence = 0; /* mic- or line-input */ |
| 4301 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4302 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4303 | |
| 4304 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4305 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4306 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4307 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4308 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4309 | for (i = 0; i < cfg->line_outs; i++) |
| 4310 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4311 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4312 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4313 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4314 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4315 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4316 | stac_gpio_set(codec, spec->gpio_mask, |
| 4317 | spec->gpio_dir, spec->gpio_data & |
| 4318 | ~spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4319 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4320 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4321 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4322 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4323 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4324 | for (i = 0; i < cfg->line_outs; i++) |
| 4325 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4326 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4327 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4328 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4329 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4330 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4331 | stac_gpio_set(codec, spec->gpio_mask, |
| 4332 | spec->gpio_dir, spec->gpio_data | |
| 4333 | spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4334 | } |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4335 | /* toggle hp outs */ |
| 4336 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4337 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4338 | if (no_hp_sensing(spec, i)) |
| 4339 | continue; |
| 4340 | if (presence) |
| 4341 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4342 | #if 0 /* FIXME */ |
| 4343 | /* Resetting the pinctl like below may lead to (a sort of) regressions |
| 4344 | * on some devices since they use the HP pin actually for line/speaker |
| 4345 | * outs although the default pin config shows a different pin (that is |
| 4346 | * wrong and useless). |
| 4347 | * |
| 4348 | * So, it's basically a problem of default pin configs, likely a BIOS issue. |
| 4349 | * But, disabling the code below just works around it, and I'm too tired of |
| 4350 | * bug reports with such devices... |
| 4351 | */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4352 | else |
| 4353 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4354 | #endif /* FIXME */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4355 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4356 | } |
| 4357 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4358 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4359 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4360 | { |
| 4361 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4362 | unsigned int idx, val; |
| 4363 | |
| 4364 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4365 | if (spec->pwr_nids[idx] == nid) |
| 4366 | break; |
| 4367 | } |
| 4368 | if (idx >= spec->num_pwrs) |
| 4369 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4370 | |
| 4371 | /* several codecs have two power down bits */ |
| 4372 | if (spec->pwr_mapping) |
| 4373 | idx = spec->pwr_mapping[idx]; |
| 4374 | else |
| 4375 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4376 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4377 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
| 4378 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4379 | val &= ~idx; |
| 4380 | else |
| 4381 | val |= idx; |
| 4382 | |
| 4383 | /* power down unused output ports */ |
| 4384 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4385 | } |
| 4386 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4387 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4388 | { |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4389 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4390 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4391 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4392 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 4393 | { |
| 4394 | struct sigmatel_spec *spec = codec->spec; |
| 4395 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4396 | |
| 4397 | if (jacks) { |
| 4398 | int i; |
| 4399 | for (i = 0; i < spec->jacks.used; i++) { |
| 4400 | if (jacks->nid == nid) { |
| 4401 | unsigned int pin_ctl = |
| 4402 | snd_hda_codec_read(codec, nid, |
| 4403 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 4404 | 0x00); |
| 4405 | int type = jacks->type; |
| 4406 | if (type == (SND_JACK_LINEOUT |
| 4407 | | SND_JACK_HEADPHONE)) |
| 4408 | type = (pin_ctl & AC_PINCTL_HP_EN) |
| 4409 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; |
| 4410 | snd_jack_report(jacks->jack, |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4411 | get_pin_presence(codec, nid) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4412 | ? type : 0); |
| 4413 | } |
| 4414 | jacks++; |
| 4415 | } |
| 4416 | } |
| 4417 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4418 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4419 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 4420 | unsigned char type) |
| 4421 | { |
| 4422 | struct sigmatel_event *event = stac_get_event(codec, nid, type); |
| 4423 | if (!event) |
| 4424 | return; |
| 4425 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); |
| 4426 | } |
| 4427 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4428 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4429 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4430 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4431 | struct sigmatel_event *event; |
| 4432 | int tag, data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4433 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4434 | tag = (res >> 26) & 0x7f; |
| 4435 | event = stac_get_event_from_tag(codec, tag); |
| 4436 | if (!event) |
| 4437 | return; |
| 4438 | |
| 4439 | switch (event->type) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4440 | case STAC_HP_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4441 | stac92xx_hp_detect(codec); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4442 | /* fallthru */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4443 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4444 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4445 | if (spec->num_pwrs > 0) |
| 4446 | stac92xx_pin_sense(codec, event->nid); |
| 4447 | stac92xx_report_jack(codec, event->nid); |
Matthew Ranostay | fd60cc8 | 2009-04-06 09:30:46 -0400 | [diff] [blame] | 4448 | |
| 4449 | switch (codec->subsystem_id) { |
| 4450 | case 0x103c308f: |
| 4451 | if (event->nid == 0xb) { |
| 4452 | int pin = AC_PINCTL_IN_EN; |
| 4453 | |
| 4454 | if (get_pin_presence(codec, 0xa) |
| 4455 | && get_pin_presence(codec, 0xb)) |
| 4456 | pin |= AC_PINCTL_VREF_80; |
| 4457 | if (!get_pin_presence(codec, 0xb)) |
| 4458 | pin |= AC_PINCTL_VREF_80; |
| 4459 | |
| 4460 | /* toggle VREF state based on mic + hp pin |
| 4461 | * status |
| 4462 | */ |
| 4463 | stac92xx_auto_set_pinctl(codec, 0x0a, pin); |
| 4464 | } |
| 4465 | } |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4466 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4467 | case STAC_VREF_EVENT: |
| 4468 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4469 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4470 | /* toggle VREF state based on GPIOx status */ |
| 4471 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4472 | !!(data & (1 << event->data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4473 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4474 | } |
| 4475 | } |
| 4476 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4477 | #ifdef CONFIG_PROC_FS |
| 4478 | static void stac92hd_proc_hook(struct snd_info_buffer *buffer, |
| 4479 | struct hda_codec *codec, hda_nid_t nid) |
| 4480 | { |
| 4481 | if (nid == codec->afg) |
| 4482 | snd_iprintf(buffer, "Power-Map: 0x%02x\n", |
| 4483 | snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); |
| 4484 | } |
| 4485 | |
| 4486 | static void analog_loop_proc_hook(struct snd_info_buffer *buffer, |
| 4487 | struct hda_codec *codec, |
| 4488 | unsigned int verb) |
| 4489 | { |
| 4490 | snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", |
| 4491 | snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); |
| 4492 | } |
| 4493 | |
| 4494 | /* stac92hd71bxx, stac92hd73xx */ |
| 4495 | static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, |
| 4496 | struct hda_codec *codec, hda_nid_t nid) |
| 4497 | { |
| 4498 | stac92hd_proc_hook(buffer, codec, nid); |
| 4499 | if (nid == codec->afg) |
| 4500 | analog_loop_proc_hook(buffer, codec, 0xfa0); |
| 4501 | } |
| 4502 | |
| 4503 | static void stac9205_proc_hook(struct snd_info_buffer *buffer, |
| 4504 | struct hda_codec *codec, hda_nid_t nid) |
| 4505 | { |
| 4506 | if (nid == codec->afg) |
| 4507 | analog_loop_proc_hook(buffer, codec, 0xfe0); |
| 4508 | } |
| 4509 | |
| 4510 | static void stac927x_proc_hook(struct snd_info_buffer *buffer, |
| 4511 | struct hda_codec *codec, hda_nid_t nid) |
| 4512 | { |
| 4513 | if (nid == codec->afg) |
| 4514 | analog_loop_proc_hook(buffer, codec, 0xfeb); |
| 4515 | } |
| 4516 | #else |
| 4517 | #define stac92hd_proc_hook NULL |
| 4518 | #define stac92hd7x_proc_hook NULL |
| 4519 | #define stac9205_proc_hook NULL |
| 4520 | #define stac927x_proc_hook NULL |
| 4521 | #endif |
| 4522 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4523 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4524 | static int stac92xx_resume(struct hda_codec *codec) |
| 4525 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4526 | struct sigmatel_spec *spec = codec->spec; |
| 4527 | |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4528 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4529 | snd_hda_codec_resume_amp(codec); |
| 4530 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4531 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4532 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4533 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 4534 | STAC_HP_EVENT); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4535 | return 0; |
| 4536 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4537 | |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4538 | |
| 4539 | /* |
| 4540 | * using power check for controlling mute led of HP HDX notebooks |
| 4541 | * check for mute state only on Speakers (nid = 0x10) |
| 4542 | * |
| 4543 | * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise |
| 4544 | * the LED is NOT working properly ! |
| 4545 | */ |
| 4546 | |
| 4547 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4548 | static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec, |
| 4549 | hda_nid_t nid) |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4550 | { |
| 4551 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4552 | |
| 4553 | if (nid == 0x10) { |
| 4554 | if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4555 | HDA_AMP_MUTE) |
| 4556 | spec->gpio_data &= ~0x08; /* orange */ |
| 4557 | else |
| 4558 | spec->gpio_data |= 0x08; /* white */ |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4559 | |
| 4560 | stac_gpio_set(codec, spec->gpio_mask, |
| 4561 | spec->gpio_dir, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4562 | spec->gpio_data); |
| 4563 | } |
| 4564 | |
| 4565 | return 0; |
| 4566 | } |
| 4567 | #endif |
| 4568 | |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4569 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4570 | { |
| 4571 | struct sigmatel_spec *spec = codec->spec; |
| 4572 | if (spec->eapd_mask) |
| 4573 | stac_gpio_set(codec, spec->gpio_mask, |
| 4574 | spec->gpio_dir, spec->gpio_data & |
| 4575 | ~spec->eapd_mask); |
| 4576 | return 0; |
| 4577 | } |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4578 | #endif |
| 4579 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4580 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 4581 | .build_controls = stac92xx_build_controls, |
| 4582 | .build_pcms = stac92xx_build_pcms, |
| 4583 | .init = stac92xx_init, |
| 4584 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4585 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4586 | #ifdef SND_HDA_NEEDS_RESUME |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4587 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4588 | .resume = stac92xx_resume, |
| 4589 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4590 | }; |
| 4591 | |
| 4592 | static int patch_stac9200(struct hda_codec *codec) |
| 4593 | { |
| 4594 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4595 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4596 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4597 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4598 | if (spec == NULL) |
| 4599 | return -ENOMEM; |
| 4600 | |
| 4601 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4602 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4603 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4604 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 4605 | stac9200_models, |
| 4606 | stac9200_cfg_tbl); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4607 | if (spec->board_config < 0) |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4608 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4609 | else |
| 4610 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4611 | stac9200_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4612 | |
| 4613 | spec->multiout.max_channels = 2; |
| 4614 | spec->multiout.num_dacs = 1; |
| 4615 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 4616 | spec->adc_nids = stac9200_adc_nids; |
| 4617 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 4618 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4619 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4620 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4621 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4622 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4623 | if (spec->board_config == STAC_9200_M4 || |
| 4624 | spec->board_config == STAC_9200_M4_2 || |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 4625 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 4626 | spec->init = stac9200_eapd_init; |
| 4627 | else |
| 4628 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4629 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4630 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 4631 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 4632 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 4633 | spec->gpio_data = 0x00; |
| 4634 | } |
| 4635 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4636 | err = stac9200_parse_auto_config(codec); |
| 4637 | if (err < 0) { |
| 4638 | stac92xx_free(codec); |
| 4639 | return err; |
| 4640 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4641 | |
Takashi Iwai | 2acc9dc | 2009-01-09 16:57:14 +0100 | [diff] [blame] | 4642 | /* CF-74 has no headphone detection, and the driver should *NOT* |
| 4643 | * do detection and HP/speaker toggle because the hardware does it. |
| 4644 | */ |
| 4645 | if (spec->board_config == STAC_9200_PANASONIC) |
| 4646 | spec->hp_detect = 0; |
| 4647 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4648 | codec->patch_ops = stac92xx_patch_ops; |
| 4649 | |
| 4650 | return 0; |
| 4651 | } |
| 4652 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4653 | static int patch_stac925x(struct hda_codec *codec) |
| 4654 | { |
| 4655 | struct sigmatel_spec *spec; |
| 4656 | int err; |
| 4657 | |
| 4658 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4659 | if (spec == NULL) |
| 4660 | return -ENOMEM; |
| 4661 | |
| 4662 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4663 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4664 | spec->pin_nids = stac925x_pin_nids; |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4665 | |
| 4666 | /* Check first for codec ID */ |
| 4667 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, |
| 4668 | STAC_925x_MODELS, |
| 4669 | stac925x_models, |
| 4670 | stac925x_codec_id_cfg_tbl); |
| 4671 | |
| 4672 | /* Now checks for PCI ID, if codec ID is not found */ |
| 4673 | if (spec->board_config < 0) |
| 4674 | spec->board_config = snd_hda_check_board_config(codec, |
| 4675 | STAC_925x_MODELS, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4676 | stac925x_models, |
| 4677 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4678 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4679 | if (spec->board_config < 0) |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4680 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4681 | "using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4682 | else |
| 4683 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4684 | stac925x_brd_tbl[spec->board_config]); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4685 | |
| 4686 | spec->multiout.max_channels = 2; |
| 4687 | spec->multiout.num_dacs = 1; |
| 4688 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 4689 | spec->adc_nids = stac925x_adc_nids; |
| 4690 | spec->mux_nids = stac925x_mux_nids; |
| 4691 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4692 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4693 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4694 | switch (codec->vendor_id) { |
| 4695 | case 0x83847632: /* STAC9202 */ |
| 4696 | case 0x83847633: /* STAC9202D */ |
| 4697 | case 0x83847636: /* STAC9251 */ |
| 4698 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 4699 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4700 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4701 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 4702 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4703 | break; |
| 4704 | default: |
| 4705 | spec->num_dmics = 0; |
| 4706 | break; |
| 4707 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4708 | |
| 4709 | spec->init = stac925x_core_init; |
| 4710 | spec->mixer = stac925x_mixer; |
| 4711 | |
| 4712 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4713 | if (!err) { |
| 4714 | if (spec->board_config < 0) { |
| 4715 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4716 | "available, default to model=ref\n"); |
| 4717 | spec->board_config = STAC_925x_REF; |
| 4718 | goto again; |
| 4719 | } |
| 4720 | err = -EINVAL; |
| 4721 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4722 | if (err < 0) { |
| 4723 | stac92xx_free(codec); |
| 4724 | return err; |
| 4725 | } |
| 4726 | |
| 4727 | codec->patch_ops = stac92xx_patch_ops; |
| 4728 | |
| 4729 | return 0; |
| 4730 | } |
| 4731 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4732 | static struct hda_input_mux stac92hd73xx_dmux = { |
| 4733 | .num_items = 4, |
| 4734 | .items = { |
| 4735 | { "Analog Inputs", 0x0b }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4736 | { "Digital Mic 1", 0x09 }, |
| 4737 | { "Digital Mic 2", 0x0a }, |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4738 | { "CD", 0x08 }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4739 | } |
| 4740 | }; |
| 4741 | |
| 4742 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 4743 | { |
| 4744 | struct sigmatel_spec *spec; |
| 4745 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 4746 | int err = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4747 | int num_dacs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4748 | |
| 4749 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4750 | if (spec == NULL) |
| 4751 | return -ENOMEM; |
| 4752 | |
| 4753 | codec->spec = spec; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 4754 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4755 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 4756 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 4757 | spec->board_config = snd_hda_check_board_config(codec, |
| 4758 | STAC_92HD73XX_MODELS, |
| 4759 | stac92hd73xx_models, |
| 4760 | stac92hd73xx_cfg_tbl); |
| 4761 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4762 | if (spec->board_config < 0) |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4763 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4764 | " STAC92HD73XX, using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4765 | else |
| 4766 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4767 | stac92hd73xx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4768 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4769 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4770 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 4771 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4772 | if (num_dacs < 3 || num_dacs > 5) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4773 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 4774 | "number of channels defaulting to DAC count\n"); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4775 | num_dacs = STAC92HD73_DAC_COUNT; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4776 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4777 | switch (num_dacs) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4778 | case 0x3: /* 6 Channel */ |
| 4779 | spec->mixer = stac92hd73xx_6ch_mixer; |
| 4780 | spec->init = stac92hd73xx_6ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 4781 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4782 | break; |
| 4783 | case 0x4: /* 8 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4784 | spec->mixer = stac92hd73xx_8ch_mixer; |
| 4785 | spec->init = stac92hd73xx_8ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 4786 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4787 | break; |
| 4788 | case 0x5: /* 10 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4789 | spec->mixer = stac92hd73xx_10ch_mixer; |
| 4790 | spec->init = stac92hd73xx_10ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 4791 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; |
| 4792 | break; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4793 | } |
| 4794 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4795 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4796 | spec->aloopback_mask = 0x01; |
| 4797 | spec->aloopback_shift = 8; |
| 4798 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4799 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4800 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 4801 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 4802 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 4803 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4804 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 4805 | spec->amp_nids = stac92hd73xx_amp_nids; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4806 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4807 | |
| 4808 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 4809 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4810 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4811 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
| 4812 | sizeof(stac92hd73xx_dmux)); |
| 4813 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4814 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4815 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 4816 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4817 | /* fallthru */ |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4818 | case STAC_DELL_M6_AMIC: |
| 4819 | case STAC_DELL_M6_DMIC: |
| 4820 | case STAC_DELL_M6_BOTH: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4821 | spec->num_smuxes = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4822 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
| 4823 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4824 | spec->eapd_switch = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4825 | spec->num_amps = 1; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4826 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4827 | if (spec->board_config != STAC_DELL_EQ) |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4828 | spec->init = dell_m6_core_init; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4829 | switch (spec->board_config) { |
| 4830 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4831 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4832 | spec->num_dmics = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4833 | spec->private_dimux.num_items = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4834 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4835 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4836 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4837 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4838 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4839 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4840 | case STAC_DELL_M6_BOTH: /* Both */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4841 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
| 4842 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4843 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4844 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4845 | break; |
| 4846 | } |
| 4847 | break; |
| 4848 | default: |
| 4849 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4850 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4851 | spec->eapd_switch = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4852 | } |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 4853 | if (spec->board_config > STAC_92HD73XX_REF) { |
| 4854 | /* GPIO0 High = Enable EAPD */ |
| 4855 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 4856 | spec->gpio_data = 0x01; |
| 4857 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4858 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4859 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4860 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 4861 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 4862 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4863 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4864 | |
| 4865 | if (!err) { |
| 4866 | if (spec->board_config < 0) { |
| 4867 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4868 | "available, default to model=ref\n"); |
| 4869 | spec->board_config = STAC_92HD73XX_REF; |
| 4870 | goto again; |
| 4871 | } |
| 4872 | err = -EINVAL; |
| 4873 | } |
| 4874 | |
| 4875 | if (err < 0) { |
| 4876 | stac92xx_free(codec); |
| 4877 | return err; |
| 4878 | } |
| 4879 | |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 4880 | if (spec->board_config == STAC_92HD73XX_NO_JD) |
| 4881 | spec->hp_detect = 0; |
| 4882 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4883 | codec->patch_ops = stac92xx_patch_ops; |
| 4884 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4885 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 4886 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4887 | return 0; |
| 4888 | } |
| 4889 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4890 | static struct hda_input_mux stac92hd83xxx_dmux = { |
| 4891 | .num_items = 3, |
| 4892 | .items = { |
| 4893 | { "Analog Inputs", 0x03 }, |
| 4894 | { "Digital Mic 1", 0x04 }, |
| 4895 | { "Digital Mic 2", 0x05 }, |
| 4896 | } |
| 4897 | }; |
| 4898 | |
| 4899 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 4900 | { |
| 4901 | struct sigmatel_spec *spec; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 4902 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4903 | int err; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 4904 | int num_dacs; |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 4905 | hda_nid_t nid; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4906 | |
| 4907 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4908 | if (spec == NULL) |
| 4909 | return -ENOMEM; |
| 4910 | |
| 4911 | codec->spec = spec; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 4912 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4913 | spec->mono_nid = 0x19; |
| 4914 | spec->digbeep_nid = 0x21; |
| 4915 | spec->dmic_nids = stac92hd83xxx_dmic_nids; |
| 4916 | spec->dmux_nids = stac92hd83xxx_dmux_nids; |
| 4917 | spec->adc_nids = stac92hd83xxx_adc_nids; |
| 4918 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 4919 | spec->amp_nids = stac92hd83xxx_amp_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4920 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; |
| 4921 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4922 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4923 | |
| 4924 | spec->init = stac92hd83xxx_core_init; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4925 | spec->mixer = stac92hd83xxx_mixer; |
| 4926 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
| 4927 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); |
| 4928 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 4929 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4930 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; |
| 4931 | spec->dinput_mux = &stac92hd83xxx_dmux; |
| 4932 | spec->pin_nids = stac92hd83xxx_pin_nids; |
| 4933 | spec->board_config = snd_hda_check_board_config(codec, |
| 4934 | STAC_92HD83XXX_MODELS, |
| 4935 | stac92hd83xxx_models, |
| 4936 | stac92hd83xxx_cfg_tbl); |
| 4937 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4938 | if (spec->board_config < 0) |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4939 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4940 | " STAC92HD83XXX, using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4941 | else |
| 4942 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4943 | stac92hd83xxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4944 | |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 4945 | switch (codec->vendor_id) { |
| 4946 | case 0x111d7604: |
| 4947 | case 0x111d7605: |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 4948 | case 0x111d76d5: |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 4949 | if (spec->board_config == STAC_92HD83XXX_PWR_REF) |
| 4950 | break; |
| 4951 | spec->num_pwrs = 0; |
| 4952 | break; |
| 4953 | } |
| 4954 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4955 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); |
| 4956 | if (!err) { |
| 4957 | if (spec->board_config < 0) { |
| 4958 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4959 | "available, default to model=ref\n"); |
| 4960 | spec->board_config = STAC_92HD83XXX_REF; |
| 4961 | goto again; |
| 4962 | } |
| 4963 | err = -EINVAL; |
| 4964 | } |
| 4965 | |
| 4966 | if (err < 0) { |
| 4967 | stac92xx_free(codec); |
| 4968 | return err; |
| 4969 | } |
| 4970 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 4971 | switch (spec->board_config) { |
| 4972 | case STAC_DELL_S14: |
| 4973 | nid = 0xf; |
| 4974 | break; |
| 4975 | default: |
| 4976 | nid = 0xe; |
| 4977 | break; |
| 4978 | } |
| 4979 | |
| 4980 | num_dacs = snd_hda_get_connections(codec, nid, |
| 4981 | conn, STAC92HD83_DAC_COUNT + 1) - 1; |
| 4982 | |
| 4983 | /* set port X to select the last DAC |
| 4984 | */ |
| 4985 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4986 | AC_VERB_SET_CONNECT_SEL, num_dacs); |
| 4987 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4988 | codec->patch_ops = stac92xx_patch_ops; |
| 4989 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4990 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 4991 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4992 | return 0; |
| 4993 | } |
| 4994 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 4995 | static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { |
| 4996 | .num_items = 3, |
| 4997 | .items = { |
| 4998 | { "Analog Inputs", 0x00 }, |
| 4999 | { "Digital Mic 1", 0x02 }, |
| 5000 | { "Digital Mic 2", 0x03 }, |
| 5001 | } |
| 5002 | }; |
| 5003 | |
| 5004 | static struct hda_input_mux stac92hd71bxx_dmux_amixer = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5005 | .num_items = 4, |
| 5006 | .items = { |
| 5007 | { "Analog Inputs", 0x00 }, |
| 5008 | { "Mixer", 0x01 }, |
| 5009 | { "Digital Mic 1", 0x02 }, |
| 5010 | { "Digital Mic 2", 0x03 }, |
| 5011 | } |
| 5012 | }; |
| 5013 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5014 | /* get the pin connection (fixed, none, etc) */ |
| 5015 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
| 5016 | { |
| 5017 | struct sigmatel_spec *spec = codec->spec; |
| 5018 | unsigned int cfg; |
| 5019 | |
| 5020 | cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); |
| 5021 | return get_defcfg_connect(cfg); |
| 5022 | } |
| 5023 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5024 | static int stac92hd71bxx_connected_ports(struct hda_codec *codec, |
| 5025 | hda_nid_t *nids, int num_nids) |
| 5026 | { |
| 5027 | struct sigmatel_spec *spec = codec->spec; |
| 5028 | int idx, num; |
| 5029 | unsigned int def_conf; |
| 5030 | |
| 5031 | for (num = 0; num < num_nids; num++) { |
| 5032 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5033 | if (spec->pin_nids[idx] == nids[num]) |
| 5034 | break; |
| 5035 | if (idx >= spec->num_pins) |
| 5036 | break; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5037 | def_conf = stac_get_defcfg_connect(codec, idx); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5038 | if (def_conf == AC_JACK_PORT_NONE) |
| 5039 | break; |
| 5040 | } |
| 5041 | return num; |
| 5042 | } |
| 5043 | |
| 5044 | static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, |
| 5045 | hda_nid_t dig0pin) |
| 5046 | { |
| 5047 | struct sigmatel_spec *spec = codec->spec; |
| 5048 | int idx; |
| 5049 | |
| 5050 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5051 | if (spec->pin_nids[idx] == dig0pin) |
| 5052 | break; |
| 5053 | if ((idx + 2) >= spec->num_pins) |
| 5054 | return 0; |
| 5055 | |
| 5056 | /* dig1pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5057 | 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] | 5058 | return 2; |
| 5059 | |
| 5060 | /* dig0pin + dig2pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5061 | 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] | 5062 | return 2; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5063 | if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5064 | return 1; |
| 5065 | else |
| 5066 | return 0; |
| 5067 | } |
| 5068 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5069 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 5070 | { |
| 5071 | struct sigmatel_spec *spec; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5072 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5073 | int err = 0; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5074 | unsigned int ndmic_nids = 0; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5075 | |
| 5076 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5077 | if (spec == NULL) |
| 5078 | return -ENOMEM; |
| 5079 | |
| 5080 | codec->spec = spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5081 | codec->patch_ops = stac92xx_patch_ops; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 5082 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
| 5083 | switch (codec->vendor_id) { |
| 5084 | case 0x111d76b6: |
| 5085 | case 0x111d76b7: |
| 5086 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; |
| 5087 | break; |
| 5088 | case 0x111d7603: |
| 5089 | case 0x111d7608: |
| 5090 | /* On 92HD75Bx 0x27 isn't a pin nid */ |
| 5091 | spec->num_pins--; |
| 5092 | /* fallthrough */ |
| 5093 | default: |
| 5094 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; |
| 5095 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5096 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5097 | spec->board_config = snd_hda_check_board_config(codec, |
| 5098 | STAC_92HD71BXX_MODELS, |
| 5099 | stac92hd71bxx_models, |
| 5100 | stac92hd71bxx_cfg_tbl); |
| 5101 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5102 | if (spec->board_config < 0) |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5103 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 5104 | " STAC92HD71BXX, using BIOS defaults\n"); |
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 | stac92hd71bxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5108 | |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 5109 | if (spec->board_config > STAC_92HD71BXX_REF) { |
| 5110 | /* GPIO0 = EAPD */ |
| 5111 | spec->gpio_mask = 0x01; |
| 5112 | spec->gpio_dir = 0x01; |
| 5113 | spec->gpio_data = 0x01; |
| 5114 | } |
| 5115 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5116 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
| 5117 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
| 5118 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5119 | switch (codec->vendor_id) { |
| 5120 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 5121 | case 0x111d76b7: |
Herton Ronaldo Krzesinski | 23c7b52 | 2009-02-08 19:51:28 -0200 | [diff] [blame] | 5122 | unmute_init++; |
| 5123 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5124 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 5125 | case 0x111d76b5: |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5126 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, |
| 5127 | sizeof(stac92hd71bxx_dmux_nomixer)); |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5128 | spec->mixer = stac92hd71bxx_mixer; |
| 5129 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5130 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5131 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5132 | stac92hd71bxx_dmic_nids, |
| 5133 | STAC92HD71BXX_NUM_DMICS); |
| 5134 | if (spec->num_dmics) { |
| 5135 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5136 | spec->dinput_mux = &spec->private_dimux; |
| 5137 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; |
| 5138 | } |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5139 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5140 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5141 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, |
| 5142 | sizeof(stac92hd71bxx_dmux_amixer)); |
| 5143 | spec->private_dimux.num_items--; |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 5144 | switch (spec->board_config) { |
| 5145 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5146 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5147 | err = stac_add_event(spec, codec->afg, |
| 5148 | STAC_VREF_EVENT, 0x02); |
| 5149 | if (err < 0) |
| 5150 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5151 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5152 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
| 5153 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 5154 | AC_VERB_SET_UNSOLICITED_ENABLE, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5155 | AC_USRSP_EN | err); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5156 | spec->gpio_mask |= 0x02; |
| 5157 | break; |
| 5158 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5159 | if ((codec->revision_id & 0xf) == 0 || |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5160 | (codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5161 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5162 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5163 | /* no output amps */ |
| 5164 | spec->num_pwrs = 0; |
| 5165 | spec->mixer = stac92hd71bxx_analog_mixer; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5166 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5167 | |
| 5168 | /* disable VSW */ |
| 5169 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5170 | unmute_init++; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5171 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); |
| 5172 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5173 | stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; |
| 5174 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5175 | stac92hd71bxx_dmic_nids, |
| 5176 | STAC92HD71BXX_NUM_DMICS - 1); |
| 5177 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5178 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5179 | break; |
| 5180 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5181 | if ((codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5182 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5183 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5184 | /* no output amps */ |
| 5185 | spec->num_pwrs = 0; |
| 5186 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5187 | default: |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5188 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, |
| 5189 | sizeof(stac92hd71bxx_dmux_amixer)); |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5190 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5191 | spec->mixer = stac92hd71bxx_analog_mixer; |
| 5192 | spec->init = stac92hd71bxx_analog_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5193 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5194 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5195 | stac92hd71bxx_dmic_nids, |
| 5196 | STAC92HD71BXX_NUM_DMICS); |
| 5197 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5198 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5199 | } |
| 5200 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5201 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
| 5202 | snd_hda_sequence_write_cache(codec, unmute_init); |
| 5203 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5204 | spec->aloopback_ctl = stac92hd71bxx_loopback; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5205 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5206 | spec->aloopback_shift = 0; |
| 5207 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5208 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5209 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5210 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 5211 | spec->adc_nids = stac92hd71bxx_adc_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5212 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5213 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5214 | |
| 5215 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 5216 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5217 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5218 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5219 | switch (spec->board_config) { |
| 5220 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5221 | /* enable internal microphone */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5222 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea71 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 5223 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 5224 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 5225 | /* fallthru */ |
| 5226 | case STAC_DELL_M4_2: |
| 5227 | spec->num_dmics = 0; |
| 5228 | spec->num_smuxes = 0; |
| 5229 | spec->num_dmuxes = 0; |
| 5230 | break; |
| 5231 | case STAC_DELL_M4_1: |
| 5232 | case STAC_DELL_M4_3: |
| 5233 | spec->num_dmics = 1; |
| 5234 | spec->num_smuxes = 0; |
Takashi Iwai | ea18aa4 | 2009-02-27 17:36:33 +0100 | [diff] [blame] | 5235 | spec->num_dmuxes = 1; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5236 | break; |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5237 | case STAC_HP_DV5: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5238 | snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5239 | stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); |
| 5240 | break; |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5241 | case STAC_HP_HDX: |
| 5242 | spec->num_dmics = 1; |
| 5243 | spec->num_dmuxes = 1; |
| 5244 | spec->num_smuxes = 1; |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 5245 | /* |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5246 | * For controlling MUTE LED on HP HDX16/HDX18 notebooks, |
| 5247 | * the CONFIG_SND_HDA_POWER_SAVE is needed to be set. |
| 5248 | */ |
| 5249 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5250 | /* orange/white mute led on GPIO3, orange=0, white=1 */ |
| 5251 | spec->gpio_mask |= 0x08; |
| 5252 | spec->gpio_dir |= 0x08; |
| 5253 | spec->gpio_data |= 0x08; /* set to white */ |
| 5254 | |
| 5255 | /* register check_power_status callback. */ |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 5256 | codec->patch_ops.check_power_status = |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5257 | stac92xx_hp_hdx_check_power_status; |
| 5258 | #endif |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5259 | break; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5260 | }; |
| 5261 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5262 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5263 | if (spec->dinput_mux) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5264 | spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5265 | |
Herton Ronaldo Krzesinski | 29d4ab4 | 2009-02-04 11:37:27 -0500 | [diff] [blame] | 5266 | err = stac92xx_parse_auto_config(codec, 0x21, 0); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5267 | if (!err) { |
| 5268 | if (spec->board_config < 0) { |
| 5269 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5270 | "available, default to model=ref\n"); |
| 5271 | spec->board_config = STAC_92HD71BXX_REF; |
| 5272 | goto again; |
| 5273 | } |
| 5274 | err = -EINVAL; |
| 5275 | } |
| 5276 | |
| 5277 | if (err < 0) { |
| 5278 | stac92xx_free(codec); |
| 5279 | return err; |
| 5280 | } |
| 5281 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5282 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5283 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5284 | return 0; |
| 5285 | }; |
| 5286 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5287 | static int patch_stac922x(struct hda_codec *codec) |
| 5288 | { |
| 5289 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5290 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5291 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5292 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5293 | if (spec == NULL) |
| 5294 | return -ENOMEM; |
| 5295 | |
| 5296 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5297 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5298 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5299 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 5300 | stac922x_models, |
| 5301 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5302 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5303 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 5304 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5305 | /* Intel Macs have all same PCI SSID, so we need to check |
| 5306 | * codec SSID to distinguish the exact models |
| 5307 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5308 | 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] | 5309 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5310 | |
| 5311 | case 0x106b0800: |
| 5312 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 5313 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5314 | case 0x106b0600: |
| 5315 | case 0x106b0700: |
| 5316 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5317 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5318 | case 0x106b0e00: |
| 5319 | case 0x106b0f00: |
| 5320 | case 0x106b1600: |
| 5321 | case 0x106b1700: |
| 5322 | case 0x106b0200: |
| 5323 | case 0x106b1e00: |
| 5324 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5325 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5326 | case 0x106b1a00: |
| 5327 | case 0x00000100: |
| 5328 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 5329 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5330 | case 0x106b0a00: |
| 5331 | case 0x106b2200: |
| 5332 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 5333 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5334 | default: |
| 5335 | spec->board_config = STAC_INTEL_MAC_V3; |
| 5336 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5337 | } |
| 5338 | } |
| 5339 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5340 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5341 | if (spec->board_config < 0) |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5342 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 5343 | "using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5344 | else |
| 5345 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5346 | stac922x_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5347 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5348 | spec->adc_nids = stac922x_adc_nids; |
| 5349 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5350 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5351 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5352 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5353 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5354 | |
| 5355 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5356 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5357 | |
| 5358 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 5359 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5360 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5361 | if (!err) { |
| 5362 | if (spec->board_config < 0) { |
| 5363 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5364 | "available, default to model=ref\n"); |
| 5365 | spec->board_config = STAC_D945_REF; |
| 5366 | goto again; |
| 5367 | } |
| 5368 | err = -EINVAL; |
| 5369 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5370 | if (err < 0) { |
| 5371 | stac92xx_free(codec); |
| 5372 | return err; |
| 5373 | } |
| 5374 | |
| 5375 | codec->patch_ops = stac92xx_patch_ops; |
| 5376 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 5377 | /* Fix Mux capture level; max to 2 */ |
| 5378 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 5379 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 5380 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 5381 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 5382 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 5383 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5384 | return 0; |
| 5385 | } |
| 5386 | |
| 5387 | static int patch_stac927x(struct hda_codec *codec) |
| 5388 | { |
| 5389 | struct sigmatel_spec *spec; |
| 5390 | int err; |
| 5391 | |
| 5392 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5393 | if (spec == NULL) |
| 5394 | return -ENOMEM; |
| 5395 | |
| 5396 | codec->spec = spec; |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 5397 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5398 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5399 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5400 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 5401 | stac927x_models, |
| 5402 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5403 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5404 | if (spec->board_config < 0) |
Herton Ronaldo Krzesinski | c98041f | 2009-02-11 20:33:15 -0200 | [diff] [blame] | 5405 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 5406 | "STAC927x, using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5407 | else |
| 5408 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5409 | stac927x_brd_tbl[spec->board_config]); |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5410 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5411 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5412 | spec->adc_nids = stac927x_adc_nids; |
| 5413 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 5414 | spec->mux_nids = stac927x_mux_nids; |
| 5415 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5416 | spec->smux_nids = stac927x_smux_nids; |
| 5417 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 5418 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 5419 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5420 | spec->multiout.dac_nids = spec->dac_nids; |
| 5421 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5422 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5423 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5424 | case STAC_D965_5ST: |
| 5425 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5426 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5427 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5428 | spec->num_dmics = 0; |
| 5429 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5430 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5431 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5432 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5433 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5434 | switch (codec->subsystem_id) { |
| 5435 | case 0x10280209: |
| 5436 | case 0x1028022e: |
| 5437 | /* correct the device field to SPDIF out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5438 | snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5439 | break; |
| 5440 | }; |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 5441 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5442 | snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 5443 | /* correct the front output jack as a hp out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5444 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5445 | /* correct the front input jack as a mic */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5446 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5447 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5448 | case STAC_DELL_3ST: |
| 5449 | /* GPIO2 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5450 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5451 | spec->gpio_data = 0x04; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5452 | spec->dmic_nids = stac927x_dmic_nids; |
| 5453 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 5454 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5455 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5456 | spec->mixer = stac927x_mixer; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5457 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5458 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5459 | break; |
| 5460 | default: |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5461 | if (spec->board_config > STAC_D965_REF) { |
| 5462 | /* GPIO0 High = Enable EAPD */ |
| 5463 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 5464 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 5465 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5466 | spec->num_dmics = 0; |
| 5467 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5468 | spec->init = stac927x_core_init; |
| 5469 | spec->mixer = stac927x_mixer; |
| 5470 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5471 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5472 | spec->num_pwrs = 0; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5473 | spec->aloopback_ctl = stac927x_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5474 | spec->aloopback_mask = 0x40; |
| 5475 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5476 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5477 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5478 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5479 | if (!err) { |
| 5480 | if (spec->board_config < 0) { |
| 5481 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5482 | "available, default to model=ref\n"); |
| 5483 | spec->board_config = STAC_D965_REF; |
| 5484 | goto again; |
| 5485 | } |
| 5486 | err = -EINVAL; |
| 5487 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5488 | if (err < 0) { |
| 5489 | stac92xx_free(codec); |
| 5490 | return err; |
| 5491 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5492 | |
| 5493 | codec->patch_ops = stac92xx_patch_ops; |
| 5494 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5495 | codec->proc_widget_hook = stac927x_proc_hook; |
| 5496 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 5497 | /* |
| 5498 | * !!FIXME!! |
| 5499 | * The STAC927x seem to require fairly long delays for certain |
| 5500 | * command sequences. With too short delays (even if the answer |
| 5501 | * is set to RIRB properly), it results in the silence output |
| 5502 | * on some hardwares like Dell. |
| 5503 | * |
| 5504 | * The below flag enables the longer delay (see get_response |
| 5505 | * in hda_intel.c). |
| 5506 | */ |
| 5507 | codec->bus->needs_damn_long_delay = 1; |
| 5508 | |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 5509 | /* no jack detecion for ref-no-jd model */ |
| 5510 | if (spec->board_config == STAC_D965_REF_NO_JD) |
| 5511 | spec->hp_detect = 0; |
| 5512 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5513 | return 0; |
| 5514 | } |
| 5515 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5516 | static int patch_stac9205(struct hda_codec *codec) |
| 5517 | { |
| 5518 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 5519 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5520 | |
| 5521 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5522 | if (spec == NULL) |
| 5523 | return -ENOMEM; |
| 5524 | |
| 5525 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5526 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5527 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5528 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 5529 | stac9205_models, |
| 5530 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5531 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5532 | if (spec->board_config < 0) |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5533 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5534 | else |
| 5535 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5536 | stac9205_brd_tbl[spec->board_config]); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5537 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5538 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5539 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5540 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5541 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5542 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5543 | spec->smux_nids = stac9205_smux_nids; |
| 5544 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5545 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5546 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5547 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5548 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5549 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5550 | |
| 5551 | spec->init = stac9205_core_init; |
| 5552 | spec->mixer = stac9205_mixer; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5553 | spec->aloopback_ctl = stac9205_loopback; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5554 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5555 | spec->aloopback_mask = 0x40; |
| 5556 | spec->aloopback_shift = 0; |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 5557 | /* Turn on/off EAPD per HP plugging */ |
| 5558 | if (spec->board_config != STAC_9205_EAPD) |
| 5559 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5560 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5561 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5562 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5563 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5564 | /* Enable SPDIF in/out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5565 | snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); |
| 5566 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 5567 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5568 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5569 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); |
| 5570 | if (err < 0) |
| 5571 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5572 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5573 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
| 5574 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5575 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 5576 | AC_USRSP_EN | err); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5577 | |
| 5578 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5579 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5580 | spec->gpio_mask = 0x1b; |
| 5581 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 5582 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5583 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5584 | */ |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5585 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5586 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5587 | case STAC_9205_REF: |
| 5588 | /* SPDIF-In enabled */ |
| 5589 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5590 | default: |
| 5591 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5592 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5593 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5594 | break; |
| 5595 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5596 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5597 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5598 | if (!err) { |
| 5599 | if (spec->board_config < 0) { |
| 5600 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5601 | "available, default to model=ref\n"); |
| 5602 | spec->board_config = STAC_9205_REF; |
| 5603 | goto again; |
| 5604 | } |
| 5605 | err = -EINVAL; |
| 5606 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5607 | if (err < 0) { |
| 5608 | stac92xx_free(codec); |
| 5609 | return err; |
| 5610 | } |
| 5611 | |
| 5612 | codec->patch_ops = stac92xx_patch_ops; |
| 5613 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5614 | codec->proc_widget_hook = stac9205_proc_hook; |
| 5615 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5616 | return 0; |
| 5617 | } |
| 5618 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5619 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5620 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5621 | */ |
| 5622 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5623 | static struct hda_verb stac9872_core_init[] = { |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 5624 | {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] | 5625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 5626 | {} |
| 5627 | }; |
| 5628 | |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5629 | static struct snd_kcontrol_new stac9872_mixer[] = { |
| 5630 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 5631 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5632 | { } /* end */ |
| 5633 | }; |
| 5634 | |
| 5635 | static hda_nid_t stac9872_pin_nids[] = { |
| 5636 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 5637 | 0x11, 0x13, 0x14, |
| 5638 | }; |
| 5639 | |
| 5640 | static hda_nid_t stac9872_adc_nids[] = { |
| 5641 | 0x8 /*,0x6*/ |
| 5642 | }; |
| 5643 | |
| 5644 | static hda_nid_t stac9872_mux_nids[] = { |
| 5645 | 0x15 |
| 5646 | }; |
| 5647 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 5648 | static unsigned int stac9872_vaio_pin_configs[9] = { |
| 5649 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
| 5650 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
| 5651 | 0x90a7013e |
| 5652 | }; |
| 5653 | |
| 5654 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 5655 | [STAC_9872_AUTO] = "auto", |
| 5656 | [STAC_9872_VAIO] = "vaio", |
| 5657 | }; |
| 5658 | |
| 5659 | static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { |
| 5660 | [STAC_9872_VAIO] = stac9872_vaio_pin_configs, |
| 5661 | }; |
| 5662 | |
| 5663 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
| 5664 | {} /* terminator */ |
| 5665 | }; |
| 5666 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5667 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5668 | { |
| 5669 | struct sigmatel_spec *spec; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5670 | int err; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5671 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5672 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5673 | if (spec == NULL) |
| 5674 | return -ENOMEM; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5675 | codec->spec = spec; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5676 | |
| 5677 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 5678 | stac9872_models, |
| 5679 | stac9872_cfg_tbl); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 5680 | if (spec->board_config < 0) |
| 5681 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, " |
| 5682 | "using BIOS defaults\n"); |
| 5683 | else |
| 5684 | stac92xx_set_config_regs(codec, |
| 5685 | stac9872_brd_tbl[spec->board_config]); |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5686 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5687 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
| 5688 | spec->pin_nids = stac9872_pin_nids; |
| 5689 | spec->multiout.dac_nids = spec->dac_nids; |
| 5690 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); |
| 5691 | spec->adc_nids = stac9872_adc_nids; |
| 5692 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
| 5693 | spec->mux_nids = stac9872_mux_nids; |
| 5694 | spec->mixer = stac9872_mixer; |
| 5695 | spec->init = stac9872_core_init; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5696 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5697 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); |
| 5698 | if (err < 0) { |
| 5699 | stac92xx_free(codec); |
| 5700 | return -EINVAL; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5701 | } |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5702 | spec->input_mux = &spec->private_imux; |
| 5703 | codec->patch_ops = stac92xx_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5704 | return 0; |
| 5705 | } |
| 5706 | |
| 5707 | |
| 5708 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5709 | * patch entries |
| 5710 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 5711 | static struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5712 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 5713 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 5714 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 5715 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 5716 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 5717 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 5718 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 5719 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 5720 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 5721 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 5722 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 5723 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 5724 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5725 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 5726 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 5727 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 5728 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 5729 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 5730 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 5731 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 5732 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 5733 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 5734 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5735 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 5736 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 5737 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 5738 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 5739 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 5740 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 5741 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 5742 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5743 | /* The following does not take into account .id=0x83847661 when subsys = |
| 5744 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 5745 | * currently not fully supported. |
| 5746 | */ |
| 5747 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 5748 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 5749 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5750 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 5751 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 5752 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 5753 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 5754 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 5755 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 5756 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 5757 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5758 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5759 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
| 5760 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 5761 | { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5762 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5763 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 5764 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5765 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5766 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5767 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5768 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5769 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5770 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5771 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5772 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 5773 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5774 | {} /* terminator */ |
| 5775 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 5776 | |
| 5777 | MODULE_ALIAS("snd-hda-codec-id:8384*"); |
| 5778 | MODULE_ALIAS("snd-hda-codec-id:111d*"); |
| 5779 | |
| 5780 | MODULE_LICENSE("GPL"); |
| 5781 | MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); |
| 5782 | |
| 5783 | static struct hda_codec_preset_list sigmatel_list = { |
| 5784 | .preset = snd_hda_preset_sigmatel, |
| 5785 | .owner = THIS_MODULE, |
| 5786 | }; |
| 5787 | |
| 5788 | static int __init patch_sigmatel_init(void) |
| 5789 | { |
| 5790 | return snd_hda_add_codec_preset(&sigmatel_list); |
| 5791 | } |
| 5792 | |
| 5793 | static void __exit patch_sigmatel_exit(void) |
| 5794 | { |
| 5795 | snd_hda_delete_codec_preset(&sigmatel_list); |
| 5796 | } |
| 5797 | |
| 5798 | module_init(patch_sigmatel_init) |
| 5799 | module_exit(patch_sigmatel_exit) |