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" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 36 | #include "hda_patch.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 37 | #include "hda_beep.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 38 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 39 | enum { |
| 40 | STAC_VREF_EVENT = 1, |
| 41 | STAC_INSERT_EVENT, |
| 42 | STAC_PWR_EVENT, |
| 43 | STAC_HP_EVENT, |
| 44 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 45 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 46 | enum { |
| 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, |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 59 | STAC_9200_GATEWAY, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 60 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 61 | STAC_9200_MODELS |
| 62 | }; |
| 63 | |
| 64 | enum { |
| 65 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 66 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 67 | STAC_9205_DELL_M43, |
| 68 | STAC_9205_DELL_M44, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 69 | STAC_9205_MODELS |
| 70 | }; |
| 71 | |
| 72 | enum { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 73 | STAC_92HD73XX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 74 | STAC_DELL_M6, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 75 | STAC_DELL_EQ, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 76 | STAC_92HD73XX_MODELS |
| 77 | }; |
| 78 | |
| 79 | enum { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 80 | STAC_92HD83XXX_REF, |
| 81 | STAC_92HD83XXX_MODELS |
| 82 | }; |
| 83 | |
| 84 | enum { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 85 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 86 | STAC_DELL_M4_1, |
| 87 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 88 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 89 | STAC_HP_M4, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 90 | STAC_92HD71BXX_MODELS |
| 91 | }; |
| 92 | |
| 93 | enum { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 94 | STAC_925x_REF, |
| 95 | STAC_M2_2, |
| 96 | STAC_MA6, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 97 | STAC_PA6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 98 | STAC_925x_MODELS |
| 99 | }; |
| 100 | |
| 101 | enum { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 102 | STAC_D945_REF, |
| 103 | STAC_D945GTP3, |
| 104 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 105 | STAC_INTEL_MAC_V1, |
| 106 | STAC_INTEL_MAC_V2, |
| 107 | STAC_INTEL_MAC_V3, |
| 108 | STAC_INTEL_MAC_V4, |
| 109 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 110 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 111 | * is given, one of the above models will be |
| 112 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 113 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 114 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 115 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 116 | STAC_MACBOOK_PRO_V1, |
| 117 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 118 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 119 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 120 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 121 | STAC_922X_DELL_D81, |
| 122 | STAC_922X_DELL_D82, |
| 123 | STAC_922X_DELL_M81, |
| 124 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 125 | STAC_922X_MODELS |
| 126 | }; |
| 127 | |
| 128 | enum { |
| 129 | STAC_D965_REF, |
| 130 | STAC_D965_3ST, |
| 131 | STAC_D965_5ST, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 132 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 133 | STAC_DELL_BIOS, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 134 | STAC_927X_MODELS |
| 135 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 136 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 137 | struct sigmatel_event { |
| 138 | hda_nid_t nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 139 | unsigned char type; |
| 140 | unsigned char tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 141 | int data; |
| 142 | }; |
| 143 | |
| 144 | struct sigmatel_jack { |
| 145 | hda_nid_t nid; |
| 146 | int type; |
| 147 | struct snd_jack *jack; |
| 148 | }; |
| 149 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 150 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 151 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 152 | unsigned int num_mixers; |
| 153 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 154 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 155 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 156 | unsigned int surr_switch: 1; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 157 | unsigned int line_switch: 1; |
| 158 | unsigned int mic_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 159 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 160 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 161 | unsigned int spdif_mute: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 162 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 163 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 164 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 165 | unsigned int gpio_mask; |
| 166 | unsigned int gpio_dir; |
| 167 | unsigned int gpio_data; |
| 168 | unsigned int gpio_mute; |
| 169 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 170 | /* stream */ |
| 171 | unsigned int stream_delay; |
| 172 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 173 | /* analog loopback */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 174 | unsigned char aloopback_mask; |
| 175 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 176 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 177 | /* power management */ |
| 178 | unsigned int num_pwrs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 179 | unsigned int *pwr_mapping; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 180 | hda_nid_t *pwr_nids; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 181 | hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 182 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 183 | /* jack detection */ |
| 184 | struct snd_array jacks; |
| 185 | |
| 186 | /* events */ |
| 187 | struct snd_array events; |
| 188 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 189 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 190 | struct hda_input_mux *mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 191 | struct hda_input_mux *amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 192 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 193 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 194 | hda_nid_t dac_nids[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 195 | |
| 196 | /* capture */ |
| 197 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 198 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 199 | hda_nid_t *mux_nids; |
| 200 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 201 | hda_nid_t *dmic_nids; |
| 202 | unsigned int num_dmics; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 203 | hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 204 | unsigned int num_dmuxes; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 205 | hda_nid_t *smux_nids; |
| 206 | unsigned int num_smuxes; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 207 | const char **spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 208 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 209 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 210 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 211 | hda_nid_t anabeep_nid; |
| 212 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 213 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 214 | /* pin widgets */ |
| 215 | hda_nid_t *pin_nids; |
| 216 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 217 | unsigned int *pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 218 | |
| 219 | /* codec specific stuff */ |
| 220 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 221 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 222 | |
| 223 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 224 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 225 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 226 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 227 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 228 | struct hda_input_mux *sinput_mux; |
| 229 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 230 | unsigned int cur_amux; |
| 231 | hda_nid_t *amp_nids; |
| 232 | unsigned int num_amps; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 233 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 234 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 235 | /* i/o switches */ |
| 236 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 237 | unsigned int clfe_swap; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 238 | unsigned int hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 239 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 240 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 241 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 242 | |
| 243 | /* dynamic controls and input_mux */ |
| 244 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 245 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 246 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 247 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 248 | struct hda_input_mux private_smux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 249 | struct hda_input_mux private_amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 250 | struct hda_input_mux private_mono_mux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 251 | }; |
| 252 | |
| 253 | static hda_nid_t stac9200_adc_nids[1] = { |
| 254 | 0x03, |
| 255 | }; |
| 256 | |
| 257 | static hda_nid_t stac9200_mux_nids[1] = { |
| 258 | 0x0c, |
| 259 | }; |
| 260 | |
| 261 | static hda_nid_t stac9200_dac_nids[1] = { |
| 262 | 0x02, |
| 263 | }; |
| 264 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 265 | static hda_nid_t stac92hd73xx_pwr_nids[8] = { |
| 266 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 267 | 0x0f, 0x10, 0x11 |
| 268 | }; |
| 269 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 270 | static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
| 271 | 0x26, 0, |
| 272 | }; |
| 273 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 274 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
| 275 | 0x1a, 0x1b |
| 276 | }; |
| 277 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 278 | #define DELL_M6_AMP 2 |
| 279 | static hda_nid_t stac92hd73xx_amp_nids[3] = { |
| 280 | 0x0b, 0x0c, 0x0e |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 281 | }; |
| 282 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 283 | #define STAC92HD73XX_NUM_DMICS 2 |
| 284 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
| 285 | 0x13, 0x14, 0 |
| 286 | }; |
| 287 | |
| 288 | #define STAC92HD73_DAC_COUNT 5 |
| 289 | static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = { |
| 290 | 0x15, 0x16, 0x17, 0x18, 0x19, |
| 291 | }; |
| 292 | |
| 293 | static hda_nid_t stac92hd73xx_mux_nids[4] = { |
| 294 | 0x28, 0x29, 0x2a, 0x2b, |
| 295 | }; |
| 296 | |
| 297 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
| 298 | 0x20, 0x21, |
| 299 | }; |
| 300 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 301 | static hda_nid_t stac92hd73xx_smux_nids[2] = { |
| 302 | 0x22, 0x23, |
| 303 | }; |
| 304 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 305 | #define STAC92HD83XXX_NUM_DMICS 2 |
| 306 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { |
| 307 | 0x11, 0x12, 0 |
| 308 | }; |
| 309 | |
| 310 | #define STAC92HD81_DAC_COUNT 2 |
| 311 | #define STAC92HD83_DAC_COUNT 3 |
| 312 | static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = { |
| 313 | 0x13, 0x14, 0x22, |
| 314 | }; |
| 315 | |
| 316 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { |
| 317 | 0x17, 0x18, |
| 318 | }; |
| 319 | |
| 320 | static hda_nid_t stac92hd83xxx_adc_nids[2] = { |
| 321 | 0x15, 0x16, |
| 322 | }; |
| 323 | |
| 324 | static hda_nid_t stac92hd83xxx_pwr_nids[4] = { |
| 325 | 0xa, 0xb, 0xd, 0xe, |
| 326 | }; |
| 327 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 328 | static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
| 329 | 0x1e, 0, |
| 330 | }; |
| 331 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 332 | static unsigned int stac92hd83xxx_pwr_mapping[4] = { |
| 333 | 0x03, 0x0c, 0x10, 0x40, |
| 334 | }; |
| 335 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 336 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
| 337 | 0x0a, 0x0d, 0x0f |
| 338 | }; |
| 339 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 340 | static hda_nid_t stac92hd71bxx_adc_nids[2] = { |
| 341 | 0x12, 0x13, |
| 342 | }; |
| 343 | |
| 344 | static hda_nid_t stac92hd71bxx_mux_nids[2] = { |
| 345 | 0x1a, 0x1b |
| 346 | }; |
| 347 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 348 | static hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
| 349 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 350 | }; |
| 351 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 352 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { |
| 353 | 0x24, 0x25, |
| 354 | }; |
| 355 | |
Takashi Iwai | aea7bb0 | 2008-02-25 18:26:41 +0100 | [diff] [blame] | 356 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 357 | 0x10, /*0x11, */ |
| 358 | }; |
| 359 | |
| 360 | #define STAC92HD71BXX_NUM_DMICS 2 |
| 361 | static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
| 362 | 0x18, 0x19, 0 |
| 363 | }; |
| 364 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 365 | static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
| 366 | 0x22, 0 |
| 367 | }; |
| 368 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 369 | static hda_nid_t stac925x_adc_nids[1] = { |
| 370 | 0x03, |
| 371 | }; |
| 372 | |
| 373 | static hda_nid_t stac925x_mux_nids[1] = { |
| 374 | 0x0f, |
| 375 | }; |
| 376 | |
| 377 | static hda_nid_t stac925x_dac_nids[1] = { |
| 378 | 0x02, |
| 379 | }; |
| 380 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 381 | #define STAC925X_NUM_DMICS 1 |
| 382 | static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
| 383 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 384 | }; |
| 385 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 386 | static hda_nid_t stac925x_dmux_nids[1] = { |
| 387 | 0x14, |
| 388 | }; |
| 389 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 390 | static hda_nid_t stac922x_adc_nids[2] = { |
| 391 | 0x06, 0x07, |
| 392 | }; |
| 393 | |
| 394 | static hda_nid_t stac922x_mux_nids[2] = { |
| 395 | 0x12, 0x13, |
| 396 | }; |
| 397 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 398 | static hda_nid_t stac927x_adc_nids[3] = { |
| 399 | 0x07, 0x08, 0x09 |
| 400 | }; |
| 401 | |
| 402 | static hda_nid_t stac927x_mux_nids[3] = { |
| 403 | 0x15, 0x16, 0x17 |
| 404 | }; |
| 405 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 406 | static hda_nid_t stac927x_smux_nids[1] = { |
| 407 | 0x21, |
| 408 | }; |
| 409 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 410 | static hda_nid_t stac927x_dac_nids[6] = { |
| 411 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 412 | }; |
| 413 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 414 | static hda_nid_t stac927x_dmux_nids[1] = { |
| 415 | 0x1b, |
| 416 | }; |
| 417 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 418 | #define STAC927X_NUM_DMICS 2 |
| 419 | static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
| 420 | 0x13, 0x14, 0 |
| 421 | }; |
| 422 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 423 | static const char *stac927x_spdif_labels[5] = { |
| 424 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 425 | "Analog Mux 2", "Analog Mux 3" |
| 426 | }; |
| 427 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 428 | static hda_nid_t stac9205_adc_nids[2] = { |
| 429 | 0x12, 0x13 |
| 430 | }; |
| 431 | |
| 432 | static hda_nid_t stac9205_mux_nids[2] = { |
| 433 | 0x19, 0x1a |
| 434 | }; |
| 435 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 436 | static hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 437 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 438 | }; |
| 439 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 440 | static hda_nid_t stac9205_smux_nids[1] = { |
| 441 | 0x21, |
| 442 | }; |
| 443 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 444 | #define STAC9205_NUM_DMICS 2 |
| 445 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
| 446 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 447 | }; |
| 448 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 449 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 450 | 0x08, 0x09, 0x0d, 0x0e, |
| 451 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 452 | }; |
| 453 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 454 | static hda_nid_t stac925x_pin_nids[8] = { |
| 455 | 0x07, 0x08, 0x0a, 0x0b, |
| 456 | 0x0c, 0x0d, 0x10, 0x11, |
| 457 | }; |
| 458 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 459 | static hda_nid_t stac922x_pin_nids[10] = { |
| 460 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 461 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 462 | }; |
| 463 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 464 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 465 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 466 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 467 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 468 | }; |
| 469 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 470 | static hda_nid_t stac92hd83xxx_pin_nids[14] = { |
| 471 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 472 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 473 | 0x1d, 0x1e, 0x1f, 0x20 |
| 474 | }; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 475 | static hda_nid_t stac92hd71bxx_pin_nids[11] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 476 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 477 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 478 | 0x1f, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 479 | }; |
| 480 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 481 | static hda_nid_t stac927x_pin_nids[14] = { |
| 482 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 483 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 484 | 0x14, 0x21, 0x22, 0x23, |
| 485 | }; |
| 486 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 487 | static hda_nid_t stac9205_pin_nids[12] = { |
| 488 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 489 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 490 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 491 | }; |
| 492 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 493 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info |
| 494 | |
| 495 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, |
| 496 | struct snd_ctl_elem_value *ucontrol) |
| 497 | { |
| 498 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 499 | struct sigmatel_spec *spec = codec->spec; |
| 500 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 501 | |
| 502 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 503 | kcontrol->private_value |= nid; |
| 504 | |
| 505 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); |
| 506 | } |
| 507 | |
| 508 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, |
| 509 | struct snd_ctl_elem_value *ucontrol) |
| 510 | { |
| 511 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 512 | struct sigmatel_spec *spec = codec->spec; |
| 513 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 514 | |
| 515 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 516 | kcontrol->private_value |= nid; |
| 517 | |
| 518 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); |
| 519 | } |
| 520 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 521 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 522 | struct snd_ctl_elem_info *uinfo) |
| 523 | { |
| 524 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 525 | struct sigmatel_spec *spec = codec->spec; |
| 526 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 527 | } |
| 528 | |
| 529 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 530 | struct snd_ctl_elem_value *ucontrol) |
| 531 | { |
| 532 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 533 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 534 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 535 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 536 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 537 | return 0; |
| 538 | } |
| 539 | |
| 540 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 541 | struct snd_ctl_elem_value *ucontrol) |
| 542 | { |
| 543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 544 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 545 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 546 | |
| 547 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 548 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 549 | } |
| 550 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 551 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 552 | struct snd_ctl_elem_info *uinfo) |
| 553 | { |
| 554 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 555 | struct sigmatel_spec *spec = codec->spec; |
| 556 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 557 | } |
| 558 | |
| 559 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 560 | struct snd_ctl_elem_value *ucontrol) |
| 561 | { |
| 562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 563 | struct sigmatel_spec *spec = codec->spec; |
| 564 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 565 | |
| 566 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 567 | return 0; |
| 568 | } |
| 569 | |
| 570 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 571 | struct snd_ctl_elem_value *ucontrol) |
| 572 | { |
| 573 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 574 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 575 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 576 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 577 | int err, val; |
| 578 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 579 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 580 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 581 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 582 | if (err < 0) |
| 583 | return err; |
| 584 | |
| 585 | if (spec->spdif_mute) { |
| 586 | if (smux_idx == 0) |
| 587 | nid = spec->multiout.dig_out_nid; |
| 588 | else |
| 589 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 590 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
| 591 | val = AMP_OUT_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 592 | else |
Takashi Iwai | c1e99bd | 2008-10-29 08:03:42 +0100 | [diff] [blame] | 593 | val = AMP_OUT_UNMUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 594 | /* un/mute SPDIF out */ |
| 595 | snd_hda_codec_write_cache(codec, nid, 0, |
| 596 | AC_VERB_SET_AMP_GAIN_MUTE, val); |
| 597 | } |
| 598 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 599 | } |
| 600 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 601 | 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] | 602 | { |
| 603 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 604 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 605 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 606 | } |
| 607 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 608 | 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] | 609 | { |
| 610 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 611 | struct sigmatel_spec *spec = codec->spec; |
| 612 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 613 | |
| 614 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 615 | return 0; |
| 616 | } |
| 617 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 618 | 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] | 619 | { |
| 620 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 621 | struct sigmatel_spec *spec = codec->spec; |
| 622 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 623 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 624 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 625 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 626 | } |
| 627 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 628 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 629 | struct snd_ctl_elem_info *uinfo) |
| 630 | { |
| 631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 632 | struct sigmatel_spec *spec = codec->spec; |
| 633 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 634 | } |
| 635 | |
| 636 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 637 | struct snd_ctl_elem_value *ucontrol) |
| 638 | { |
| 639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 640 | struct sigmatel_spec *spec = codec->spec; |
| 641 | |
| 642 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 643 | return 0; |
| 644 | } |
| 645 | |
| 646 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 647 | struct snd_ctl_elem_value *ucontrol) |
| 648 | { |
| 649 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 650 | struct sigmatel_spec *spec = codec->spec; |
| 651 | |
| 652 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 653 | spec->mono_nid, &spec->cur_mmux); |
| 654 | } |
| 655 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 656 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 657 | struct snd_ctl_elem_info *uinfo) |
| 658 | { |
| 659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 660 | struct sigmatel_spec *spec = codec->spec; |
| 661 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); |
| 662 | } |
| 663 | |
| 664 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 665 | struct snd_ctl_elem_value *ucontrol) |
| 666 | { |
| 667 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 668 | struct sigmatel_spec *spec = codec->spec; |
| 669 | |
| 670 | ucontrol->value.enumerated.item[0] = spec->cur_amux; |
| 671 | return 0; |
| 672 | } |
| 673 | |
| 674 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 675 | struct snd_ctl_elem_value *ucontrol) |
| 676 | { |
| 677 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 678 | struct sigmatel_spec *spec = codec->spec; |
| 679 | struct snd_kcontrol *ctl = |
| 680 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); |
| 681 | if (!ctl) |
| 682 | return -EINVAL; |
| 683 | |
| 684 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | |
| 685 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
| 686 | |
| 687 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, |
| 688 | 0, &spec->cur_amux); |
| 689 | } |
| 690 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 691 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 692 | |
| 693 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 694 | struct snd_ctl_elem_value *ucontrol) |
| 695 | { |
| 696 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 697 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 698 | struct sigmatel_spec *spec = codec->spec; |
| 699 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 700 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 701 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 702 | return 0; |
| 703 | } |
| 704 | |
| 705 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 706 | struct snd_ctl_elem_value *ucontrol) |
| 707 | { |
| 708 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 709 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 710 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 711 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 712 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 713 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 714 | idx_val = spec->aloopback_mask << idx; |
| 715 | if (ucontrol->value.integer.value[0]) |
| 716 | val = spec->aloopback | idx_val; |
| 717 | else |
| 718 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 719 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 720 | return 0; |
| 721 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 722 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 723 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 724 | /* Only return the bits defined by the shift value of the |
| 725 | * first two bytes of the mask |
| 726 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 727 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 728 | kcontrol->private_value & 0xFFFF, 0x0); |
| 729 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 730 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 731 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 732 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 733 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 734 | } else { |
| 735 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 736 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 740 | kcontrol->private_value >> 16, dac_mode); |
| 741 | |
| 742 | return 1; |
| 743 | } |
| 744 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 745 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 746 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 747 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 748 | {} |
| 749 | }; |
| 750 | |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 751 | static struct hda_verb stac9200_eapd_init[] = { |
| 752 | /* set dac0mux for dac converter */ |
| 753 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 754 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 755 | {} |
| 756 | }; |
| 757 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 758 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { |
| 759 | /* set master volume and direct control */ |
| 760 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 761 | /* setup audio connections */ |
| 762 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 763 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 764 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 765 | /* setup adcs to point to mixer */ |
| 766 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 767 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 768 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 769 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 770 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 771 | /* setup import muxs */ |
| 772 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 773 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 774 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 775 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 776 | {} |
| 777 | }; |
| 778 | |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 779 | static struct hda_verb dell_eq_core_init[] = { |
| 780 | /* set master volume to max value without distortion |
| 781 | * and direct control */ |
| 782 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
| 783 | /* setup audio connections */ |
| 784 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matthew Ranostay | f7cf0a7 | 2008-09-13 10:36:58 -0400 | [diff] [blame] | 785 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 786 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 787 | /* setup adcs to point to mixer */ |
| 788 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 789 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 790 | /* setup import muxs */ |
| 791 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 792 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 793 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 794 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 795 | {} |
| 796 | }; |
| 797 | |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 798 | static struct hda_verb dell_m6_core_init[] = { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 799 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 800 | /* setup audio connections */ |
Matthew Ranostay | 7747ecc | 2008-03-10 11:30:04 +0100 | [diff] [blame] | 801 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 802 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 803 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 804 | /* setup adcs to point to mixer */ |
| 805 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 806 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 807 | /* setup import muxs */ |
| 808 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 809 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 810 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 811 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 812 | {} |
| 813 | }; |
| 814 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 815 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
| 816 | /* set master volume and direct control */ |
| 817 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 818 | /* setup audio connections */ |
| 819 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 820 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 821 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 822 | /* connect hp ports to dac3 */ |
| 823 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 824 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 825 | /* setup adcs to point to mixer */ |
| 826 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 827 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 828 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 829 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 830 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 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, 0x03}, |
| 836 | {} |
| 837 | }; |
| 838 | |
| 839 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { |
| 840 | /* set master volume and direct control */ |
| 841 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 842 | /* setup audio connections */ |
| 843 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 844 | { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 845 | { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 846 | /* dac3 is connected to import3 mux */ |
| 847 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, |
| 848 | /* connect hp ports to dac4 */ |
| 849 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 850 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 851 | /* setup adcs to point to mixer */ |
| 852 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 853 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 854 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 855 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 856 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 857 | /* setup import muxs */ |
| 858 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 859 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 860 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 861 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 862 | {} |
| 863 | }; |
| 864 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 865 | static struct hda_verb stac92hd83xxx_core_init[] = { |
| 866 | /* start of config #1 */ |
| 867 | { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3}, |
| 868 | |
| 869 | /* start of config #2 */ |
| 870 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 871 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 872 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 873 | |
| 874 | /* power state controls amps */ |
| 875 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
| 876 | }; |
| 877 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 878 | static struct hda_verb stac92hd71bxx_core_init[] = { |
| 879 | /* set master volume and direct control */ |
| 880 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
| 881 | /* connect headphone jack to dac1 */ |
| 882 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 883 | /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ |
| 884 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 885 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 886 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 887 | }; |
| 888 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 889 | #define HD_DISABLE_PORTF 2 |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 890 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 891 | /* start of config #1 */ |
| 892 | |
| 893 | /* connect port 0f to audio mixer */ |
| 894 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 895 | /* unmute right and left channels for node 0x0f */ |
| 896 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 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}, |
| 901 | /* connect headphone jack to dac1 */ |
| 902 | { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 903 | /* unmute right and left channels for nodes 0x0a, 0xd */ |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 904 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 905 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 906 | {} |
| 907 | }; |
| 908 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 909 | static struct hda_verb stac925x_core_init[] = { |
| 910 | /* set dac0mux for dac converter */ |
| 911 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 912 | {} |
| 913 | }; |
| 914 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 915 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 916 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 917 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 918 | {} |
| 919 | }; |
| 920 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 921 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 922 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 923 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 924 | /* unmute node 0x1b */ |
| 925 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 926 | /* select node 0x03 as DAC */ |
| 927 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 928 | {} |
| 929 | }; |
| 930 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 931 | static struct hda_verb stac927x_core_init[] = { |
| 932 | /* set master volume and direct control */ |
| 933 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 934 | /* enable analog pc beep path */ |
| 935 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 936 | {} |
| 937 | }; |
| 938 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 939 | static struct hda_verb stac9205_core_init[] = { |
| 940 | /* set master volume and direct control */ |
| 941 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 942 | /* enable analog pc beep path */ |
| 943 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 944 | {} |
| 945 | }; |
| 946 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 947 | #define STAC_MONO_MUX \ |
| 948 | { \ |
| 949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 950 | .name = "Mono Mux", \ |
| 951 | .count = 1, \ |
| 952 | .info = stac92xx_mono_mux_enum_info, \ |
| 953 | .get = stac92xx_mono_mux_enum_get, \ |
| 954 | .put = stac92xx_mono_mux_enum_put, \ |
| 955 | } |
| 956 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 957 | #define STAC_AMP_MUX \ |
| 958 | { \ |
| 959 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 960 | .name = "Amp Selector Capture Switch", \ |
| 961 | .count = 1, \ |
| 962 | .info = stac92xx_amp_mux_enum_info, \ |
| 963 | .get = stac92xx_amp_mux_enum_get, \ |
| 964 | .put = stac92xx_amp_mux_enum_put, \ |
| 965 | } |
| 966 | |
| 967 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ |
| 968 | { \ |
| 969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 970 | .name = xname, \ |
| 971 | .index = 0, \ |
| 972 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 973 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 974 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
| 975 | .info = stac92xx_amp_volume_info, \ |
| 976 | .get = stac92xx_amp_volume_get, \ |
| 977 | .put = stac92xx_amp_volume_put, \ |
| 978 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ |
| 979 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ |
| 980 | } |
| 981 | |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 982 | #define STAC_INPUT_SOURCE(cnt) \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 983 | { \ |
| 984 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 985 | .name = "Input Source", \ |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 986 | .count = cnt, \ |
Maxim Levitsky | ca7c5a8 | 2007-08-31 12:52:19 +0200 | [diff] [blame] | 987 | .info = stac92xx_mux_enum_info, \ |
| 988 | .get = stac92xx_mux_enum_get, \ |
| 989 | .put = stac92xx_mux_enum_put, \ |
| 990 | } |
| 991 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 992 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 993 | { \ |
| 994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 995 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 996 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 997 | .info = stac92xx_aloopback_info, \ |
| 998 | .get = stac92xx_aloopback_get, \ |
| 999 | .put = stac92xx_aloopback_put, \ |
| 1000 | .private_value = verb_read | (verb_write << 16), \ |
| 1001 | } |
| 1002 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1003 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1004 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 1005 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1006 | STAC_INPUT_SOURCE(1), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1007 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 1008 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1009 | { } /* end */ |
| 1010 | }; |
| 1011 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1012 | #define DELL_M6_MIXER 6 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1013 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1014 | /* start of config #1 */ |
| 1015 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1016 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1017 | |
| 1018 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1019 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1020 | |
| 1021 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1022 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1023 | |
| 1024 | /* start of config #2 */ |
| 1025 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1026 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1027 | |
| 1028 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1029 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1030 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1031 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1032 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1033 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1034 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1035 | |
| 1036 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1037 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1038 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1039 | { } /* end */ |
| 1040 | }; |
| 1041 | |
| 1042 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1043 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1044 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1045 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1046 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1047 | |
| 1048 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1049 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1050 | |
| 1051 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1052 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1053 | |
| 1054 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1055 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1056 | |
| 1057 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1058 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1059 | |
| 1060 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1062 | |
| 1063 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1064 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1065 | { } /* end */ |
| 1066 | }; |
| 1067 | |
| 1068 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1069 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 1070 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1071 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1072 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1073 | |
| 1074 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1075 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1076 | |
| 1077 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1078 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1079 | |
| 1080 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1081 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1082 | |
| 1083 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1084 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1085 | |
| 1086 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1087 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1088 | |
| 1089 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1090 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1091 | { } /* end */ |
| 1092 | }; |
| 1093 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1094 | |
| 1095 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { |
| 1096 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1097 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1098 | |
| 1099 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1100 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1101 | |
| 1102 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT), |
| 1103 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT), |
| 1104 | |
| 1105 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT), |
| 1106 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT), |
| 1107 | |
| 1108 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT), |
| 1109 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT), |
| 1110 | |
| 1111 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT), |
| 1112 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT), |
| 1113 | |
| 1114 | /* |
| 1115 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT), |
| 1116 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT), |
| 1117 | */ |
| 1118 | { } /* end */ |
| 1119 | }; |
| 1120 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1121 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1122 | STAC_INPUT_SOURCE(2), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1123 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1124 | |
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 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1150 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1151 | STAC_INPUT_SOURCE(2), |
| 1152 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), |
| 1153 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1154 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 1155 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1156 | |
| 1157 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 1158 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1159 | { } /* end */ |
| 1160 | }; |
| 1161 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1162 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1163 | STAC_INPUT_SOURCE(1), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1164 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
Mauro Carvalho Chehab | 587755f | 2008-05-25 18:20:06 +0200 | [diff] [blame] | 1165 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1166 | { } /* end */ |
| 1167 | }; |
| 1168 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 1169 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1170 | STAC_INPUT_SOURCE(2), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1171 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1172 | |
| 1173 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1175 | |
| 1176 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
| 1177 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1178 | { } /* end */ |
| 1179 | }; |
| 1180 | |
| 1181 | /* This needs to be generated dynamically based on sequence */ |
| 1182 | static struct snd_kcontrol_new stac922x_mixer[] = { |
| 1183 | STAC_INPUT_SOURCE(2), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1184 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
| 1185 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1186 | |
| 1187 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
| 1188 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1189 | { } /* end */ |
| 1190 | }; |
| 1191 | |
| 1192 | |
| 1193 | static struct snd_kcontrol_new stac927x_mixer[] = { |
| 1194 | STAC_INPUT_SOURCE(3), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1195 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1196 | |
| 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 | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1208 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1209 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1210 | .name = "Digital Input Source", |
| 1211 | /* count set later */ |
| 1212 | .info = stac92xx_dmux_enum_info, |
| 1213 | .get = stac92xx_dmux_enum_get, |
| 1214 | .put = stac92xx_dmux_enum_put, |
| 1215 | }; |
| 1216 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1217 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1218 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1219 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1220 | /* count set later */ |
| 1221 | .info = stac92xx_smux_enum_info, |
| 1222 | .get = stac92xx_smux_enum_get, |
| 1223 | .put = stac92xx_smux_enum_put, |
| 1224 | }; |
| 1225 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1226 | static const char *slave_vols[] = { |
| 1227 | "Front Playback Volume", |
| 1228 | "Surround Playback Volume", |
| 1229 | "Center Playback Volume", |
| 1230 | "LFE Playback Volume", |
| 1231 | "Side Playback Volume", |
| 1232 | "Headphone Playback Volume", |
| 1233 | "Headphone Playback Volume", |
| 1234 | "Speaker Playback Volume", |
| 1235 | "External Speaker Playback Volume", |
| 1236 | "Speaker2 Playback Volume", |
| 1237 | NULL |
| 1238 | }; |
| 1239 | |
| 1240 | static const char *slave_sws[] = { |
| 1241 | "Front Playback Switch", |
| 1242 | "Surround Playback Switch", |
| 1243 | "Center Playback Switch", |
| 1244 | "LFE Playback Switch", |
| 1245 | "Side Playback Switch", |
| 1246 | "Headphone Playback Switch", |
| 1247 | "Headphone Playback Switch", |
| 1248 | "Speaker Playback Switch", |
| 1249 | "External Speaker Playback Switch", |
| 1250 | "Speaker2 Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1251 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1252 | NULL |
| 1253 | }; |
| 1254 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1255 | static void stac92xx_free_kctls(struct hda_codec *codec); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1256 | 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] | 1257 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1258 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1259 | { |
| 1260 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1261 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1262 | hda_nid_t nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1263 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1264 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1265 | |
| 1266 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1267 | if (err < 0) |
| 1268 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1269 | |
| 1270 | for (i = 0; i < spec->num_mixers; i++) { |
| 1271 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1272 | if (err < 0) |
| 1273 | return err; |
| 1274 | } |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1275 | if (spec->num_dmuxes > 0) { |
| 1276 | stac_dmux_mixer.count = spec->num_dmuxes; |
Takashi Iwai | d13bd41 | 2008-07-30 15:01:45 +0200 | [diff] [blame] | 1277 | err = snd_hda_ctl_add(codec, |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1278 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1279 | if (err < 0) |
| 1280 | return err; |
| 1281 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1282 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1283 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1284 | struct hda_input_mux *smux = &spec->private_smux; |
| 1285 | /* check for mute support on SPDIF out */ |
| 1286 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 1287 | smux->items[smux->num_items].label = "Off"; |
| 1288 | smux->items[smux->num_items].index = 0; |
| 1289 | smux->num_items++; |
| 1290 | spec->spdif_mute = 1; |
| 1291 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1292 | stac_smux_mixer.count = spec->num_smuxes; |
| 1293 | err = snd_ctl_add(codec->bus->card, |
| 1294 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1295 | if (err < 0) |
| 1296 | return err; |
| 1297 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1298 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1299 | if (spec->multiout.dig_out_nid) { |
| 1300 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 1301 | if (err < 0) |
| 1302 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1303 | err = snd_hda_create_spdif_share_sw(codec, |
| 1304 | &spec->multiout); |
| 1305 | if (err < 0) |
| 1306 | return err; |
| 1307 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1308 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1309 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1310 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1311 | if (err < 0) |
| 1312 | return err; |
| 1313 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1314 | |
| 1315 | /* if we have no master control, let's create it */ |
| 1316 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1317 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1318 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1319 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1320 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1321 | vmaster_tlv, slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1322 | if (err < 0) |
| 1323 | return err; |
| 1324 | } |
| 1325 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1326 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1327 | NULL, slave_sws); |
| 1328 | if (err < 0) |
| 1329 | return err; |
| 1330 | } |
| 1331 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1332 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1333 | |
| 1334 | /* create jack input elements */ |
| 1335 | if (spec->hp_detect) { |
| 1336 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1337 | int type = SND_JACK_HEADPHONE; |
| 1338 | nid = cfg->hp_pins[i]; |
| 1339 | /* jack detection */ |
| 1340 | if (cfg->hp_outs == i) |
| 1341 | type |= SND_JACK_LINEOUT; |
| 1342 | err = stac92xx_add_jack(codec, nid, type); |
| 1343 | if (err < 0) |
| 1344 | return err; |
| 1345 | } |
| 1346 | } |
| 1347 | for (i = 0; i < cfg->line_outs; i++) { |
| 1348 | err = stac92xx_add_jack(codec, cfg->line_out_pins[i], |
| 1349 | SND_JACK_LINEOUT); |
| 1350 | if (err < 0) |
| 1351 | return err; |
| 1352 | } |
| 1353 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 1354 | nid = cfg->input_pins[i]; |
| 1355 | if (nid) { |
| 1356 | err = stac92xx_add_jack(codec, nid, |
| 1357 | SND_JACK_MICROPHONE); |
| 1358 | if (err < 0) |
| 1359 | return err; |
| 1360 | } |
| 1361 | } |
| 1362 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1363 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1364 | } |
| 1365 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1366 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1367 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1368 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1369 | }; |
| 1370 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1371 | /* |
| 1372 | STAC 9200 pin configs for |
| 1373 | 102801A8 |
| 1374 | 102801DE |
| 1375 | 102801E8 |
| 1376 | */ |
| 1377 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1378 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1379 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1380 | }; |
| 1381 | |
| 1382 | /* |
| 1383 | STAC 9200 pin configs for |
| 1384 | 102801C0 |
| 1385 | 102801C1 |
| 1386 | */ |
| 1387 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1388 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1389 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1390 | }; |
| 1391 | |
| 1392 | /* |
| 1393 | STAC 9200 pin configs for |
| 1394 | 102801C4 (Dell Dimension E310) |
| 1395 | 102801C5 |
| 1396 | 102801C7 |
| 1397 | 102801D9 |
| 1398 | 102801DA |
| 1399 | 102801E3 |
| 1400 | */ |
| 1401 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1402 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1403 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1404 | }; |
| 1405 | |
| 1406 | |
| 1407 | /* |
| 1408 | STAC 9200-32 pin configs for |
| 1409 | 102801B5 (Dell Inspiron 630m) |
| 1410 | 102801D8 (Dell Inspiron 640m) |
| 1411 | */ |
| 1412 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1413 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1414 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1415 | }; |
| 1416 | |
| 1417 | /* |
| 1418 | STAC 9200-32 pin configs for |
| 1419 | 102801C2 (Dell Latitude D620) |
| 1420 | 102801C8 |
| 1421 | 102801CC (Dell Latitude D820) |
| 1422 | 102801D4 |
| 1423 | 102801D6 |
| 1424 | */ |
| 1425 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1426 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1427 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1428 | }; |
| 1429 | |
| 1430 | /* |
| 1431 | STAC 9200-32 pin configs for |
| 1432 | 102801CE (Dell XPS M1710) |
| 1433 | 102801CF (Dell Precision M90) |
| 1434 | */ |
| 1435 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 1436 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1437 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1438 | }; |
| 1439 | |
| 1440 | /* |
| 1441 | STAC 9200-32 pin configs for |
| 1442 | 102801C9 |
| 1443 | 102801CA |
| 1444 | 102801CB (Dell Latitude 120L) |
| 1445 | 102801D3 |
| 1446 | */ |
| 1447 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1448 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1449 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1450 | }; |
| 1451 | |
| 1452 | /* |
| 1453 | STAC 9200-32 pin configs for |
| 1454 | 102801BD (Dell Inspiron E1505n) |
| 1455 | 102801EE |
| 1456 | 102801EF |
| 1457 | */ |
| 1458 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1459 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1460 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1461 | }; |
| 1462 | |
| 1463 | /* |
| 1464 | STAC 9200-32 pin configs for |
| 1465 | 102801F5 (Dell Inspiron 1501) |
| 1466 | 102801F6 |
| 1467 | */ |
| 1468 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1469 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1470 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1471 | }; |
| 1472 | |
| 1473 | /* |
| 1474 | STAC 9200-32 |
| 1475 | 102801CD (Dell Inspiron E1705/9400) |
| 1476 | */ |
| 1477 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1478 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1479 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1480 | }; |
| 1481 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1482 | static unsigned int oqo9200_pin_configs[8] = { |
| 1483 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1484 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1485 | }; |
| 1486 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1487 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1488 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 1489 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1490 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1491 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1492 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1493 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1494 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1495 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1496 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1497 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1498 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1499 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1500 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1501 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1502 | }; |
| 1503 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1504 | static const char *stac9200_models[STAC_9200_MODELS] = { |
| 1505 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1506 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1507 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1508 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1509 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1510 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1511 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1512 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1513 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1514 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1515 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1516 | [STAC_9200_DELL_M27] = "dell-m27", |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1517 | [STAC_9200_GATEWAY] = "gateway", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1518 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1519 | }; |
| 1520 | |
| 1521 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 1522 | /* SigmaTel reference board */ |
| 1523 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1524 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1525 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1526 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1527 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1528 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1529 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1530 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1531 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1532 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1533 | "unknown Dell", STAC_9200_DELL_D22), |
| 1534 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1535 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1536 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1537 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1538 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1539 | "unknown Dell", STAC_9200_DELL_D23), |
| 1540 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1541 | "unknown Dell", STAC_9200_DELL_D23), |
| 1542 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1543 | "unknown Dell", STAC_9200_DELL_M22), |
| 1544 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1545 | "unknown Dell", STAC_9200_DELL_M24), |
| 1546 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1547 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1548 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1549 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1550 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1551 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1552 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1553 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1554 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1555 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1556 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1557 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1558 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1559 | "unknown Dell", STAC_9200_DELL_M22), |
| 1560 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1561 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1562 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1563 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1564 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1565 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1566 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1567 | "unknown Dell", STAC_9200_DELL_D23), |
| 1568 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1569 | "unknown Dell", STAC_9200_DELL_D23), |
| 1570 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1571 | "unknown Dell", STAC_9200_DELL_D21), |
| 1572 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1573 | "unknown Dell", STAC_9200_DELL_D23), |
| 1574 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1575 | "unknown Dell", STAC_9200_DELL_D21), |
| 1576 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1577 | "unknown Dell", STAC_9200_DELL_M25), |
| 1578 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1579 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1580 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1581 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1582 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1583 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1584 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1585 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1586 | /* Gateway machines needs EAPD to be set on resume */ |
| 1587 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), |
| 1588 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", |
| 1589 | STAC_9200_GATEWAY), |
| 1590 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", |
| 1591 | STAC_9200_GATEWAY), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1592 | /* OQO Mobile */ |
| 1593 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1594 | {} /* terminator */ |
| 1595 | }; |
| 1596 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1597 | static unsigned int ref925x_pin_configs[8] = { |
| 1598 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1599 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1600 | }; |
| 1601 | |
| 1602 | static unsigned int stac925x_MA6_pin_configs[8] = { |
| 1603 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 1604 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, |
| 1605 | }; |
| 1606 | |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1607 | static unsigned int stac925x_PA6_pin_configs[8] = { |
| 1608 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
| 1609 | 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, |
| 1610 | }; |
| 1611 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1612 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Steve Longerbeam | 7353e14 | 2007-05-29 14:36:17 +0200 | [diff] [blame] | 1613 | 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, |
| 1614 | 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1615 | }; |
| 1616 | |
| 1617 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 1618 | [STAC_REF] = ref925x_pin_configs, |
| 1619 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
| 1620 | [STAC_MA6] = stac925x_MA6_pin_configs, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1621 | [STAC_PA6] = stac925x_PA6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1622 | }; |
| 1623 | |
| 1624 | static const char *stac925x_models[STAC_925x_MODELS] = { |
| 1625 | [STAC_REF] = "ref", |
| 1626 | [STAC_M2_2] = "m2-2", |
| 1627 | [STAC_MA6] = "m6", |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1628 | [STAC_PA6] = "pa6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1629 | }; |
| 1630 | |
| 1631 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 1632 | /* SigmaTel reference board */ |
| 1633 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1634 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1635 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), |
| 1636 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), |
| 1637 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1638 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1639 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), |
| 1640 | {} /* terminator */ |
| 1641 | }; |
| 1642 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1643 | static unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1644 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1645 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1646 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1647 | 0x01452050, |
| 1648 | }; |
| 1649 | |
| 1650 | static unsigned int dell_m6_pin_configs[13] = { |
| 1651 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1652 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1653 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1654 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1655 | }; |
| 1656 | |
| 1657 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1658 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
| 1659 | [STAC_DELL_M6] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1660 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1661 | }; |
| 1662 | |
| 1663 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
| 1664 | [STAC_92HD73XX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1665 | [STAC_DELL_M6] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1666 | [STAC_DELL_EQ] = "dell-eq", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1667 | }; |
| 1668 | |
| 1669 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
| 1670 | /* SigmaTel reference board */ |
| 1671 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1672 | "DFI LanParty", STAC_92HD73XX_REF), |
| 1673 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | d6752a5 | 2008-11-21 18:01:44 +0100 | [diff] [blame] | 1674 | "Dell Studio 1535", STAC_DELL_M6), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1675 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
| 1676 | "unknown Dell", STAC_DELL_M6), |
| 1677 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
| 1678 | "unknown Dell", STAC_DELL_M6), |
| 1679 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
| 1680 | "unknown Dell", STAC_DELL_M6), |
| 1681 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
| 1682 | "unknown Dell", STAC_DELL_M6), |
| 1683 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
| 1684 | "unknown Dell", STAC_DELL_M6), |
| 1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
| 1686 | "unknown Dell", STAC_DELL_M6), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
| 1688 | "Dell Studio 15", STAC_DELL_M6), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1689 | {} /* terminator */ |
| 1690 | }; |
| 1691 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1692 | static unsigned int ref92hd83xxx_pin_configs[14] = { |
| 1693 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1694 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
| 1695 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, |
| 1696 | 0x01451160, 0x98560170, |
| 1697 | }; |
| 1698 | |
| 1699 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
| 1700 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
| 1701 | }; |
| 1702 | |
| 1703 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
| 1704 | [STAC_92HD83XXX_REF] = "ref", |
| 1705 | }; |
| 1706 | |
| 1707 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
| 1708 | /* SigmaTel reference board */ |
| 1709 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1710 | "DFI LanParty", STAC_92HD71BXX_REF), |
| 1711 | }; |
| 1712 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1713 | static unsigned int ref92hd71bxx_pin_configs[11] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1714 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1715 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1716 | 0x90a000f0, 0x01452050, 0x01452050, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1717 | }; |
| 1718 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1719 | static unsigned int dell_m4_1_pin_configs[11] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1720 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1721 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1722 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1723 | }; |
| 1724 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1725 | static unsigned int dell_m4_2_pin_configs[11] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1726 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1727 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 1728 | 0x40f000f0, 0x044413b0, 0x044413b0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1729 | }; |
| 1730 | |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1731 | static unsigned int dell_m4_3_pin_configs[11] = { |
| 1732 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1733 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
| 1734 | 0x40f000f0, 0x044413b0, 0x044413b0, |
| 1735 | }; |
| 1736 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1737 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
| 1738 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1739 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1740 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1741 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1742 | [STAC_HP_M4] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1743 | }; |
| 1744 | |
| 1745 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
| 1746 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1747 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1748 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1749 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1750 | [STAC_HP_M4] = "hp-m4", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1751 | }; |
| 1752 | |
| 1753 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
| 1754 | /* SigmaTel reference board */ |
| 1755 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1756 | "DFI LanParty", STAC_92HD71BXX_REF), |
Takashi Iwai | 80bf272 | 2008-11-18 10:48:41 +0100 | [diff] [blame] | 1757 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, |
| 1758 | "HP dv5", STAC_HP_M4), |
| 1759 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, |
| 1760 | "HP dv7", STAC_HP_M4), |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1761 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
| 1762 | "unknown HP", STAC_HP_M4), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1763 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1764 | "unknown Dell", STAC_DELL_M4_1), |
| 1765 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1766 | "unknown Dell", STAC_DELL_M4_1), |
| 1767 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1768 | "unknown Dell", STAC_DELL_M4_1), |
| 1769 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1770 | "unknown Dell", STAC_DELL_M4_1), |
| 1771 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1772 | "unknown Dell", STAC_DELL_M4_1), |
| 1773 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1774 | "unknown Dell", STAC_DELL_M4_1), |
| 1775 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1776 | "unknown Dell", STAC_DELL_M4_1), |
| 1777 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1778 | "unknown Dell", STAC_DELL_M4_2), |
| 1779 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1780 | "unknown Dell", STAC_DELL_M4_2), |
| 1781 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1782 | "unknown Dell", STAC_DELL_M4_2), |
| 1783 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1784 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1785 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1786 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1787 | {} /* terminator */ |
| 1788 | }; |
| 1789 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1790 | static unsigned int ref922x_pin_configs[10] = { |
| 1791 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1792 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1793 | 0x40000100, 0x40000100, |
| 1794 | }; |
| 1795 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1796 | /* |
| 1797 | STAC 922X pin configs for |
| 1798 | 102801A7 |
| 1799 | 102801AB |
| 1800 | 102801A9 |
| 1801 | 102801D1 |
| 1802 | 102801D2 |
| 1803 | */ |
| 1804 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 1805 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1806 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1807 | 0x01813122, 0x400001f2, |
| 1808 | }; |
| 1809 | |
| 1810 | /* |
| 1811 | STAC 922X pin configs for |
| 1812 | 102801AC |
| 1813 | 102801D0 |
| 1814 | */ |
| 1815 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 1816 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1817 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1818 | 0x01813122, 0x400001f1, |
| 1819 | }; |
| 1820 | |
| 1821 | /* |
| 1822 | STAC 922X pin configs for |
| 1823 | 102801BF |
| 1824 | */ |
| 1825 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 1826 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1827 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1828 | 0x40C003f1, 0x405003f0, |
| 1829 | }; |
| 1830 | |
| 1831 | /* |
| 1832 | STAC 9221 A1 pin configs for |
| 1833 | 102801D7 (Dell XPS M1210) |
| 1834 | */ |
| 1835 | static unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1836 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1837 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1838 | 0x508003f3, 0x405003f4, |
| 1839 | }; |
| 1840 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1841 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1842 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1843 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1844 | 0x02a19120, 0x40000100, |
| 1845 | }; |
| 1846 | |
| 1847 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1848 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1849 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1850 | 0x02a19320, 0x40000100, |
| 1851 | }; |
| 1852 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1853 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 1854 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1855 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1856 | 0x400000fc, 0x400000fb, |
| 1857 | }; |
| 1858 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1859 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 1860 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1861 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1862 | 0x400000fc, 0x400000fb, |
| 1863 | }; |
| 1864 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1865 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 1866 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1867 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1868 | 0x400000fc, 0x400000fb, |
| 1869 | }; |
| 1870 | |
| 1871 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 1872 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1873 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1874 | 0x400000fc, 0x400000fb, |
| 1875 | }; |
| 1876 | |
| 1877 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 1878 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1879 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1880 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1881 | }; |
| 1882 | |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1883 | static unsigned int ecs202_pin_configs[10] = { |
| 1884 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 1885 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 1886 | 0x9037012e, 0x40e000f2, |
| 1887 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1888 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1889 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1890 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1891 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 1892 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1893 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 1894 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 1895 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 1896 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 1897 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1898 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1899 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1900 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 1901 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 1902 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 1903 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 1904 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 1905 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1906 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1907 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 1908 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 1909 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 1910 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1911 | }; |
| 1912 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1913 | static const char *stac922x_models[STAC_922X_MODELS] = { |
| 1914 | [STAC_D945_REF] = "ref", |
| 1915 | [STAC_D945GTP5] = "5stack", |
| 1916 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1917 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 1918 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 1919 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 1920 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 1921 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1922 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1923 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1924 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1925 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 1926 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 1927 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1928 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1929 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1930 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1931 | [STAC_922X_DELL_D81] = "dell-d81", |
| 1932 | [STAC_922X_DELL_D82] = "dell-d82", |
| 1933 | [STAC_922X_DELL_M81] = "dell-m81", |
| 1934 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1935 | }; |
| 1936 | |
| 1937 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 1938 | /* SigmaTel reference board */ |
| 1939 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1940 | "DFI LanParty", STAC_D945_REF), |
| 1941 | /* Intel 945G based systems */ |
| 1942 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 1943 | "Intel D945G", STAC_D945GTP3), |
| 1944 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 1945 | "Intel D945G", STAC_D945GTP3), |
| 1946 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 1947 | "Intel D945G", STAC_D945GTP3), |
| 1948 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 1949 | "Intel D945G", STAC_D945GTP3), |
| 1950 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 1951 | "Intel D945G", STAC_D945GTP3), |
| 1952 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 1953 | "Intel D945G", STAC_D945GTP3), |
| 1954 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 1955 | "Intel D945G", STAC_D945GTP3), |
| 1956 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 1957 | "Intel D945G", STAC_D945GTP3), |
| 1958 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 1959 | "Intel D945G", STAC_D945GTP3), |
| 1960 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 1961 | "Intel D945G", STAC_D945GTP3), |
| 1962 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 1963 | "Intel D945G", STAC_D945GTP3), |
| 1964 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 1965 | "Intel D945G", STAC_D945GTP3), |
| 1966 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 1967 | "Intel D945G", STAC_D945GTP3), |
| 1968 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 1969 | "Intel D945G", STAC_D945GTP3), |
| 1970 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 1971 | "Intel D945G", STAC_D945GTP3), |
| 1972 | /* Intel D945G 5-stack systems */ |
| 1973 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 1974 | "Intel D945G", STAC_D945GTP5), |
| 1975 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 1976 | "Intel D945G", STAC_D945GTP5), |
| 1977 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 1978 | "Intel D945G", STAC_D945GTP5), |
| 1979 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 1980 | "Intel D945G", STAC_D945GTP5), |
| 1981 | /* Intel 945P based systems */ |
| 1982 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 1983 | "Intel D945P", STAC_D945GTP3), |
| 1984 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 1985 | "Intel D945P", STAC_D945GTP3), |
| 1986 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 1987 | "Intel D945P", STAC_D945GTP3), |
| 1988 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 1989 | "Intel D945P", STAC_D945GTP3), |
| 1990 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 1991 | "Intel D945P", STAC_D945GTP3), |
| 1992 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 1993 | "Intel D945P", STAC_D945GTP5), |
| 1994 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1995 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1996 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1997 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1998 | /* Dell systems */ |
| 1999 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2000 | "unknown Dell", STAC_922X_DELL_D81), |
| 2001 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2002 | "unknown Dell", STAC_922X_DELL_D81), |
| 2003 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2004 | "unknown Dell", STAC_922X_DELL_D81), |
| 2005 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2006 | "unknown Dell", STAC_922X_DELL_D82), |
| 2007 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2008 | "unknown Dell", STAC_922X_DELL_M81), |
| 2009 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2010 | "unknown Dell", STAC_922X_DELL_D82), |
| 2011 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2012 | "unknown Dell", STAC_922X_DELL_D81), |
| 2013 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2014 | "unknown Dell", STAC_922X_DELL_D81), |
| 2015 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2016 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2017 | /* ECS/PC Chips boards */ |
| 2018 | SND_PCI_QUIRK(0x1019, 0x2144, |
| 2019 | "ECS/PC chips", STAC_ECS_202), |
| 2020 | SND_PCI_QUIRK(0x1019, 0x2608, |
| 2021 | "ECS/PC chips", STAC_ECS_202), |
| 2022 | SND_PCI_QUIRK(0x1019, 0x2633, |
| 2023 | "ECS/PC chips P17G/1333", STAC_ECS_202), |
| 2024 | SND_PCI_QUIRK(0x1019, 0x2811, |
| 2025 | "ECS/PC chips", STAC_ECS_202), |
| 2026 | SND_PCI_QUIRK(0x1019, 0x2812, |
| 2027 | "ECS/PC chips", STAC_ECS_202), |
| 2028 | SND_PCI_QUIRK(0x1019, 0x2813, |
| 2029 | "ECS/PC chips", STAC_ECS_202), |
| 2030 | SND_PCI_QUIRK(0x1019, 0x2814, |
| 2031 | "ECS/PC chips", STAC_ECS_202), |
| 2032 | SND_PCI_QUIRK(0x1019, 0x2815, |
| 2033 | "ECS/PC chips", STAC_ECS_202), |
| 2034 | SND_PCI_QUIRK(0x1019, 0x2816, |
| 2035 | "ECS/PC chips", STAC_ECS_202), |
| 2036 | SND_PCI_QUIRK(0x1019, 0x2817, |
| 2037 | "ECS/PC chips", STAC_ECS_202), |
| 2038 | SND_PCI_QUIRK(0x1019, 0x2818, |
| 2039 | "ECS/PC chips", STAC_ECS_202), |
| 2040 | SND_PCI_QUIRK(0x1019, 0x2819, |
| 2041 | "ECS/PC chips", STAC_ECS_202), |
| 2042 | SND_PCI_QUIRK(0x1019, 0x2820, |
| 2043 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2044 | {} /* terminator */ |
| 2045 | }; |
| 2046 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2047 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2048 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2049 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2050 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2051 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2052 | }; |
| 2053 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2054 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2055 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2056 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2057 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2058 | 0x40000100, 0x40000100 |
| 2059 | }; |
| 2060 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2061 | static unsigned int d965_5st_pin_configs[14] = { |
| 2062 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2063 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2064 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2065 | 0x40000100, 0x40000100 |
| 2066 | }; |
| 2067 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2068 | static unsigned int dell_3st_pin_configs[14] = { |
| 2069 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2070 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2071 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2072 | 0x40c003fc, 0x40000100 |
| 2073 | }; |
| 2074 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2075 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2076 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2077 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2078 | [STAC_D965_5ST] = d965_5st_pin_configs, |
| 2079 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2080 | [STAC_DELL_BIOS] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2081 | }; |
| 2082 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2083 | static const char *stac927x_models[STAC_927X_MODELS] = { |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2084 | [STAC_D965_REF] = "ref", |
| 2085 | [STAC_D965_3ST] = "3stack", |
| 2086 | [STAC_D965_5ST] = "5stack", |
| 2087 | [STAC_DELL_3ST] = "dell-3stack", |
| 2088 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2089 | }; |
| 2090 | |
| 2091 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 2092 | /* SigmaTel reference board */ |
| 2093 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2094 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2095 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2096 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2097 | 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] | 2098 | /* 965 based 3 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2099 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), |
| 2100 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), |
| 2101 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), |
| 2102 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), |
| 2103 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), |
| 2104 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), |
| 2105 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), |
| 2106 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), |
| 2107 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), |
| 2108 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), |
| 2109 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), |
| 2110 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), |
| 2111 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), |
| 2112 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), |
| 2113 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), |
| 2114 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2115 | /* Dell 3 stack systems */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2116 | 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] | 2117 | 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] | 2118 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2119 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2120 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2121 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
| 2122 | 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] | 2123 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Takashi Iwai | 24918b6 | 2008-09-30 12:58:54 +0200 | [diff] [blame] | 2124 | 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] | 2125 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2126 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2127 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2128 | 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] | 2129 | /* 965 based 5 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2130 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), |
| 2131 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), |
| 2132 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), |
| 2133 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), |
| 2134 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), |
| 2135 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), |
| 2136 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), |
| 2137 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), |
| 2138 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2139 | {} /* terminator */ |
| 2140 | }; |
| 2141 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2142 | static unsigned int ref9205_pin_configs[12] = { |
| 2143 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2144 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2145 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2146 | }; |
| 2147 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2148 | /* |
| 2149 | STAC 9205 pin configs for |
| 2150 | 102801F1 |
| 2151 | 102801F2 |
| 2152 | 102801FC |
| 2153 | 102801FD |
| 2154 | 10280204 |
| 2155 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2156 | 10280228 (Dell Vostro 1500) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2157 | */ |
| 2158 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 2159 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2160 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2161 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2162 | }; |
| 2163 | |
| 2164 | /* |
| 2165 | STAC 9205 pin configs for |
| 2166 | 102801F9 |
| 2167 | 102801FA |
| 2168 | 102801FE |
| 2169 | 102801FF (Dell Precision M4300) |
| 2170 | 10280206 |
| 2171 | 10280200 |
| 2172 | 10280201 |
| 2173 | */ |
| 2174 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2175 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2176 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2177 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2178 | }; |
| 2179 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2180 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2181 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2182 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2183 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2184 | }; |
| 2185 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2186 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2187 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2188 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2189 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2190 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2191 | }; |
| 2192 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2193 | static const char *stac9205_models[STAC_9205_MODELS] = { |
| 2194 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2195 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2196 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2197 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2198 | }; |
| 2199 | |
| 2200 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 2201 | /* SigmaTel reference board */ |
| 2202 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2203 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2204 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2205 | "unknown Dell", STAC_9205_DELL_M42), |
| 2206 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2207 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2208 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2209 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2210 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2211 | "Dell Precision", STAC_9205_DELL_M43), |
| 2212 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2213 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2214 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2215 | "unknown Dell", STAC_9205_DELL_M42), |
| 2216 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2217 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2218 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2219 | "Dell Precision", STAC_9205_DELL_M43), |
| 2220 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2221 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2222 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2223 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2224 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2225 | "Dell Precision", STAC_9205_DELL_M43), |
| 2226 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2227 | "Dell Precision", STAC_9205_DELL_M43), |
| 2228 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2229 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2230 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2231 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2232 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2233 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2234 | {} /* terminator */ |
| 2235 | }; |
| 2236 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2237 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) |
| 2238 | { |
| 2239 | int i; |
| 2240 | struct sigmatel_spec *spec = codec->spec; |
| 2241 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2242 | kfree(spec->pin_configs); |
| 2243 | spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs), |
| 2244 | GFP_KERNEL); |
| 2245 | if (!spec->pin_configs) |
| 2246 | return -ENOMEM; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2247 | |
| 2248 | for (i = 0; i < spec->num_pins; i++) { |
| 2249 | hda_nid_t nid = spec->pin_nids[i]; |
| 2250 | unsigned int pin_cfg; |
| 2251 | |
| 2252 | pin_cfg = snd_hda_codec_read(codec, nid, 0, |
| 2253 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); |
| 2254 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", |
| 2255 | nid, pin_cfg); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2256 | spec->pin_configs[i] = pin_cfg; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2257 | } |
| 2258 | |
| 2259 | return 0; |
| 2260 | } |
| 2261 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2262 | static void stac92xx_set_config_reg(struct hda_codec *codec, |
| 2263 | hda_nid_t pin_nid, unsigned int pin_config) |
| 2264 | { |
| 2265 | int i; |
| 2266 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2267 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 2268 | pin_config & 0x000000ff); |
| 2269 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2270 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 2271 | (pin_config & 0x0000ff00) >> 8); |
| 2272 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2273 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 2274 | (pin_config & 0x00ff0000) >> 16); |
| 2275 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2276 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 2277 | pin_config >> 24); |
| 2278 | i = snd_hda_codec_read(codec, pin_nid, 0, |
| 2279 | AC_VERB_GET_CONFIG_DEFAULT, |
| 2280 | 0x00); |
| 2281 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", |
| 2282 | pin_nid, i); |
| 2283 | } |
| 2284 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2285 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 2286 | { |
| 2287 | int i; |
| 2288 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2289 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2290 | if (!spec->pin_configs) |
| 2291 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2292 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2293 | for (i = 0; i < spec->num_pins; i++) |
| 2294 | stac92xx_set_config_reg(codec, spec->pin_nids[i], |
| 2295 | spec->pin_configs[i]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2296 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2297 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2298 | static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins) |
| 2299 | { |
| 2300 | struct sigmatel_spec *spec = codec->spec; |
| 2301 | |
| 2302 | if (!pins) |
| 2303 | return stac92xx_save_bios_config_regs(codec); |
| 2304 | |
| 2305 | kfree(spec->pin_configs); |
| 2306 | spec->pin_configs = kmemdup(pins, |
| 2307 | spec->num_pins * sizeof(*pins), |
| 2308 | GFP_KERNEL); |
| 2309 | if (!spec->pin_configs) |
| 2310 | return -ENOMEM; |
| 2311 | |
| 2312 | stac92xx_set_config_regs(codec); |
| 2313 | return 0; |
| 2314 | } |
| 2315 | |
| 2316 | static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid, |
| 2317 | unsigned int cfg) |
| 2318 | { |
| 2319 | struct sigmatel_spec *spec = codec->spec; |
| 2320 | int i; |
| 2321 | |
| 2322 | for (i = 0; i < spec->num_pins; i++) { |
| 2323 | if (spec->pin_nids[i] == nid) { |
| 2324 | spec->pin_configs[i] = cfg; |
| 2325 | stac92xx_set_config_reg(codec, nid, cfg); |
| 2326 | break; |
| 2327 | } |
| 2328 | } |
| 2329 | } |
| 2330 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2331 | /* |
| 2332 | * Analog playback callbacks |
| 2333 | */ |
| 2334 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2335 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2336 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2337 | { |
| 2338 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2339 | if (spec->stream_delay) |
| 2340 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2341 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2342 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2343 | } |
| 2344 | |
| 2345 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2346 | struct hda_codec *codec, |
| 2347 | unsigned int stream_tag, |
| 2348 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2349 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2350 | { |
| 2351 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2352 | 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] | 2353 | } |
| 2354 | |
| 2355 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2356 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2357 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2358 | { |
| 2359 | struct sigmatel_spec *spec = codec->spec; |
| 2360 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2361 | } |
| 2362 | |
| 2363 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2364 | * Digital playback callbacks |
| 2365 | */ |
| 2366 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2367 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2368 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2369 | { |
| 2370 | struct sigmatel_spec *spec = codec->spec; |
| 2371 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2372 | } |
| 2373 | |
| 2374 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2375 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2376 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2377 | { |
| 2378 | struct sigmatel_spec *spec = codec->spec; |
| 2379 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2380 | } |
| 2381 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2382 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2383 | struct hda_codec *codec, |
| 2384 | unsigned int stream_tag, |
| 2385 | unsigned int format, |
| 2386 | struct snd_pcm_substream *substream) |
| 2387 | { |
| 2388 | struct sigmatel_spec *spec = codec->spec; |
| 2389 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2390 | stream_tag, format, substream); |
| 2391 | } |
| 2392 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2393 | |
| 2394 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2395 | * Analog capture callbacks |
| 2396 | */ |
| 2397 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2398 | struct hda_codec *codec, |
| 2399 | unsigned int stream_tag, |
| 2400 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2401 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2402 | { |
| 2403 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2404 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2405 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2406 | if (spec->powerdown_adcs) { |
| 2407 | msleep(40); |
| 2408 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2409 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2410 | } |
| 2411 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2412 | return 0; |
| 2413 | } |
| 2414 | |
| 2415 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2416 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2417 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2418 | { |
| 2419 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2420 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2421 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2422 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2423 | if (spec->powerdown_adcs) |
| 2424 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2425 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2426 | return 0; |
| 2427 | } |
| 2428 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2429 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 2430 | .substreams = 1, |
| 2431 | .channels_min = 2, |
| 2432 | .channels_max = 2, |
| 2433 | /* NID is set in stac92xx_build_pcms */ |
| 2434 | .ops = { |
| 2435 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2436 | .close = stac92xx_dig_playback_pcm_close, |
| 2437 | .prepare = stac92xx_dig_playback_pcm_prepare |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2438 | }, |
| 2439 | }; |
| 2440 | |
| 2441 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 2442 | .substreams = 1, |
| 2443 | .channels_min = 2, |
| 2444 | .channels_max = 2, |
| 2445 | /* NID is set in stac92xx_build_pcms */ |
| 2446 | }; |
| 2447 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2448 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 2449 | .substreams = 1, |
| 2450 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2451 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2452 | .nid = 0x02, /* NID to query formats and rates */ |
| 2453 | .ops = { |
| 2454 | .open = stac92xx_playback_pcm_open, |
| 2455 | .prepare = stac92xx_playback_pcm_prepare, |
| 2456 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2457 | }, |
| 2458 | }; |
| 2459 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2460 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 2461 | .substreams = 1, |
| 2462 | .channels_min = 2, |
| 2463 | .channels_max = 2, |
| 2464 | .nid = 0x06, /* NID to query formats and rates */ |
| 2465 | .ops = { |
| 2466 | .open = stac92xx_playback_pcm_open, |
| 2467 | .prepare = stac92xx_playback_pcm_prepare, |
| 2468 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2469 | }, |
| 2470 | }; |
| 2471 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2472 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2473 | .channels_min = 2, |
| 2474 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2475 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2476 | .ops = { |
| 2477 | .prepare = stac92xx_capture_pcm_prepare, |
| 2478 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2479 | }, |
| 2480 | }; |
| 2481 | |
| 2482 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2483 | { |
| 2484 | struct sigmatel_spec *spec = codec->spec; |
| 2485 | struct hda_pcm *info = spec->pcm_rec; |
| 2486 | |
| 2487 | codec->num_pcms = 1; |
| 2488 | codec->pcm_info = info; |
| 2489 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2490 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2491 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2492 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2493 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2494 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2495 | |
| 2496 | if (spec->alt_switch) { |
| 2497 | codec->num_pcms++; |
| 2498 | info++; |
| 2499 | info->name = "STAC92xx Analog Alt"; |
| 2500 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2501 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2502 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2503 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2504 | codec->num_pcms++; |
| 2505 | info++; |
| 2506 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2507 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2508 | if (spec->multiout.dig_out_nid) { |
| 2509 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2510 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2511 | } |
| 2512 | if (spec->dig_in_nid) { |
| 2513 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2514 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2515 | } |
| 2516 | } |
| 2517 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2518 | return 0; |
| 2519 | } |
| 2520 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2521 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 2522 | { |
| 2523 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 2524 | AC_PAR_PIN_CAP); |
| 2525 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2526 | if (pincap & AC_PINCAP_VREF_100) |
| 2527 | return AC_PINCTL_VREF_100; |
| 2528 | if (pincap & AC_PINCAP_VREF_80) |
| 2529 | return AC_PINCTL_VREF_80; |
| 2530 | if (pincap & AC_PINCAP_VREF_50) |
| 2531 | return AC_PINCTL_VREF_50; |
| 2532 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2533 | return AC_PINCTL_VREF_GRD; |
| 2534 | return 0; |
| 2535 | } |
| 2536 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2537 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2538 | |
| 2539 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2540 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2541 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2542 | } |
| 2543 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2544 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2545 | |
| 2546 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2547 | struct snd_ctl_elem_value *ucontrol) |
| 2548 | { |
| 2549 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2550 | struct sigmatel_spec *spec = codec->spec; |
| 2551 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2552 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2553 | return 0; |
| 2554 | } |
| 2555 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 2556 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 2557 | unsigned char type); |
| 2558 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2559 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2560 | struct snd_ctl_elem_value *ucontrol) |
| 2561 | { |
| 2562 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2563 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2564 | int nid = kcontrol->private_value; |
| 2565 | |
| 2566 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2567 | |
| 2568 | /* check to be sure that the ports are upto date with |
| 2569 | * switch changes |
| 2570 | */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 2571 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2572 | |
| 2573 | return 1; |
| 2574 | } |
| 2575 | |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 2576 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2577 | |
| 2578 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2579 | { |
| 2580 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2581 | struct sigmatel_spec *spec = codec->spec; |
| 2582 | int io_idx = kcontrol-> private_value & 0xff; |
| 2583 | |
| 2584 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 2585 | return 0; |
| 2586 | } |
| 2587 | |
| 2588 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2589 | { |
| 2590 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2591 | struct sigmatel_spec *spec = codec->spec; |
| 2592 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 2593 | int io_idx = kcontrol-> private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2594 | unsigned short val = !!ucontrol->value.integer.value[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2595 | |
| 2596 | spec->io_switch[io_idx] = val; |
| 2597 | |
| 2598 | if (val) |
| 2599 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2600 | else { |
| 2601 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2602 | if (io_idx) /* set VREF for mic */ |
| 2603 | pinctl |= stac92xx_get_vref(codec, nid); |
| 2604 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2605 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2606 | |
| 2607 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2608 | * appropriately according to the pin direction |
| 2609 | */ |
| 2610 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 2611 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2612 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2613 | return 1; |
| 2614 | } |
| 2615 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2616 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2617 | |
| 2618 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2619 | struct snd_ctl_elem_value *ucontrol) |
| 2620 | { |
| 2621 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2622 | struct sigmatel_spec *spec = codec->spec; |
| 2623 | |
| 2624 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2625 | return 0; |
| 2626 | } |
| 2627 | |
| 2628 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2629 | struct snd_ctl_elem_value *ucontrol) |
| 2630 | { |
| 2631 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2632 | struct sigmatel_spec *spec = codec->spec; |
| 2633 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2634 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2635 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2636 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2637 | return 0; |
| 2638 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2639 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2640 | |
| 2641 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2642 | spec->clfe_swap ? 0x4 : 0x0); |
| 2643 | |
| 2644 | return 1; |
| 2645 | } |
| 2646 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2647 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2648 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2649 | .name = xname, \ |
| 2650 | .index = 0, \ |
| 2651 | .info = stac92xx_hp_switch_info, \ |
| 2652 | .get = stac92xx_hp_switch_get, \ |
| 2653 | .put = stac92xx_hp_switch_put, \ |
| 2654 | } |
| 2655 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2656 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2657 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2658 | .name = xname, \ |
| 2659 | .index = 0, \ |
| 2660 | .info = stac92xx_io_switch_info, \ |
| 2661 | .get = stac92xx_io_switch_get, \ |
| 2662 | .put = stac92xx_io_switch_put, \ |
| 2663 | .private_value = xpval, \ |
| 2664 | } |
| 2665 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2666 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2667 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2668 | .name = xname, \ |
| 2669 | .index = 0, \ |
| 2670 | .info = stac92xx_clfe_switch_info, \ |
| 2671 | .get = stac92xx_clfe_switch_get, \ |
| 2672 | .put = stac92xx_clfe_switch_put, \ |
| 2673 | .private_value = xpval, \ |
| 2674 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2675 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2676 | enum { |
| 2677 | STAC_CTL_WIDGET_VOL, |
| 2678 | STAC_CTL_WIDGET_MUTE, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2679 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2680 | STAC_CTL_WIDGET_AMP_MUX, |
| 2681 | STAC_CTL_WIDGET_AMP_VOL, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2682 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2683 | STAC_CTL_WIDGET_IO_SWITCH, |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2684 | STAC_CTL_WIDGET_CLFE_SWITCH |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2685 | }; |
| 2686 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2687 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2688 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2689 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2690 | STAC_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2691 | STAC_AMP_MUX, |
| 2692 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2693 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2694 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2695 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2696 | }; |
| 2697 | |
| 2698 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2699 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
| 2700 | struct snd_kcontrol_new *ktemp, |
| 2701 | int idx, const char *name, |
| 2702 | unsigned long val) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2703 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2704 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2705 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2706 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2707 | knew = snd_array_new(&spec->kctls); |
| 2708 | if (!knew) |
| 2709 | return -ENOMEM; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2710 | *knew = *ktemp; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2711 | knew->index = idx; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2712 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2713 | if (!knew->name) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2714 | return -ENOMEM; |
| 2715 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2716 | return 0; |
| 2717 | } |
| 2718 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2719 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2720 | int type, int idx, const char *name, |
| 2721 | unsigned long val) |
| 2722 | { |
| 2723 | return stac92xx_add_control_temp(spec, |
| 2724 | &stac92xx_control_templates[type], |
| 2725 | idx, name, val); |
| 2726 | } |
| 2727 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2728 | |
| 2729 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2730 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2731 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2732 | { |
| 2733 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2734 | } |
| 2735 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2736 | /* flag inputs as additional dynamic lineouts */ |
| 2737 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
| 2738 | { |
| 2739 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2740 | unsigned int wcaps, wtype; |
| 2741 | int i, num_dacs = 0; |
| 2742 | |
| 2743 | /* use the wcaps cache to count all DACs available for line-outs */ |
| 2744 | for (i = 0; i < codec->num_nodes; i++) { |
| 2745 | wcaps = codec->wcaps[i]; |
| 2746 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2747 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2748 | if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL)) |
| 2749 | num_dacs++; |
| 2750 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2751 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2752 | snd_printdd("%s: total dac count=%d\n", __func__, num_dacs); |
| 2753 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2754 | switch (cfg->line_outs) { |
| 2755 | case 3: |
| 2756 | /* add line-in as side */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2757 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2758 | cfg->line_out_pins[cfg->line_outs] = |
| 2759 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2760 | spec->line_switch = 1; |
| 2761 | cfg->line_outs++; |
| 2762 | } |
| 2763 | break; |
| 2764 | case 2: |
| 2765 | /* add line-in as clfe and mic as side */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2766 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2767 | cfg->line_out_pins[cfg->line_outs] = |
| 2768 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2769 | spec->line_switch = 1; |
| 2770 | cfg->line_outs++; |
| 2771 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2772 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2773 | cfg->line_out_pins[cfg->line_outs] = |
| 2774 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2775 | spec->mic_switch = 1; |
| 2776 | cfg->line_outs++; |
| 2777 | } |
| 2778 | break; |
| 2779 | case 1: |
| 2780 | /* add line-in as surr and mic as clfe */ |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2781 | if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2782 | cfg->line_out_pins[cfg->line_outs] = |
| 2783 | cfg->input_pins[AUTO_PIN_LINE]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2784 | spec->line_switch = 1; |
| 2785 | cfg->line_outs++; |
| 2786 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2787 | if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { |
Takashi Iwai | c480f79 | 2007-09-03 09:43:38 +0200 | [diff] [blame] | 2788 | cfg->line_out_pins[cfg->line_outs] = |
| 2789 | cfg->input_pins[AUTO_PIN_MIC]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2790 | spec->mic_switch = 1; |
| 2791 | cfg->line_outs++; |
| 2792 | } |
| 2793 | break; |
| 2794 | } |
| 2795 | |
| 2796 | return 0; |
| 2797 | } |
| 2798 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2799 | |
| 2800 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2801 | { |
| 2802 | int i; |
| 2803 | |
| 2804 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2805 | if (spec->multiout.dac_nids[i] == nid) |
| 2806 | return 1; |
| 2807 | } |
| 2808 | |
| 2809 | return 0; |
| 2810 | } |
| 2811 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2812 | /* |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2813 | * Fill in the dac_nids table from the parsed pin configuration |
| 2814 | * This function only works when every pin in line_out_pins[] |
| 2815 | * contains atleast one DAC in its connection list. Some 92xx |
| 2816 | * codecs are not connected directly to a DAC, such as the 9200 |
| 2817 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2818 | */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2819 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2820 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2821 | { |
| 2822 | struct sigmatel_spec *spec = codec->spec; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2823 | int i, j, conn_len = 0; |
| 2824 | hda_nid_t nid, conn[HDA_MAX_CONNECTIONS]; |
| 2825 | unsigned int wcaps, wtype; |
| 2826 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2827 | for (i = 0; i < cfg->line_outs; i++) { |
| 2828 | nid = cfg->line_out_pins[i]; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2829 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2830 | HDA_MAX_CONNECTIONS); |
| 2831 | for (j = 0; j < conn_len; j++) { |
| 2832 | wcaps = snd_hda_param_read(codec, conn[j], |
| 2833 | AC_PAR_AUDIO_WIDGET_CAP); |
| 2834 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2835 | if (wtype != AC_WID_AUD_OUT || |
| 2836 | (wcaps & AC_WCAP_DIGITAL)) |
| 2837 | continue; |
| 2838 | /* conn[j] is a DAC routed to this line-out */ |
| 2839 | if (!is_in_dac_nids(spec, conn[j])) |
| 2840 | break; |
| 2841 | } |
| 2842 | |
| 2843 | if (j == conn_len) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2844 | if (spec->multiout.num_dacs > 0) { |
| 2845 | /* we have already working output pins, |
| 2846 | * so let's drop the broken ones again |
| 2847 | */ |
| 2848 | cfg->line_outs = spec->multiout.num_dacs; |
| 2849 | break; |
| 2850 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2851 | /* error out, no available DAC found */ |
| 2852 | snd_printk(KERN_ERR |
| 2853 | "%s: No available DAC for pin 0x%x\n", |
| 2854 | __func__, nid); |
| 2855 | return -ENODEV; |
| 2856 | } |
| 2857 | |
| 2858 | spec->multiout.dac_nids[i] = conn[j]; |
| 2859 | spec->multiout.num_dacs++; |
| 2860 | if (conn_len > 1) { |
| 2861 | /* select this DAC in the pin's input mux */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2862 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2863 | AC_VERB_SET_CONNECT_SEL, j); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2864 | |
| 2865 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2866 | } |
| 2867 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2868 | snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
| 2869 | spec->multiout.num_dacs, |
| 2870 | spec->multiout.dac_nids[0], |
| 2871 | spec->multiout.dac_nids[1], |
| 2872 | spec->multiout.dac_nids[2], |
| 2873 | spec->multiout.dac_nids[3], |
| 2874 | spec->multiout.dac_nids[4]); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2875 | return 0; |
| 2876 | } |
| 2877 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2878 | /* create volume control/switch for the given prefx type */ |
| 2879 | static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) |
| 2880 | { |
| 2881 | char name[32]; |
| 2882 | int err; |
| 2883 | |
| 2884 | sprintf(name, "%s Playback Volume", pfx); |
| 2885 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
| 2886 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 2887 | if (err < 0) |
| 2888 | return err; |
| 2889 | sprintf(name, "%s Playback Switch", pfx); |
| 2890 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 2891 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 2892 | if (err < 0) |
| 2893 | return err; |
| 2894 | return 0; |
| 2895 | } |
| 2896 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2897 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2898 | { |
| 2899 | if (!spec->multiout.hp_nid) |
| 2900 | spec->multiout.hp_nid = nid; |
| 2901 | else if (spec->multiout.num_dacs > 4) { |
| 2902 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 2903 | return 1; |
| 2904 | } else { |
| 2905 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 2906 | spec->multiout.num_dacs++; |
| 2907 | } |
| 2908 | return 0; |
| 2909 | } |
| 2910 | |
| 2911 | static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2912 | { |
| 2913 | if (is_in_dac_nids(spec, nid)) |
| 2914 | return 1; |
| 2915 | if (spec->multiout.hp_nid == nid) |
| 2916 | return 1; |
| 2917 | return 0; |
| 2918 | } |
| 2919 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2920 | /* add playback controls from the parsed DAC table */ |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2921 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2922 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2923 | { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2924 | static const char *chname[4] = { |
| 2925 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 2926 | }; |
Matthew Ranostay | d21995e | 2008-10-13 13:22:45 -0400 | [diff] [blame] | 2927 | hda_nid_t nid = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2928 | int i, err; |
| 2929 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2930 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2931 | unsigned int wid_caps, pincap; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2932 | |
| 2933 | |
Takashi Iwai | 40ac8c4 | 2008-02-29 14:16:17 +0100 | [diff] [blame] | 2934 | for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2935 | if (!spec->multiout.dac_nids[i]) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2936 | continue; |
| 2937 | |
| 2938 | nid = spec->multiout.dac_nids[i]; |
| 2939 | |
| 2940 | if (i == 2) { |
| 2941 | /* Center/LFE */ |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2942 | err = create_controls(spec, "Center", nid, 1); |
| 2943 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2944 | return err; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2945 | err = create_controls(spec, "LFE", nid, 2); |
| 2946 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2947 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2948 | |
| 2949 | wid_caps = get_wcaps(codec, nid); |
| 2950 | |
| 2951 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 2952 | err = stac92xx_add_control(spec, |
| 2953 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 2954 | "Swap Center/LFE Playback Switch", nid); |
| 2955 | |
| 2956 | if (err < 0) |
| 2957 | return err; |
| 2958 | } |
| 2959 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2960 | } else { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 2961 | err = create_controls(spec, chname[i], nid, 3); |
| 2962 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2963 | return err; |
| 2964 | } |
| 2965 | } |
| 2966 | |
Matthew Ranostay | fedb756 | 2008-09-23 21:46:30 -0400 | [diff] [blame] | 2967 | if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && |
| 2968 | cfg->hp_outs && !spec->multiout.hp_nid) |
| 2969 | spec->multiout.hp_nid = nid; |
| 2970 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 2971 | 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] | 2972 | err = stac92xx_add_control(spec, |
| 2973 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2974 | "Headphone as Line Out Switch", |
| 2975 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2976 | if (err < 0) |
| 2977 | return err; |
| 2978 | } |
| 2979 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2980 | if (spec->line_switch) { |
| 2981 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
| 2982 | pincap = snd_hda_param_read(codec, nid, |
| 2983 | AC_PAR_PIN_CAP); |
| 2984 | if (pincap & AC_PINCAP_OUT) { |
| 2985 | err = stac92xx_add_control(spec, |
| 2986 | STAC_CTL_WIDGET_IO_SWITCH, |
| 2987 | "Line In as Output Switch", nid << 8); |
| 2988 | if (err < 0) |
| 2989 | return err; |
| 2990 | } |
| 2991 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2992 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 2993 | if (spec->mic_switch) { |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2994 | unsigned int def_conf; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 2995 | unsigned int mic_pin = AUTO_PIN_MIC; |
| 2996 | again: |
| 2997 | nid = cfg->input_pins[mic_pin]; |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 2998 | def_conf = snd_hda_codec_read(codec, nid, 0, |
| 2999 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 3000 | /* some laptops have an internal analog microphone |
| 3001 | * which can't be used as a output */ |
| 3002 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
| 3003 | pincap = snd_hda_param_read(codec, nid, |
| 3004 | AC_PAR_PIN_CAP); |
| 3005 | if (pincap & AC_PINCAP_OUT) { |
| 3006 | err = stac92xx_add_control(spec, |
| 3007 | STAC_CTL_WIDGET_IO_SWITCH, |
| 3008 | "Mic as Output Switch", (nid << 8) | 1); |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3009 | nid = snd_hda_codec_read(codec, nid, 0, |
| 3010 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 3011 | if (!check_in_dac_nids(spec, nid)) |
| 3012 | add_spec_dacs(spec, nid); |
Matthew Ranostay | cace16f | 2008-01-30 14:58:38 +0100 | [diff] [blame] | 3013 | if (err < 0) |
| 3014 | return err; |
| 3015 | } |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3016 | } else if (mic_pin == AUTO_PIN_MIC) { |
| 3017 | mic_pin = AUTO_PIN_FRONT_MIC; |
| 3018 | goto again; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3019 | } |
| 3020 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3021 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3022 | return 0; |
| 3023 | } |
| 3024 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3025 | /* add playback controls for Speaker and HP outputs */ |
| 3026 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3027 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3028 | { |
| 3029 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3030 | hda_nid_t nid; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3031 | int i, old_num_dacs, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3032 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3033 | old_num_dacs = spec->multiout.num_dacs; |
| 3034 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3035 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); |
| 3036 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 3037 | spec->hp_detect = 1; |
| 3038 | nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 3039 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 3040 | if (check_in_dac_nids(spec, nid)) |
| 3041 | nid = 0; |
| 3042 | if (! nid) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3043 | continue; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3044 | add_spec_dacs(spec, nid); |
| 3045 | } |
| 3046 | for (i = 0; i < cfg->speaker_outs; i++) { |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3047 | nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3048 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 3049 | if (check_in_dac_nids(spec, nid)) |
| 3050 | nid = 0; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3051 | if (! nid) |
| 3052 | continue; |
| 3053 | add_spec_dacs(spec, nid); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3054 | } |
Matthew Ranostay | 1b290a5 | 2007-07-12 15:17:34 +0200 | [diff] [blame] | 3055 | for (i = 0; i < cfg->line_outs; i++) { |
| 3056 | nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0, |
| 3057 | AC_VERB_GET_CONNECT_LIST, 0) & 0xff; |
| 3058 | if (check_in_dac_nids(spec, nid)) |
| 3059 | nid = 0; |
| 3060 | if (! nid) |
| 3061 | continue; |
| 3062 | add_spec_dacs(spec, nid); |
| 3063 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3064 | for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { |
| 3065 | static const char *pfxs[] = { |
| 3066 | "Speaker", "External Speaker", "Speaker2", |
| 3067 | }; |
| 3068 | err = create_controls(spec, pfxs[i - old_num_dacs], |
| 3069 | spec->multiout.dac_nids[i], 3); |
| 3070 | if (err < 0) |
| 3071 | return err; |
| 3072 | } |
| 3073 | if (spec->multiout.hp_nid) { |
Takashi Iwai | 2626a26 | 2008-03-14 09:18:32 +0100 | [diff] [blame] | 3074 | err = create_controls(spec, "Headphone", |
| 3075 | spec->multiout.hp_nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3076 | if (err < 0) |
| 3077 | return err; |
| 3078 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3079 | |
| 3080 | return 0; |
| 3081 | } |
| 3082 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3083 | /* labels for mono mux outputs */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3084 | static const char *stac92xx_mono_labels[4] = { |
| 3085 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3086 | }; |
| 3087 | |
| 3088 | /* create mono mux for mono out on capable codecs */ |
| 3089 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3090 | { |
| 3091 | struct sigmatel_spec *spec = codec->spec; |
| 3092 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3093 | int i, num_cons; |
| 3094 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3095 | |
| 3096 | num_cons = snd_hda_get_connections(codec, |
| 3097 | spec->mono_nid, |
| 3098 | con_lst, |
| 3099 | HDA_MAX_NUM_INPUTS); |
| 3100 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
| 3101 | return -EINVAL; |
| 3102 | |
| 3103 | for (i = 0; i < num_cons; i++) { |
| 3104 | mono_mux->items[mono_mux->num_items].label = |
| 3105 | stac92xx_mono_labels[i]; |
| 3106 | mono_mux->items[mono_mux->num_items].index = i; |
| 3107 | mono_mux->num_items++; |
| 3108 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3109 | |
| 3110 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3111 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3112 | } |
| 3113 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3114 | /* labels for amp mux outputs */ |
| 3115 | static const char *stac92xx_amp_labels[3] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 3116 | "Front Microphone", "Microphone", "Line In", |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3117 | }; |
| 3118 | |
| 3119 | /* create amp out controls mux on capable codecs */ |
| 3120 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) |
| 3121 | { |
| 3122 | struct sigmatel_spec *spec = codec->spec; |
| 3123 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; |
| 3124 | int i, err; |
| 3125 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3126 | for (i = 0; i < spec->num_amps; i++) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3127 | amp_mux->items[amp_mux->num_items].label = |
| 3128 | stac92xx_amp_labels[i]; |
| 3129 | amp_mux->items[amp_mux->num_items].index = i; |
| 3130 | amp_mux->num_items++; |
| 3131 | } |
| 3132 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3133 | if (spec->num_amps > 1) { |
| 3134 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, |
| 3135 | "Amp Selector Capture Switch", 0); |
| 3136 | if (err < 0) |
| 3137 | return err; |
| 3138 | } |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3139 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, |
| 3140 | "Amp Capture Volume", |
| 3141 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); |
| 3142 | } |
| 3143 | |
| 3144 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3145 | /* create PC beep volume controls */ |
| 3146 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3147 | hda_nid_t nid) |
| 3148 | { |
| 3149 | struct sigmatel_spec *spec = codec->spec; |
| 3150 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3151 | int err; |
| 3152 | |
| 3153 | /* check for mute support for the the amp */ |
| 3154 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
| 3155 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3156 | "PC Beep Playback Switch", |
| 3157 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3158 | if (err < 0) |
| 3159 | return err; |
| 3160 | } |
| 3161 | |
| 3162 | /* check to see if there is volume support for the amp */ |
| 3163 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3164 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
| 3165 | "PC Beep Playback Volume", |
| 3166 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3167 | if (err < 0) |
| 3168 | return err; |
| 3169 | } |
| 3170 | return 0; |
| 3171 | } |
| 3172 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3173 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3174 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3175 | |
| 3176 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3177 | struct snd_ctl_elem_value *ucontrol) |
| 3178 | { |
| 3179 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3180 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3181 | return 0; |
| 3182 | } |
| 3183 | |
| 3184 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3185 | struct snd_ctl_elem_value *ucontrol) |
| 3186 | { |
| 3187 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3188 | int enabled = !!ucontrol->value.integer.value[0]; |
| 3189 | if (codec->beep->enabled != enabled) { |
| 3190 | codec->beep->enabled = enabled; |
| 3191 | return 1; |
| 3192 | } |
| 3193 | return 0; |
| 3194 | } |
| 3195 | |
| 3196 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
| 3197 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3198 | .info = stac92xx_dig_beep_switch_info, |
| 3199 | .get = stac92xx_dig_beep_switch_get, |
| 3200 | .put = stac92xx_dig_beep_switch_put, |
| 3201 | }; |
| 3202 | |
| 3203 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3204 | { |
| 3205 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
| 3206 | 0, "PC Beep Playback Switch", 0); |
| 3207 | } |
| 3208 | #endif |
| 3209 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3210 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3211 | { |
| 3212 | struct sigmatel_spec *spec = codec->spec; |
| 3213 | int wcaps, nid, i, err = 0; |
| 3214 | |
| 3215 | for (i = 0; i < spec->num_muxes; i++) { |
| 3216 | nid = spec->mux_nids[i]; |
| 3217 | wcaps = get_wcaps(codec, nid); |
| 3218 | |
| 3219 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 3220 | err = stac92xx_add_control_idx(spec, |
| 3221 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", |
| 3222 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3223 | if (err < 0) |
| 3224 | return err; |
| 3225 | } |
| 3226 | } |
| 3227 | return 0; |
| 3228 | }; |
| 3229 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3230 | static const char *stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3231 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3232 | }; |
| 3233 | |
| 3234 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3235 | { |
| 3236 | struct sigmatel_spec *spec = codec->spec; |
| 3237 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3238 | const char **labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3239 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3240 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3241 | |
| 3242 | num_cons = snd_hda_get_connections(codec, |
| 3243 | spec->smux_nids[0], |
| 3244 | con_lst, |
| 3245 | HDA_MAX_NUM_INPUTS); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3246 | if (!num_cons) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3247 | return -EINVAL; |
| 3248 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3249 | if (!labels) |
| 3250 | labels = stac92xx_spdif_labels; |
| 3251 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3252 | for (i = 0; i < num_cons; i++) { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3253 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3254 | spdif_mux->items[spdif_mux->num_items].index = i; |
| 3255 | spdif_mux->num_items++; |
| 3256 | } |
| 3257 | |
| 3258 | return 0; |
| 3259 | } |
| 3260 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3261 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 3262 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3263 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3264 | "Digital Mic 3", "Digital Mic 4" |
| 3265 | }; |
| 3266 | |
| 3267 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3268 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3269 | const struct auto_pin_cfg *cfg) |
| 3270 | { |
| 3271 | struct sigmatel_spec *spec = codec->spec; |
| 3272 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 3273 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3274 | int err, i, j; |
| 3275 | char name[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3276 | |
| 3277 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 3278 | dimux->items[dimux->num_items].index = 0; |
| 3279 | dimux->num_items++; |
| 3280 | |
| 3281 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3282 | hda_nid_t nid; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3283 | int index; |
| 3284 | int num_cons; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3285 | unsigned int wcaps; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3286 | unsigned int def_conf; |
| 3287 | |
| 3288 | def_conf = snd_hda_codec_read(codec, |
| 3289 | spec->dmic_nids[i], |
| 3290 | 0, |
| 3291 | AC_VERB_GET_CONFIG_DEFAULT, |
| 3292 | 0); |
| 3293 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3294 | continue; |
| 3295 | |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3296 | nid = spec->dmic_nids[i]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3297 | num_cons = snd_hda_get_connections(codec, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3298 | spec->dmux_nids[0], |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3299 | con_lst, |
| 3300 | HDA_MAX_NUM_INPUTS); |
| 3301 | for (j = 0; j < num_cons; j++) |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3302 | if (con_lst[j] == nid) { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3303 | index = j; |
| 3304 | goto found; |
| 3305 | } |
| 3306 | continue; |
| 3307 | found: |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3308 | wcaps = get_wcaps(codec, nid) & |
| 3309 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3310 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3311 | if (wcaps) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3312 | sprintf(name, "%s Capture Volume", |
| 3313 | stac92xx_dmic_labels[dimux->num_items]); |
| 3314 | |
| 3315 | err = stac92xx_add_control(spec, |
| 3316 | STAC_CTL_WIDGET_VOL, |
| 3317 | name, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3318 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3319 | (wcaps & AC_WCAP_OUT_AMP) ? |
| 3320 | HDA_OUTPUT : HDA_INPUT)); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3321 | if (err < 0) |
| 3322 | return err; |
| 3323 | } |
| 3324 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3325 | dimux->items[dimux->num_items].label = |
| 3326 | stac92xx_dmic_labels[dimux->num_items]; |
| 3327 | dimux->items[dimux->num_items].index = index; |
| 3328 | dimux->num_items++; |
| 3329 | } |
| 3330 | |
| 3331 | return 0; |
| 3332 | } |
| 3333 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3334 | /* create playback/capture controls for input pins */ |
| 3335 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3336 | { |
| 3337 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3338 | struct hda_input_mux *imux = &spec->private_imux; |
| 3339 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 3340 | int i, j, k; |
| 3341 | |
| 3342 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3343 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3344 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3345 | if (!cfg->input_pins[i]) |
| 3346 | continue; |
| 3347 | index = -1; |
| 3348 | for (j = 0; j < spec->num_muxes; j++) { |
| 3349 | int num_cons; |
| 3350 | num_cons = snd_hda_get_connections(codec, |
| 3351 | spec->mux_nids[j], |
| 3352 | con_lst, |
| 3353 | HDA_MAX_NUM_INPUTS); |
| 3354 | for (k = 0; k < num_cons; k++) |
| 3355 | if (con_lst[k] == cfg->input_pins[i]) { |
| 3356 | index = k; |
| 3357 | goto found; |
| 3358 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3359 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3360 | continue; |
| 3361 | found: |
| 3362 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 3363 | imux->items[imux->num_items].index = index; |
| 3364 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3365 | } |
| 3366 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3367 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3368 | /* |
| 3369 | * Set the current input for the muxes. |
| 3370 | * The STAC9221 has two input muxes with identical source |
| 3371 | * NID lists. Hopefully this won't get confused. |
| 3372 | */ |
| 3373 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3374 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3375 | AC_VERB_SET_CONNECT_SEL, |
| 3376 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3377 | } |
| 3378 | } |
| 3379 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3380 | return 0; |
| 3381 | } |
| 3382 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3383 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3384 | { |
| 3385 | struct sigmatel_spec *spec = codec->spec; |
| 3386 | int i; |
| 3387 | |
| 3388 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3389 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3390 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3391 | } |
| 3392 | } |
| 3393 | |
| 3394 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3395 | { |
| 3396 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3397 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3398 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3399 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3400 | hda_nid_t pin; |
| 3401 | pin = spec->autocfg.hp_pins[i]; |
| 3402 | if (pin) /* connect to front */ |
| 3403 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3404 | } |
| 3405 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3406 | hda_nid_t pin; |
| 3407 | pin = spec->autocfg.speaker_pins[i]; |
| 3408 | if (pin) /* connect to front */ |
| 3409 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3410 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3411 | } |
| 3412 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3413 | 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] | 3414 | { |
| 3415 | struct sigmatel_spec *spec = codec->spec; |
| 3416 | int err; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3417 | int hp_speaker_swap = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3418 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3419 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3420 | &spec->autocfg, |
| 3421 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3422 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3423 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3424 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3425 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3426 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3427 | * be set up as multi-channel outputs. |
| 3428 | */ |
| 3429 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && |
| 3430 | spec->autocfg.hp_outs > 1) { |
| 3431 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3432 | * speaker_outs so that the following routines can handle |
| 3433 | * HP pins as primary outputs. |
| 3434 | */ |
| 3435 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3436 | sizeof(spec->autocfg.line_out_pins)); |
| 3437 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3438 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3439 | sizeof(spec->autocfg.hp_pins)); |
| 3440 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
| 3441 | hp_speaker_swap = 1; |
| 3442 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3443 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3444 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3445 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3446 | u32 caps = query_amp_caps(codec, |
| 3447 | spec->autocfg.mono_out_pin, dir); |
| 3448 | hda_nid_t conn_list[1]; |
| 3449 | |
| 3450 | /* get the mixer node and then the mono mux if it exists */ |
| 3451 | if (snd_hda_get_connections(codec, |
| 3452 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3453 | snd_hda_get_connections(codec, conn_list[0], |
| 3454 | conn_list, 1)) { |
| 3455 | |
| 3456 | int wcaps = get_wcaps(codec, conn_list[0]); |
| 3457 | int wid_type = (wcaps & AC_WCAP_TYPE) |
| 3458 | >> AC_WCAP_TYPE_SHIFT; |
| 3459 | /* LR swap check, some stac925x have a mux that |
| 3460 | * changes the DACs output path instead of the |
| 3461 | * mono-mux path. |
| 3462 | */ |
| 3463 | if (wid_type == AC_WID_AUD_SEL && |
| 3464 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3465 | spec->mono_nid = conn_list[0]; |
| 3466 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3467 | if (dir) { |
| 3468 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3469 | |
| 3470 | /* most mono outs have a least a mute/unmute switch */ |
| 3471 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3472 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3473 | "Mono Playback Switch", |
| 3474 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3475 | if (err < 0) |
| 3476 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3477 | /* check for volume support for the amp */ |
| 3478 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3479 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3480 | err = stac92xx_add_control(spec, |
| 3481 | STAC_CTL_WIDGET_VOL, |
| 3482 | "Mono Playback Volume", |
| 3483 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3484 | if (err < 0) |
| 3485 | return err; |
| 3486 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3487 | } |
| 3488 | |
| 3489 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3490 | AC_PINCTL_OUT_EN); |
| 3491 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3492 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3493 | if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) |
| 3494 | return err; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3495 | if (spec->multiout.num_dacs == 0) |
| 3496 | if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) |
| 3497 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3498 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3499 | err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg); |
| 3500 | |
| 3501 | if (err < 0) |
| 3502 | return err; |
| 3503 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3504 | /* setup analog beep controls */ |
| 3505 | if (spec->anabeep_nid > 0) { |
| 3506 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3507 | spec->anabeep_nid); |
| 3508 | if (err < 0) |
| 3509 | return err; |
| 3510 | } |
| 3511 | |
| 3512 | /* setup digital beep controls and input device */ |
| 3513 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3514 | if (spec->digbeep_nid > 0) { |
| 3515 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3516 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3517 | |
| 3518 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3519 | if (err < 0) |
| 3520 | return err; |
| 3521 | err = snd_hda_attach_beep_device(codec, nid); |
| 3522 | if (err < 0) |
| 3523 | return err; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3524 | /* if no beep switch is available, make its own one */ |
| 3525 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3526 | if (codec->beep && |
| 3527 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { |
| 3528 | err = stac92xx_beep_switch_ctl(codec); |
| 3529 | if (err < 0) |
| 3530 | return err; |
| 3531 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3532 | } |
| 3533 | #endif |
| 3534 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3535 | if (hp_speaker_swap == 1) { |
| 3536 | /* Restore the hp_outs and line_outs */ |
| 3537 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 3538 | sizeof(spec->autocfg.line_out_pins)); |
| 3539 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 3540 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins, |
| 3541 | sizeof(spec->autocfg.speaker_pins)); |
| 3542 | spec->autocfg.line_outs = spec->autocfg.speaker_outs; |
| 3543 | memset(spec->autocfg.speaker_pins, 0, |
| 3544 | sizeof(spec->autocfg.speaker_pins)); |
| 3545 | spec->autocfg.speaker_outs = 0; |
| 3546 | } |
| 3547 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3548 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
| 3549 | |
| 3550 | if (err < 0) |
| 3551 | return err; |
| 3552 | |
| 3553 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
| 3554 | |
| 3555 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3556 | return err; |
| 3557 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3558 | if (spec->mono_nid > 0) { |
| 3559 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3560 | if (err < 0) |
| 3561 | return err; |
| 3562 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3563 | if (spec->num_amps > 0) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3564 | err = stac92xx_auto_create_amp_output_ctls(codec); |
| 3565 | if (err < 0) |
| 3566 | return err; |
| 3567 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3568 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3569 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3570 | &spec->autocfg)) < 0) |
| 3571 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3572 | if (spec->num_muxes > 0) { |
| 3573 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3574 | if (err < 0) |
| 3575 | return err; |
| 3576 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3577 | if (spec->num_smuxes > 0) { |
| 3578 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3579 | if (err < 0) |
| 3580 | return err; |
| 3581 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3582 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3583 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3584 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3585 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3586 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3587 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3588 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3589 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3590 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3591 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3592 | if (spec->kctls.list) |
| 3593 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3594 | |
| 3595 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3596 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3597 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3598 | spec->mono_mux = &spec->private_mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3599 | spec->amp_mux = &spec->private_amp_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3600 | return 1; |
| 3601 | } |
| 3602 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3603 | /* add playback controls for HP output */ |
| 3604 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 3605 | struct auto_pin_cfg *cfg) |
| 3606 | { |
| 3607 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3608 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3609 | unsigned int wid_caps; |
| 3610 | |
| 3611 | if (! pin) |
| 3612 | return 0; |
| 3613 | |
| 3614 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 3615 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3616 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3617 | |
| 3618 | return 0; |
| 3619 | } |
| 3620 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3621 | /* add playback controls for LFE output */ |
| 3622 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 3623 | struct auto_pin_cfg *cfg) |
| 3624 | { |
| 3625 | struct sigmatel_spec *spec = codec->spec; |
| 3626 | int err; |
| 3627 | hda_nid_t lfe_pin = 0x0; |
| 3628 | int i; |
| 3629 | |
| 3630 | /* |
| 3631 | * search speaker outs and line outs for a mono speaker pin |
| 3632 | * with an amp. If one is found, add LFE controls |
| 3633 | * for it. |
| 3634 | */ |
| 3635 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 3636 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3637 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3638 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3639 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3640 | /* found a mono speaker with an amp, must be lfe */ |
| 3641 | lfe_pin = pin; |
| 3642 | } |
| 3643 | |
| 3644 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 3645 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 3646 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 3647 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3648 | unsigned int defcfg; |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 3649 | defcfg = snd_hda_codec_read(codec, pin, 0, |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3650 | AC_VERB_GET_CONFIG_DEFAULT, |
| 3651 | 0x00); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 3652 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3653 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3654 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3655 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3656 | /* found a mono speaker with an amp, |
| 3657 | must be lfe */ |
| 3658 | lfe_pin = pin; |
| 3659 | } |
| 3660 | } |
| 3661 | } |
| 3662 | |
| 3663 | if (lfe_pin) { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3664 | err = create_controls(spec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3665 | if (err < 0) |
| 3666 | return err; |
| 3667 | } |
| 3668 | |
| 3669 | return 0; |
| 3670 | } |
| 3671 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3672 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 3673 | { |
| 3674 | struct sigmatel_spec *spec = codec->spec; |
| 3675 | int err; |
| 3676 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3677 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3678 | return err; |
| 3679 | |
| 3680 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 3681 | return err; |
| 3682 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3683 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 3684 | return err; |
| 3685 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3686 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 3687 | return err; |
| 3688 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 3689 | if (spec->num_muxes > 0) { |
| 3690 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3691 | if (err < 0) |
| 3692 | return err; |
| 3693 | } |
| 3694 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3695 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3696 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3697 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3698 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3699 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3700 | if (spec->kctls.list) |
| 3701 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3702 | |
| 3703 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3704 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3705 | |
| 3706 | return 1; |
| 3707 | } |
| 3708 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3709 | /* |
| 3710 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 3711 | * funky external mute control using GPIO pins. |
| 3712 | */ |
| 3713 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3714 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3715 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3716 | { |
| 3717 | unsigned int gpiostate, gpiomask, gpiodir; |
| 3718 | |
| 3719 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 3720 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3721 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3722 | |
| 3723 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 3724 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3725 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3726 | |
| 3727 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 3728 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3729 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3730 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3731 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3732 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 3733 | |
| 3734 | snd_hda_codec_write(codec, codec->afg, 0, |
| 3735 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3736 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3737 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3738 | |
| 3739 | msleep(1); |
| 3740 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3741 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3742 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3743 | } |
| 3744 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3745 | static int stac92xx_add_jack(struct hda_codec *codec, |
| 3746 | hda_nid_t nid, int type) |
| 3747 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3748 | #ifdef CONFIG_SND_JACK |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3749 | struct sigmatel_spec *spec = codec->spec; |
| 3750 | struct sigmatel_jack *jack; |
| 3751 | int def_conf = snd_hda_codec_read(codec, nid, |
| 3752 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3753 | int connectivity = get_defcfg_connect(def_conf); |
| 3754 | char name[32]; |
| 3755 | |
| 3756 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
| 3757 | return 0; |
| 3758 | |
| 3759 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 3760 | jack = snd_array_new(&spec->jacks); |
| 3761 | if (!jack) |
| 3762 | return -ENOMEM; |
| 3763 | jack->nid = nid; |
| 3764 | jack->type = type; |
| 3765 | |
| 3766 | sprintf(name, "%s at %s %s Jack", |
| 3767 | snd_hda_get_jack_type(def_conf), |
| 3768 | snd_hda_get_jack_connectivity(def_conf), |
| 3769 | snd_hda_get_jack_location(def_conf)); |
| 3770 | |
| 3771 | return snd_jack_new(codec->bus->card, name, type, &jack->jack); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3772 | #else |
| 3773 | return 0; |
| 3774 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3775 | } |
| 3776 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3777 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, |
| 3778 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3779 | { |
| 3780 | struct sigmatel_event *event; |
| 3781 | |
| 3782 | snd_array_init(&spec->events, sizeof(*event), 32); |
| 3783 | event = snd_array_new(&spec->events); |
| 3784 | if (!event) |
| 3785 | return -ENOMEM; |
| 3786 | event->nid = nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3787 | event->type = type; |
| 3788 | event->tag = spec->events.used; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3789 | event->data = data; |
| 3790 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3791 | return event->tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3792 | } |
| 3793 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3794 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, |
| 3795 | hda_nid_t nid, unsigned char type) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3796 | { |
| 3797 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3798 | struct sigmatel_event *event = spec->events.list; |
| 3799 | int i; |
| 3800 | |
| 3801 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3802 | if (event->nid == nid && event->type == type) |
| 3803 | return event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3804 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3805 | return NULL; |
| 3806 | } |
| 3807 | |
| 3808 | static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, |
| 3809 | unsigned char tag) |
| 3810 | { |
| 3811 | struct sigmatel_spec *spec = codec->spec; |
| 3812 | struct sigmatel_event *event = spec->events.list; |
| 3813 | int i; |
| 3814 | |
| 3815 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3816 | if (event->tag == tag) |
| 3817 | return event; |
| 3818 | } |
| 3819 | return NULL; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3820 | } |
| 3821 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3822 | 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^] | 3823 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3824 | { |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3825 | struct sigmatel_event *event; |
| 3826 | int tag; |
| 3827 | |
| 3828 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
| 3829 | return; |
| 3830 | event = stac_get_event(codec, nid, type); |
| 3831 | if (event) |
| 3832 | tag = event->tag; |
| 3833 | else |
| 3834 | tag = stac_add_event(codec->spec, nid, type, 0); |
| 3835 | if (tag < 0) |
| 3836 | return; |
| 3837 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3838 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 3839 | AC_USRSP_EN | tag); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3840 | } |
| 3841 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3842 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
| 3843 | { |
| 3844 | int i; |
| 3845 | for (i = 0; i < cfg->hp_outs; i++) |
| 3846 | if (cfg->hp_pins[i] == nid) |
| 3847 | return 1; /* nid is a HP-Out */ |
| 3848 | |
| 3849 | return 0; /* nid is not a HP-Out */ |
| 3850 | }; |
| 3851 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3852 | static void stac92xx_power_down(struct hda_codec *codec) |
| 3853 | { |
| 3854 | struct sigmatel_spec *spec = codec->spec; |
| 3855 | |
| 3856 | /* power down inactive DACs */ |
| 3857 | hda_nid_t *dac; |
| 3858 | for (dac = spec->dac_list; *dac; dac++) |
Matthew Ranostay | 4451089 | 2008-02-21 07:49:31 +0100 | [diff] [blame] | 3859 | if (!is_in_dac_nids(spec, *dac) && |
| 3860 | spec->multiout.hp_nid != *dac) |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 3861 | snd_hda_codec_write_cache(codec, *dac, 0, |
| 3862 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 3863 | } |
| 3864 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3865 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 3866 | int enable); |
| 3867 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3868 | static int stac92xx_init(struct hda_codec *codec) |
| 3869 | { |
| 3870 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3871 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3872 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3873 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3874 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3875 | snd_hda_sequence_write(codec, spec->init); |
| 3876 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 3877 | /* power down adcs initially */ |
| 3878 | if (spec->powerdown_adcs) |
| 3879 | for (i = 0; i < spec->num_adcs; i++) |
| 3880 | snd_hda_codec_write_cache(codec, |
| 3881 | spec->adc_nids[i], 0, |
| 3882 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3883 | |
| 3884 | /* set up GPIO */ |
| 3885 | gpio = spec->gpio_data; |
| 3886 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 3887 | * otherwise, unsol event will turn it on/off dynamically |
| 3888 | */ |
| 3889 | if (!spec->eapd_switch) |
| 3890 | gpio |= spec->eapd_mask; |
| 3891 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 3892 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3893 | /* set up pins */ |
| 3894 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 3895 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3896 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3897 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3898 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3899 | } |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 3900 | /* force to enable the first line-out; the others are set up |
| 3901 | * in unsol_event |
| 3902 | */ |
| 3903 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3904 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3905 | /* fake event to set up pins */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3906 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 3907 | STAC_HP_EVENT); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3908 | } else { |
| 3909 | stac92xx_auto_init_multi_out(codec); |
| 3910 | stac92xx_auto_init_hp_out(codec); |
| 3911 | } |
| 3912 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 3913 | hda_nid_t nid = cfg->input_pins[i]; |
| 3914 | if (nid) { |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 3915 | unsigned int pinctl; |
| 3916 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
| 3917 | /* for mic pins, force to initialize */ |
| 3918 | pinctl = stac92xx_get_vref(codec, nid); |
| 3919 | } else { |
| 3920 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 3921 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3922 | /* if PINCTL already set then skip */ |
| 3923 | if (pinctl & AC_PINCTL_IN_EN) |
| 3924 | continue; |
| 3925 | } |
| 3926 | pinctl |= AC_PINCTL_IN_EN; |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 3927 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3928 | enable_pin_detect(codec, nid, STAC_INSERT_EVENT); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 3929 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3930 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 3931 | for (i = 0; i < spec->num_dmics; i++) |
| 3932 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 3933 | AC_PINCTL_IN_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3934 | if (cfg->dig_out_pin) |
| 3935 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 3936 | AC_PINCTL_OUT_EN); |
| 3937 | if (cfg->dig_in_pin) |
| 3938 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 3939 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3940 | for (i = 0; i < spec->num_pwrs; i++) { |
| 3941 | hda_nid_t nid = spec->pwr_nids[i]; |
| 3942 | int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3943 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3944 | if (is_nid_hp_pin(cfg, nid) && spec->hp_detect) |
| 3945 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3946 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3947 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 3948 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 3949 | /* outputs are only ports capable of power management |
| 3950 | * any attempts on powering down a input port cause the |
| 3951 | * referenced VREF to act quirky. |
| 3952 | */ |
| 3953 | if (pinctl & AC_PINCTL_IN_EN) |
| 3954 | continue; |
| 3955 | def_conf = snd_hda_codec_read(codec, nid, 0, |
| 3956 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3957 | def_conf = get_defcfg_connect(def_conf); |
| 3958 | /* skip any ports that don't have jacks since presence |
| 3959 | * detection is useless */ |
| 3960 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
| 3961 | if (def_conf != AC_JACK_PORT_NONE) |
| 3962 | stac_toggle_power_map(codec, nid, 1); |
| 3963 | continue; |
| 3964 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 3965 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); |
| 3966 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 3967 | } |
| 3968 | if (spec->dac_list) |
| 3969 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3970 | return 0; |
| 3971 | } |
| 3972 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3973 | static void stac92xx_free_jacks(struct hda_codec *codec) |
| 3974 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3975 | #ifdef CONFIG_SND_JACK |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 3976 | /* free jack instances manually when clearing/reconfiguring */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3977 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 3978 | if (!codec->bus->shutdown && spec->jacks.list) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3979 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 3980 | int i; |
| 3981 | for (i = 0; i < spec->jacks.used; i++) |
| 3982 | snd_device_free(codec->bus->card, &jacks[i].jack); |
| 3983 | } |
| 3984 | snd_array_free(&spec->jacks); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3985 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3986 | } |
| 3987 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3988 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 3989 | { |
| 3990 | struct sigmatel_spec *spec = codec->spec; |
| 3991 | |
| 3992 | if (spec->kctls.list) { |
| 3993 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 3994 | int i; |
| 3995 | for (i = 0; i < spec->kctls.used; i++) |
| 3996 | kfree(kctl[i].name); |
| 3997 | } |
| 3998 | snd_array_free(&spec->kctls); |
| 3999 | } |
| 4000 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4001 | static void stac92xx_free(struct hda_codec *codec) |
| 4002 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4003 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4004 | |
| 4005 | if (! spec) |
| 4006 | return; |
| 4007 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4008 | kfree(spec->pin_configs); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4009 | stac92xx_free_jacks(codec); |
| 4010 | snd_array_free(&spec->events); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4011 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4012 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4013 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4014 | } |
| 4015 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4016 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4017 | unsigned int flag) |
| 4018 | { |
| 4019 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4020 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4021 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4022 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4023 | /* |
| 4024 | * we need to check the current set-up direction of |
| 4025 | * shared input pins since they can be switched via |
| 4026 | * "xxx as Output" mixer switch |
| 4027 | */ |
| 4028 | struct sigmatel_spec *spec = codec->spec; |
| 4029 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4030 | if ((nid == cfg->input_pins[AUTO_PIN_LINE] && |
| 4031 | spec->line_switch) || |
| 4032 | (nid == cfg->input_pins[AUTO_PIN_MIC] && |
| 4033 | spec->mic_switch)) |
| 4034 | return; |
| 4035 | } |
| 4036 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4037 | /* if setting pin direction bits, clear the current |
| 4038 | direction bits first */ |
| 4039 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4040 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4041 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4042 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4043 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4044 | pin_ctl | flag); |
| 4045 | } |
| 4046 | |
| 4047 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4048 | unsigned int flag) |
| 4049 | { |
| 4050 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4051 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4052 | snd_hda_codec_write_cache(codec, nid, 0, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4053 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4054 | pin_ctl & ~flag); |
| 4055 | } |
| 4056 | |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 4057 | static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4058 | { |
| 4059 | if (!nid) |
| 4060 | return 0; |
| 4061 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 4062 | & (1 << 31)) { |
| 4063 | unsigned int pinctl; |
| 4064 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4065 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4066 | if (pinctl & AC_PINCTL_IN_EN) |
| 4067 | return 0; /* mic- or line-input */ |
| 4068 | else |
| 4069 | return 1; /* HP-output */ |
| 4070 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4071 | return 0; |
| 4072 | } |
| 4073 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4074 | /* return non-zero if the hp-pin of the given array index isn't |
| 4075 | * a jack-detection target |
| 4076 | */ |
| 4077 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4078 | { |
| 4079 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4080 | |
| 4081 | /* ignore sensing of shared line and mic jacks */ |
| 4082 | if (spec->line_switch && |
| 4083 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_LINE]) |
| 4084 | return 1; |
| 4085 | if (spec->mic_switch && |
| 4086 | cfg->hp_pins[i] == cfg->input_pins[AUTO_PIN_MIC]) |
| 4087 | return 1; |
| 4088 | /* ignore if the pin is set as line-out */ |
| 4089 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4090 | return 1; |
| 4091 | return 0; |
| 4092 | } |
| 4093 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4094 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4095 | { |
| 4096 | struct sigmatel_spec *spec = codec->spec; |
| 4097 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4098 | int i, presence; |
| 4099 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4100 | presence = 0; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4101 | if (spec->gpio_mute) |
| 4102 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4103 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4104 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4105 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4106 | if (presence) |
| 4107 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4108 | if (no_hp_sensing(spec, i)) |
| 4109 | continue; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4110 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4111 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4112 | |
| 4113 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4114 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4115 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4116 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4117 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4118 | for (i = 0; i < cfg->line_outs; i++) |
| 4119 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4120 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4121 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4122 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4123 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4124 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4125 | stac_gpio_set(codec, spec->gpio_mask, |
| 4126 | spec->gpio_dir, spec->gpio_data & |
| 4127 | ~spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4128 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4129 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4130 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4131 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4132 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4133 | for (i = 0; i < cfg->line_outs; i++) |
| 4134 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4135 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4136 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4137 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4138 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4139 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4140 | stac_gpio_set(codec, spec->gpio_mask, |
| 4141 | spec->gpio_dir, spec->gpio_data | |
| 4142 | spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4143 | } |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4144 | /* toggle hp outs */ |
| 4145 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4146 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4147 | if (no_hp_sensing(spec, i)) |
| 4148 | continue; |
| 4149 | if (presence) |
| 4150 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
| 4151 | else |
| 4152 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
| 4153 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4154 | } |
| 4155 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4156 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4157 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4158 | { |
| 4159 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4160 | unsigned int idx, val; |
| 4161 | |
| 4162 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4163 | if (spec->pwr_nids[idx] == nid) |
| 4164 | break; |
| 4165 | } |
| 4166 | if (idx >= spec->num_pwrs) |
| 4167 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4168 | |
| 4169 | /* several codecs have two power down bits */ |
| 4170 | if (spec->pwr_mapping) |
| 4171 | idx = spec->pwr_mapping[idx]; |
| 4172 | else |
| 4173 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4174 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4175 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
| 4176 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4177 | val &= ~idx; |
| 4178 | else |
| 4179 | val |= idx; |
| 4180 | |
| 4181 | /* power down unused output ports */ |
| 4182 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4183 | } |
| 4184 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4185 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4186 | { |
| 4187 | stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid)); |
| 4188 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4189 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4190 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 4191 | { |
| 4192 | struct sigmatel_spec *spec = codec->spec; |
| 4193 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4194 | |
| 4195 | if (jacks) { |
| 4196 | int i; |
| 4197 | for (i = 0; i < spec->jacks.used; i++) { |
| 4198 | if (jacks->nid == nid) { |
| 4199 | unsigned int pin_ctl = |
| 4200 | snd_hda_codec_read(codec, nid, |
| 4201 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 4202 | 0x00); |
| 4203 | int type = jacks->type; |
| 4204 | if (type == (SND_JACK_LINEOUT |
| 4205 | | SND_JACK_HEADPHONE)) |
| 4206 | type = (pin_ctl & AC_PINCTL_HP_EN) |
| 4207 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; |
| 4208 | snd_jack_report(jacks->jack, |
| 4209 | get_hp_pin_presence(codec, nid) |
| 4210 | ? type : 0); |
| 4211 | } |
| 4212 | jacks++; |
| 4213 | } |
| 4214 | } |
| 4215 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4216 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4217 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 4218 | unsigned char type) |
| 4219 | { |
| 4220 | struct sigmatel_event *event = stac_get_event(codec, nid, type); |
| 4221 | if (!event) |
| 4222 | return; |
| 4223 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); |
| 4224 | } |
| 4225 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4226 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4227 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4228 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4229 | struct sigmatel_event *event; |
| 4230 | int tag, data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4231 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4232 | tag = (res >> 26) & 0x7f; |
| 4233 | event = stac_get_event_from_tag(codec, tag); |
| 4234 | if (!event) |
| 4235 | return; |
| 4236 | |
| 4237 | switch (event->type) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4238 | case STAC_HP_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4239 | stac92xx_hp_detect(codec); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4240 | /* fallthru */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4241 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4242 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4243 | if (spec->num_pwrs > 0) |
| 4244 | stac92xx_pin_sense(codec, event->nid); |
| 4245 | stac92xx_report_jack(codec, event->nid); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4246 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4247 | case STAC_VREF_EVENT: |
| 4248 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4249 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4250 | /* toggle VREF state based on GPIOx status */ |
| 4251 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4252 | !!(data & (1 << event->data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4253 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4254 | } |
| 4255 | } |
| 4256 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4257 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4258 | static int stac92xx_resume(struct hda_codec *codec) |
| 4259 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4260 | struct sigmatel_spec *spec = codec->spec; |
| 4261 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4262 | stac92xx_set_config_regs(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4263 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4264 | snd_hda_codec_resume_amp(codec); |
| 4265 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4266 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4267 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4268 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 4269 | STAC_HP_EVENT); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4270 | return 0; |
| 4271 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4272 | |
| 4273 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4274 | { |
| 4275 | struct sigmatel_spec *spec = codec->spec; |
| 4276 | if (spec->eapd_mask) |
| 4277 | stac_gpio_set(codec, spec->gpio_mask, |
| 4278 | spec->gpio_dir, spec->gpio_data & |
| 4279 | ~spec->eapd_mask); |
| 4280 | return 0; |
| 4281 | } |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4282 | #endif |
| 4283 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4284 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 4285 | .build_controls = stac92xx_build_controls, |
| 4286 | .build_pcms = stac92xx_build_pcms, |
| 4287 | .init = stac92xx_init, |
| 4288 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4289 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4290 | #ifdef SND_HDA_NEEDS_RESUME |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4291 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4292 | .resume = stac92xx_resume, |
| 4293 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4294 | }; |
| 4295 | |
| 4296 | static int patch_stac9200(struct hda_codec *codec) |
| 4297 | { |
| 4298 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4299 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4300 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4301 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4302 | if (spec == NULL) |
| 4303 | return -ENOMEM; |
| 4304 | |
| 4305 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4306 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4307 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4308 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 4309 | stac9200_models, |
| 4310 | stac9200_cfg_tbl); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4311 | if (spec->board_config < 0) { |
| 4312 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 4313 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4314 | } else |
| 4315 | err = stac_save_pin_cfgs(codec, |
| 4316 | stac9200_brd_tbl[spec->board_config]); |
| 4317 | if (err < 0) { |
| 4318 | stac92xx_free(codec); |
| 4319 | return err; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 4320 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4321 | |
| 4322 | spec->multiout.max_channels = 2; |
| 4323 | spec->multiout.num_dacs = 1; |
| 4324 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 4325 | spec->adc_nids = stac9200_adc_nids; |
| 4326 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 4327 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4328 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4329 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4330 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4331 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 4332 | if (spec->board_config == STAC_9200_GATEWAY || |
| 4333 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 4334 | spec->init = stac9200_eapd_init; |
| 4335 | else |
| 4336 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4337 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4338 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 4339 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 4340 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 4341 | spec->gpio_data = 0x00; |
| 4342 | } |
| 4343 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4344 | err = stac9200_parse_auto_config(codec); |
| 4345 | if (err < 0) { |
| 4346 | stac92xx_free(codec); |
| 4347 | return err; |
| 4348 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4349 | |
| 4350 | codec->patch_ops = stac92xx_patch_ops; |
| 4351 | |
| 4352 | return 0; |
| 4353 | } |
| 4354 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4355 | static int patch_stac925x(struct hda_codec *codec) |
| 4356 | { |
| 4357 | struct sigmatel_spec *spec; |
| 4358 | int err; |
| 4359 | |
| 4360 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4361 | if (spec == NULL) |
| 4362 | return -ENOMEM; |
| 4363 | |
| 4364 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4365 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4366 | spec->pin_nids = stac925x_pin_nids; |
| 4367 | spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, |
| 4368 | stac925x_models, |
| 4369 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4370 | again: |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4371 | if (spec->board_config < 0) { |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4372 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
| 4373 | "using BIOS defaults\n"); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4374 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4375 | } else |
| 4376 | err = stac_save_pin_cfgs(codec, |
| 4377 | stac925x_brd_tbl[spec->board_config]); |
| 4378 | if (err < 0) { |
| 4379 | stac92xx_free(codec); |
| 4380 | return err; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4381 | } |
| 4382 | |
| 4383 | spec->multiout.max_channels = 2; |
| 4384 | spec->multiout.num_dacs = 1; |
| 4385 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 4386 | spec->adc_nids = stac925x_adc_nids; |
| 4387 | spec->mux_nids = stac925x_mux_nids; |
| 4388 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4389 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4390 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4391 | switch (codec->vendor_id) { |
| 4392 | case 0x83847632: /* STAC9202 */ |
| 4393 | case 0x83847633: /* STAC9202D */ |
| 4394 | case 0x83847636: /* STAC9251 */ |
| 4395 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 4396 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4397 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4398 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 4399 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4400 | break; |
| 4401 | default: |
| 4402 | spec->num_dmics = 0; |
| 4403 | break; |
| 4404 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4405 | |
| 4406 | spec->init = stac925x_core_init; |
| 4407 | spec->mixer = stac925x_mixer; |
| 4408 | |
| 4409 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4410 | if (!err) { |
| 4411 | if (spec->board_config < 0) { |
| 4412 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4413 | "available, default to model=ref\n"); |
| 4414 | spec->board_config = STAC_925x_REF; |
| 4415 | goto again; |
| 4416 | } |
| 4417 | err = -EINVAL; |
| 4418 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4419 | if (err < 0) { |
| 4420 | stac92xx_free(codec); |
| 4421 | return err; |
| 4422 | } |
| 4423 | |
| 4424 | codec->patch_ops = stac92xx_patch_ops; |
| 4425 | |
| 4426 | return 0; |
| 4427 | } |
| 4428 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4429 | static struct hda_input_mux stac92hd73xx_dmux = { |
| 4430 | .num_items = 4, |
| 4431 | .items = { |
| 4432 | { "Analog Inputs", 0x0b }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4433 | { "Digital Mic 1", 0x09 }, |
| 4434 | { "Digital Mic 2", 0x0a }, |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4435 | { "CD", 0x08 }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4436 | } |
| 4437 | }; |
| 4438 | |
| 4439 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 4440 | { |
| 4441 | struct sigmatel_spec *spec; |
| 4442 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 4443 | int err = 0; |
| 4444 | |
| 4445 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4446 | if (spec == NULL) |
| 4447 | return -ENOMEM; |
| 4448 | |
| 4449 | codec->spec = spec; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 4450 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4451 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 4452 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 4453 | spec->board_config = snd_hda_check_board_config(codec, |
| 4454 | STAC_92HD73XX_MODELS, |
| 4455 | stac92hd73xx_models, |
| 4456 | stac92hd73xx_cfg_tbl); |
| 4457 | again: |
| 4458 | if (spec->board_config < 0) { |
| 4459 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4460 | " STAC92HD73XX, using BIOS defaults\n"); |
| 4461 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4462 | } else |
| 4463 | err = stac_save_pin_cfgs(codec, |
| 4464 | stac92hd73xx_brd_tbl[spec->board_config]); |
| 4465 | if (err < 0) { |
| 4466 | stac92xx_free(codec); |
| 4467 | return err; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4468 | } |
| 4469 | |
| 4470 | spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a, |
| 4471 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 4472 | |
| 4473 | if (spec->multiout.num_dacs < 0) { |
| 4474 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 4475 | "number of channels defaulting to DAC count\n"); |
| 4476 | spec->multiout.num_dacs = STAC92HD73_DAC_COUNT; |
| 4477 | } |
| 4478 | |
| 4479 | switch (spec->multiout.num_dacs) { |
| 4480 | case 0x3: /* 6 Channel */ |
| 4481 | spec->mixer = stac92hd73xx_6ch_mixer; |
| 4482 | spec->init = stac92hd73xx_6ch_core_init; |
| 4483 | break; |
| 4484 | case 0x4: /* 8 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4485 | spec->mixer = stac92hd73xx_8ch_mixer; |
| 4486 | spec->init = stac92hd73xx_8ch_core_init; |
| 4487 | break; |
| 4488 | case 0x5: /* 10 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4489 | spec->mixer = stac92hd73xx_10ch_mixer; |
| 4490 | spec->init = stac92hd73xx_10ch_core_init; |
| 4491 | }; |
| 4492 | |
| 4493 | spec->multiout.dac_nids = stac92hd73xx_dac_nids; |
| 4494 | spec->aloopback_mask = 0x01; |
| 4495 | spec->aloopback_shift = 8; |
| 4496 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4497 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4498 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 4499 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 4500 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 4501 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4502 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 4503 | spec->amp_nids = stac92hd73xx_amp_nids; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4504 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4505 | |
| 4506 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 4507 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4508 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4509 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
| 4510 | sizeof(stac92hd73xx_dmux)); |
| 4511 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4512 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4513 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 4514 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4515 | /* fallthru */ |
| 4516 | case STAC_DELL_M6: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4517 | spec->num_smuxes = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4518 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
| 4519 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4520 | spec->eapd_switch = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4521 | spec->num_amps = 1; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4522 | |
| 4523 | if (!spec->init) |
| 4524 | spec->init = dell_m6_core_init; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4525 | switch (codec->subsystem_id) { |
| 4526 | case 0x1028025e: /* Analog Mics */ |
| 4527 | case 0x1028025f: |
| 4528 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 4529 | spec->num_dmics = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4530 | spec->private_dimux.num_items = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4531 | break; |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 4532 | case 0x10280271: /* Digital Mics */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4533 | case 0x10280272: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 4534 | case 0x10280254: |
| 4535 | case 0x10280255: |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4536 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 4537 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4538 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4539 | break; |
| 4540 | case 0x10280256: /* Both */ |
| 4541 | case 0x10280057: |
| 4542 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 4543 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 4544 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4545 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4546 | break; |
| 4547 | } |
| 4548 | break; |
| 4549 | default: |
| 4550 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4551 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4552 | spec->eapd_switch = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4553 | } |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 4554 | if (spec->board_config > STAC_92HD73XX_REF) { |
| 4555 | /* GPIO0 High = Enable EAPD */ |
| 4556 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 4557 | spec->gpio_data = 0x01; |
| 4558 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4559 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4560 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4561 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 4562 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 4563 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4564 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4565 | |
| 4566 | if (!err) { |
| 4567 | if (spec->board_config < 0) { |
| 4568 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4569 | "available, default to model=ref\n"); |
| 4570 | spec->board_config = STAC_92HD73XX_REF; |
| 4571 | goto again; |
| 4572 | } |
| 4573 | err = -EINVAL; |
| 4574 | } |
| 4575 | |
| 4576 | if (err < 0) { |
| 4577 | stac92xx_free(codec); |
| 4578 | return err; |
| 4579 | } |
| 4580 | |
| 4581 | codec->patch_ops = stac92xx_patch_ops; |
| 4582 | |
| 4583 | return 0; |
| 4584 | } |
| 4585 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4586 | static struct hda_input_mux stac92hd83xxx_dmux = { |
| 4587 | .num_items = 3, |
| 4588 | .items = { |
| 4589 | { "Analog Inputs", 0x03 }, |
| 4590 | { "Digital Mic 1", 0x04 }, |
| 4591 | { "Digital Mic 2", 0x05 }, |
| 4592 | } |
| 4593 | }; |
| 4594 | |
| 4595 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 4596 | { |
| 4597 | struct sigmatel_spec *spec; |
| 4598 | int err; |
| 4599 | |
| 4600 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4601 | if (spec == NULL) |
| 4602 | return -ENOMEM; |
| 4603 | |
| 4604 | codec->spec = spec; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 4605 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4606 | spec->mono_nid = 0x19; |
| 4607 | spec->digbeep_nid = 0x21; |
| 4608 | spec->dmic_nids = stac92hd83xxx_dmic_nids; |
| 4609 | spec->dmux_nids = stac92hd83xxx_dmux_nids; |
| 4610 | spec->adc_nids = stac92hd83xxx_adc_nids; |
| 4611 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
| 4612 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; |
| 4613 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
| 4614 | spec->multiout.dac_nids = stac92hd83xxx_dac_nids; |
| 4615 | |
| 4616 | spec->init = stac92hd83xxx_core_init; |
| 4617 | switch (codec->vendor_id) { |
| 4618 | case 0x111d7605: |
| 4619 | spec->multiout.num_dacs = STAC92HD81_DAC_COUNT; |
| 4620 | break; |
| 4621 | default: |
| 4622 | spec->num_pwrs--; |
| 4623 | spec->init++; /* switch to config #2 */ |
| 4624 | spec->multiout.num_dacs = STAC92HD83_DAC_COUNT; |
| 4625 | } |
| 4626 | |
| 4627 | spec->mixer = stac92hd83xxx_mixer; |
| 4628 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
| 4629 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); |
| 4630 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); |
| 4631 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; |
| 4632 | spec->dinput_mux = &stac92hd83xxx_dmux; |
| 4633 | spec->pin_nids = stac92hd83xxx_pin_nids; |
| 4634 | spec->board_config = snd_hda_check_board_config(codec, |
| 4635 | STAC_92HD83XXX_MODELS, |
| 4636 | stac92hd83xxx_models, |
| 4637 | stac92hd83xxx_cfg_tbl); |
| 4638 | again: |
| 4639 | if (spec->board_config < 0) { |
| 4640 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4641 | " STAC92HD83XXX, using BIOS defaults\n"); |
| 4642 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4643 | } else |
| 4644 | err = stac_save_pin_cfgs(codec, |
| 4645 | stac92hd83xxx_brd_tbl[spec->board_config]); |
| 4646 | if (err < 0) { |
| 4647 | stac92xx_free(codec); |
| 4648 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4649 | } |
| 4650 | |
| 4651 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); |
| 4652 | if (!err) { |
| 4653 | if (spec->board_config < 0) { |
| 4654 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4655 | "available, default to model=ref\n"); |
| 4656 | spec->board_config = STAC_92HD83XXX_REF; |
| 4657 | goto again; |
| 4658 | } |
| 4659 | err = -EINVAL; |
| 4660 | } |
| 4661 | |
| 4662 | if (err < 0) { |
| 4663 | stac92xx_free(codec); |
| 4664 | return err; |
| 4665 | } |
| 4666 | |
| 4667 | codec->patch_ops = stac92xx_patch_ops; |
| 4668 | |
| 4669 | return 0; |
| 4670 | } |
| 4671 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4672 | #ifdef SND_HDA_NEEDS_RESUME |
| 4673 | static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr) |
| 4674 | { |
| 4675 | struct sigmatel_spec *spec = codec->spec; |
| 4676 | int i; |
| 4677 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 4678 | AC_VERB_SET_POWER_STATE, pwr); |
| 4679 | |
| 4680 | msleep(1); |
| 4681 | for (i = 0; i < spec->num_adcs; i++) { |
| 4682 | snd_hda_codec_write_cache(codec, |
| 4683 | spec->adc_nids[i], 0, |
| 4684 | AC_VERB_SET_POWER_STATE, pwr); |
| 4685 | } |
| 4686 | }; |
| 4687 | |
| 4688 | static int stac92hd71xx_resume(struct hda_codec *codec) |
| 4689 | { |
| 4690 | stac92hd71xx_set_power_state(codec, AC_PWRST_D0); |
| 4691 | return stac92xx_resume(codec); |
| 4692 | } |
| 4693 | |
| 4694 | static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4695 | { |
| 4696 | stac92hd71xx_set_power_state(codec, AC_PWRST_D3); |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4697 | return stac92xx_suspend(codec, state); |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4698 | }; |
| 4699 | |
| 4700 | #endif |
| 4701 | |
| 4702 | static struct hda_codec_ops stac92hd71bxx_patch_ops = { |
| 4703 | .build_controls = stac92xx_build_controls, |
| 4704 | .build_pcms = stac92xx_build_pcms, |
| 4705 | .init = stac92xx_init, |
| 4706 | .free = stac92xx_free, |
| 4707 | .unsol_event = stac92xx_unsol_event, |
| 4708 | #ifdef SND_HDA_NEEDS_RESUME |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4709 | .suspend = stac92hd71xx_suspend, |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4710 | .resume = stac92hd71xx_resume, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4711 | #endif |
| 4712 | }; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4713 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4714 | static struct hda_input_mux stac92hd71bxx_dmux = { |
| 4715 | .num_items = 4, |
| 4716 | .items = { |
| 4717 | { "Analog Inputs", 0x00 }, |
| 4718 | { "Mixer", 0x01 }, |
| 4719 | { "Digital Mic 1", 0x02 }, |
| 4720 | { "Digital Mic 2", 0x03 }, |
| 4721 | } |
| 4722 | }; |
| 4723 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4724 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 4725 | { |
| 4726 | struct sigmatel_spec *spec; |
| 4727 | int err = 0; |
| 4728 | |
| 4729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4730 | if (spec == NULL) |
| 4731 | return -ENOMEM; |
| 4732 | |
| 4733 | codec->spec = spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4734 | codec->patch_ops = stac92xx_patch_ops; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4735 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4736 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4737 | spec->pin_nids = stac92hd71bxx_pin_nids; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4738 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, |
| 4739 | sizeof(stac92hd71bxx_dmux)); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4740 | spec->board_config = snd_hda_check_board_config(codec, |
| 4741 | STAC_92HD71BXX_MODELS, |
| 4742 | stac92hd71bxx_models, |
| 4743 | stac92hd71bxx_cfg_tbl); |
| 4744 | again: |
| 4745 | if (spec->board_config < 0) { |
| 4746 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4747 | " STAC92HD71BXX, using BIOS defaults\n"); |
| 4748 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4749 | } else |
| 4750 | err = stac_save_pin_cfgs(codec, |
| 4751 | stac92hd71bxx_brd_tbl[spec->board_config]); |
| 4752 | if (err < 0) { |
| 4753 | stac92xx_free(codec); |
| 4754 | return err; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4755 | } |
| 4756 | |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 4757 | if (spec->board_config > STAC_92HD71BXX_REF) { |
| 4758 | /* GPIO0 = EAPD */ |
| 4759 | spec->gpio_mask = 0x01; |
| 4760 | spec->gpio_dir = 0x01; |
| 4761 | spec->gpio_data = 0x01; |
| 4762 | } |
| 4763 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4764 | switch (codec->vendor_id) { |
| 4765 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 4766 | case 0x111d76b7: |
| 4767 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 4768 | case 0x111d76b5: |
| 4769 | spec->mixer = stac92hd71bxx_mixer; |
| 4770 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 4771 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4772 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4773 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 4774 | switch (spec->board_config) { |
| 4775 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4776 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4777 | err = stac_add_event(spec, codec->afg, |
| 4778 | STAC_VREF_EVENT, 0x02); |
| 4779 | if (err < 0) |
| 4780 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 4781 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4782 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
| 4783 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4784 | AC_VERB_SET_UNSOLICITED_ENABLE, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 4785 | AC_USRSP_EN | err); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4786 | spec->gpio_mask |= 0x02; |
| 4787 | break; |
| 4788 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4789 | if ((codec->revision_id & 0xf) == 0 || |
| 4790 | (codec->revision_id & 0xf) == 1) { |
| 4791 | #ifdef SND_HDA_NEEDS_RESUME |
| 4792 | codec->patch_ops = stac92hd71bxx_patch_ops; |
| 4793 | #endif |
| 4794 | spec->stream_delay = 40; /* 40 milliseconds */ |
| 4795 | } |
| 4796 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4797 | /* no output amps */ |
| 4798 | spec->num_pwrs = 0; |
| 4799 | spec->mixer = stac92hd71bxx_analog_mixer; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4800 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4801 | |
| 4802 | /* disable VSW */ |
| 4803 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4804 | stac_change_pin_config(codec, 0xf, 0x40f000f0); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4805 | break; |
| 4806 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4807 | if ((codec->revision_id & 0xf) == 1) { |
| 4808 | #ifdef SND_HDA_NEEDS_RESUME |
| 4809 | codec->patch_ops = stac92hd71bxx_patch_ops; |
| 4810 | #endif |
| 4811 | spec->stream_delay = 40; /* 40 milliseconds */ |
| 4812 | } |
| 4813 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4814 | /* no output amps */ |
| 4815 | spec->num_pwrs = 0; |
| 4816 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4817 | default: |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4818 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4819 | spec->mixer = stac92hd71bxx_analog_mixer; |
| 4820 | spec->init = stac92hd71bxx_analog_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 4821 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4822 | } |
| 4823 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4824 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 4825 | spec->aloopback_shift = 0; |
| 4826 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4827 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4828 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4829 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 4830 | spec->adc_nids = stac92hd71bxx_adc_nids; |
| 4831 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4832 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4833 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4834 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4835 | |
| 4836 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 4837 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4838 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 4839 | switch (spec->board_config) { |
| 4840 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 4841 | /* enable internal microphone */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4842 | stac_change_pin_config(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea71 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 4843 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 4844 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 4845 | /* fallthru */ |
| 4846 | case STAC_DELL_M4_2: |
| 4847 | spec->num_dmics = 0; |
| 4848 | spec->num_smuxes = 0; |
| 4849 | spec->num_dmuxes = 0; |
| 4850 | break; |
| 4851 | case STAC_DELL_M4_1: |
| 4852 | case STAC_DELL_M4_3: |
| 4853 | spec->num_dmics = 1; |
| 4854 | spec->num_smuxes = 0; |
| 4855 | spec->num_dmuxes = 0; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 4856 | break; |
| 4857 | default: |
| 4858 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; |
| 4859 | spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); |
| 4860 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 4861 | }; |
| 4862 | |
Takashi Iwai | aea7bb0 | 2008-02-25 18:26:41 +0100 | [diff] [blame] | 4863 | spec->multiout.num_dacs = 1; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4864 | spec->multiout.hp_nid = 0x11; |
| 4865 | spec->multiout.dac_nids = stac92hd71bxx_dac_nids; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4866 | if (spec->dinput_mux) |
| 4867 | spec->private_dimux.num_items += |
| 4868 | spec->num_dmics - |
| 4869 | (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4870 | |
| 4871 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); |
| 4872 | if (!err) { |
| 4873 | if (spec->board_config < 0) { |
| 4874 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4875 | "available, default to model=ref\n"); |
| 4876 | spec->board_config = STAC_92HD71BXX_REF; |
| 4877 | goto again; |
| 4878 | } |
| 4879 | err = -EINVAL; |
| 4880 | } |
| 4881 | |
| 4882 | if (err < 0) { |
| 4883 | stac92xx_free(codec); |
| 4884 | return err; |
| 4885 | } |
| 4886 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4887 | return 0; |
| 4888 | }; |
| 4889 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4890 | static int patch_stac922x(struct hda_codec *codec) |
| 4891 | { |
| 4892 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4893 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4894 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4895 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4896 | if (spec == NULL) |
| 4897 | return -ENOMEM; |
| 4898 | |
| 4899 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4900 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4901 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4902 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 4903 | stac922x_models, |
| 4904 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 4905 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4906 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 4907 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 4908 | /* Intel Macs have all same PCI SSID, so we need to check |
| 4909 | * codec SSID to distinguish the exact models |
| 4910 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 4911 | 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] | 4912 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 4913 | |
| 4914 | case 0x106b0800: |
| 4915 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 4916 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 4917 | case 0x106b0600: |
| 4918 | case 0x106b0700: |
| 4919 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 4920 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 4921 | case 0x106b0e00: |
| 4922 | case 0x106b0f00: |
| 4923 | case 0x106b1600: |
| 4924 | case 0x106b1700: |
| 4925 | case 0x106b0200: |
| 4926 | case 0x106b1e00: |
| 4927 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 4928 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 4929 | case 0x106b1a00: |
| 4930 | case 0x00000100: |
| 4931 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 4932 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 4933 | case 0x106b0a00: |
| 4934 | case 0x106b2200: |
| 4935 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 4936 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 4937 | default: |
| 4938 | spec->board_config = STAC_INTEL_MAC_V3; |
| 4939 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 4940 | } |
| 4941 | } |
| 4942 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4943 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4944 | if (spec->board_config < 0) { |
| 4945 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 4946 | "using BIOS defaults\n"); |
| 4947 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4948 | } else |
| 4949 | err = stac_save_pin_cfgs(codec, |
| 4950 | stac922x_brd_tbl[spec->board_config]); |
| 4951 | if (err < 0) { |
| 4952 | stac92xx_free(codec); |
| 4953 | return err; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 4954 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4955 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4956 | spec->adc_nids = stac922x_adc_nids; |
| 4957 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 4958 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4959 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4960 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4961 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4962 | |
| 4963 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4964 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4965 | |
| 4966 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 4967 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 4968 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4969 | if (!err) { |
| 4970 | if (spec->board_config < 0) { |
| 4971 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4972 | "available, default to model=ref\n"); |
| 4973 | spec->board_config = STAC_D945_REF; |
| 4974 | goto again; |
| 4975 | } |
| 4976 | err = -EINVAL; |
| 4977 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 4978 | if (err < 0) { |
| 4979 | stac92xx_free(codec); |
| 4980 | return err; |
| 4981 | } |
| 4982 | |
| 4983 | codec->patch_ops = stac92xx_patch_ops; |
| 4984 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 4985 | /* Fix Mux capture level; max to 2 */ |
| 4986 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 4987 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 4988 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 4989 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 4990 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 4991 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 4992 | return 0; |
| 4993 | } |
| 4994 | |
| 4995 | static int patch_stac927x(struct hda_codec *codec) |
| 4996 | { |
| 4997 | struct sigmatel_spec *spec; |
| 4998 | int err; |
| 4999 | |
| 5000 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5001 | if (spec == NULL) |
| 5002 | return -ENOMEM; |
| 5003 | |
| 5004 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5005 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5006 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5007 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 5008 | stac927x_models, |
| 5009 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5010 | again: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5011 | if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { |
| 5012 | if (spec->board_config < 0) |
| 5013 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 5014 | "STAC927x, using BIOS defaults\n"); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5015 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5016 | } else |
| 5017 | err = stac_save_pin_cfgs(codec, |
| 5018 | stac927x_brd_tbl[spec->board_config]); |
| 5019 | if (err < 0) { |
| 5020 | stac92xx_free(codec); |
| 5021 | return err; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5022 | } |
| 5023 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5024 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5025 | spec->adc_nids = stac927x_adc_nids; |
| 5026 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 5027 | spec->mux_nids = stac927x_mux_nids; |
| 5028 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5029 | spec->smux_nids = stac927x_smux_nids; |
| 5030 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 5031 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 5032 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5033 | spec->multiout.dac_nids = spec->dac_nids; |
| 5034 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5035 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5036 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5037 | case STAC_D965_5ST: |
| 5038 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5039 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5040 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5041 | spec->num_dmics = 0; |
| 5042 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5043 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5044 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5045 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5046 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5047 | switch (codec->subsystem_id) { |
| 5048 | case 0x10280209: |
| 5049 | case 0x1028022e: |
| 5050 | /* correct the device field to SPDIF out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5051 | stac_change_pin_config(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5052 | break; |
| 5053 | }; |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 5054 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5055 | stac_change_pin_config(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 5056 | /* correct the front output jack as a hp out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5057 | stac_change_pin_config(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5058 | /* correct the front input jack as a mic */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5059 | stac_change_pin_config(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5060 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5061 | case STAC_DELL_3ST: |
| 5062 | /* GPIO2 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5063 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5064 | spec->gpio_data = 0x04; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5065 | spec->dmic_nids = stac927x_dmic_nids; |
| 5066 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 5067 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5068 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5069 | spec->mixer = stac927x_mixer; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5070 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5071 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5072 | break; |
| 5073 | default: |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5074 | if (spec->board_config > STAC_D965_REF) { |
| 5075 | /* GPIO0 High = Enable EAPD */ |
| 5076 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 5077 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 5078 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5079 | spec->num_dmics = 0; |
| 5080 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5081 | spec->init = stac927x_core_init; |
| 5082 | spec->mixer = stac927x_mixer; |
| 5083 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5084 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5085 | spec->num_pwrs = 0; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5086 | spec->aloopback_mask = 0x40; |
| 5087 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5088 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5089 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5090 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5091 | if (!err) { |
| 5092 | if (spec->board_config < 0) { |
| 5093 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5094 | "available, default to model=ref\n"); |
| 5095 | spec->board_config = STAC_D965_REF; |
| 5096 | goto again; |
| 5097 | } |
| 5098 | err = -EINVAL; |
| 5099 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5100 | if (err < 0) { |
| 5101 | stac92xx_free(codec); |
| 5102 | return err; |
| 5103 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5104 | |
| 5105 | codec->patch_ops = stac92xx_patch_ops; |
| 5106 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 5107 | /* |
| 5108 | * !!FIXME!! |
| 5109 | * The STAC927x seem to require fairly long delays for certain |
| 5110 | * command sequences. With too short delays (even if the answer |
| 5111 | * is set to RIRB properly), it results in the silence output |
| 5112 | * on some hardwares like Dell. |
| 5113 | * |
| 5114 | * The below flag enables the longer delay (see get_response |
| 5115 | * in hda_intel.c). |
| 5116 | */ |
| 5117 | codec->bus->needs_damn_long_delay = 1; |
| 5118 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5119 | return 0; |
| 5120 | } |
| 5121 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5122 | static int patch_stac9205(struct hda_codec *codec) |
| 5123 | { |
| 5124 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 5125 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5126 | |
| 5127 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5128 | if (spec == NULL) |
| 5129 | return -ENOMEM; |
| 5130 | |
| 5131 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5132 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5133 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5134 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 5135 | stac9205_models, |
| 5136 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5137 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5138 | if (spec->board_config < 0) { |
| 5139 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 5140 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5141 | } else |
| 5142 | err = stac_save_pin_cfgs(codec, |
| 5143 | stac9205_brd_tbl[spec->board_config]); |
| 5144 | if (err < 0) { |
| 5145 | stac92xx_free(codec); |
| 5146 | return err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5147 | } |
| 5148 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5149 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5150 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5151 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5152 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5153 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5154 | spec->smux_nids = stac9205_smux_nids; |
| 5155 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5156 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5157 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5158 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5159 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5160 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5161 | |
| 5162 | spec->init = stac9205_core_init; |
| 5163 | spec->mixer = stac9205_mixer; |
| 5164 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5165 | spec->aloopback_mask = 0x40; |
| 5166 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5167 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5168 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5169 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5170 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5171 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5172 | /* Enable SPDIF in/out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5173 | stac_change_pin_config(codec, 0x1f, 0x01441030); |
| 5174 | stac_change_pin_config(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 5175 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5176 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 5177 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); |
| 5178 | if (err < 0) |
| 5179 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5180 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5181 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
| 5182 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame^] | 5183 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 5184 | AC_USRSP_EN | err); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5185 | |
| 5186 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5187 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5188 | spec->gpio_mask = 0x1b; |
| 5189 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 5190 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5191 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5192 | */ |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5193 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5194 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5195 | case STAC_9205_REF: |
| 5196 | /* SPDIF-In enabled */ |
| 5197 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5198 | default: |
| 5199 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5200 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5201 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5202 | break; |
| 5203 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5204 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5205 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5206 | if (!err) { |
| 5207 | if (spec->board_config < 0) { |
| 5208 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5209 | "available, default to model=ref\n"); |
| 5210 | spec->board_config = STAC_9205_REF; |
| 5211 | goto again; |
| 5212 | } |
| 5213 | err = -EINVAL; |
| 5214 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5215 | if (err < 0) { |
| 5216 | stac92xx_free(codec); |
| 5217 | return err; |
| 5218 | } |
| 5219 | |
| 5220 | codec->patch_ops = stac92xx_patch_ops; |
| 5221 | |
| 5222 | return 0; |
| 5223 | } |
| 5224 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5225 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5226 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5227 | */ |
| 5228 | |
Guillaume Munch | 99ccc56 | 2006-08-16 19:35:12 +0200 | [diff] [blame] | 5229 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5230 | static hda_nid_t vaio_dacs[] = { 0x2 }; |
| 5231 | #define VAIO_HP_DAC 0x5 |
| 5232 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; |
| 5233 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; |
| 5234 | |
| 5235 | static struct hda_input_mux vaio_mux = { |
Takashi Iwai | a3a2f42 | 2007-10-11 11:21:21 +0200 | [diff] [blame] | 5236 | .num_items = 3, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5237 | .items = { |
Takashi Iwai | d773781 | 2006-04-25 13:05:43 +0200 | [diff] [blame] | 5238 | /* { "HP", 0x0 }, */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 5239 | { "Mic Jack", 0x1 }, |
| 5240 | { "Internal Mic", 0x2 }, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5241 | { "PCM", 0x3 }, |
| 5242 | } |
| 5243 | }; |
| 5244 | |
| 5245 | static struct hda_verb vaio_init[] = { |
| 5246 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 5247 | {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5248 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 5249 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 5250 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 5251 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 5252 | {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] | 5253 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 5254 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 5255 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 5256 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 5257 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 5258 | {} |
| 5259 | }; |
| 5260 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5261 | static struct hda_verb vaio_ar_init[] = { |
| 5262 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
| 5263 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
| 5264 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
| 5265 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
| 5266 | /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ |
| 5267 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 5268 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5269 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ |
| 5270 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ |
| 5271 | /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ |
| 5272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ |
| 5273 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ |
| 5274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 5275 | {} |
| 5276 | }; |
| 5277 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5278 | static struct snd_kcontrol_new vaio_mixer[] = { |
Takashi Iwai | 127e82e | 2008-11-14 14:03:33 +0100 | [diff] [blame] | 5279 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), |
| 5280 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), |
| 5281 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), |
| 5282 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5283 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 5284 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 5285 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 5286 | { |
| 5287 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5288 | .name = "Capture Source", |
| 5289 | .count = 1, |
| 5290 | .info = stac92xx_mux_enum_info, |
| 5291 | .get = stac92xx_mux_enum_get, |
| 5292 | .put = stac92xx_mux_enum_put, |
| 5293 | }, |
| 5294 | {} |
| 5295 | }; |
| 5296 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5297 | static struct snd_kcontrol_new vaio_ar_mixer[] = { |
Takashi Iwai | 127e82e | 2008-11-14 14:03:33 +0100 | [diff] [blame] | 5298 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), |
| 5299 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), |
| 5300 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), |
| 5301 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5302 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ |
| 5303 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 5304 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
| 5305 | /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), |
| 5306 | HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ |
| 5307 | { |
| 5308 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5309 | .name = "Capture Source", |
| 5310 | .count = 1, |
| 5311 | .info = stac92xx_mux_enum_info, |
| 5312 | .get = stac92xx_mux_enum_get, |
| 5313 | .put = stac92xx_mux_enum_put, |
| 5314 | }, |
| 5315 | {} |
| 5316 | }; |
| 5317 | |
| 5318 | static struct hda_codec_ops stac9872_patch_ops = { |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5319 | .build_controls = stac92xx_build_controls, |
| 5320 | .build_pcms = stac92xx_build_pcms, |
| 5321 | .init = stac92xx_init, |
| 5322 | .free = stac92xx_free, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5323 | #ifdef SND_HDA_NEEDS_RESUME |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5324 | .resume = stac92xx_resume, |
| 5325 | #endif |
| 5326 | }; |
| 5327 | |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 5328 | static int stac9872_vaio_init(struct hda_codec *codec) |
| 5329 | { |
| 5330 | int err; |
| 5331 | |
| 5332 | err = stac92xx_init(codec); |
| 5333 | if (err < 0) |
| 5334 | return err; |
| 5335 | if (codec->patch_ops.unsol_event) |
| 5336 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); |
| 5337 | return 0; |
| 5338 | } |
| 5339 | |
| 5340 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) |
| 5341 | { |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 5342 | if (get_hp_pin_presence(codec, 0x0a)) { |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 5343 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 5344 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 5345 | } else { |
| 5346 | stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
| 5347 | stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
| 5348 | } |
| 5349 | } |
| 5350 | |
| 5351 | static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5352 | { |
| 5353 | switch (res >> 26) { |
| 5354 | case STAC_HP_EVENT: |
| 5355 | stac9872_vaio_hp_detect(codec, res); |
| 5356 | break; |
| 5357 | } |
| 5358 | } |
| 5359 | |
| 5360 | static struct hda_codec_ops stac9872_vaio_patch_ops = { |
| 5361 | .build_controls = stac92xx_build_controls, |
| 5362 | .build_pcms = stac92xx_build_pcms, |
| 5363 | .init = stac9872_vaio_init, |
| 5364 | .free = stac92xx_free, |
| 5365 | .unsol_event = stac9872_vaio_unsol_event, |
| 5366 | #ifdef CONFIG_PM |
| 5367 | .resume = stac92xx_resume, |
| 5368 | #endif |
| 5369 | }; |
| 5370 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5371 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ |
| 5372 | CXD9872RD_VAIO, |
| 5373 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ |
| 5374 | STAC9872AK_VAIO, |
| 5375 | /* Unknown. id=0x83847661 and subsys=0x104D1200. */ |
| 5376 | STAC9872K_VAIO, |
| 5377 | /* AR Series. id=0x83847664 and subsys=104D1300 */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5378 | CXD9872AKD_VAIO, |
| 5379 | STAC_9872_MODELS, |
| 5380 | }; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5381 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5382 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 5383 | [CXD9872RD_VAIO] = "vaio", |
| 5384 | [CXD9872AKD_VAIO] = "vaio-ar", |
| 5385 | }; |
| 5386 | |
| 5387 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
| 5388 | SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 5389 | SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), |
| 5390 | SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), |
Tobin Davis | 68e2254 | 2007-03-12 11:36:39 +0100 | [diff] [blame] | 5391 | SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO), |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5392 | {} |
| 5393 | }; |
| 5394 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5395 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5396 | { |
| 5397 | struct sigmatel_spec *spec; |
| 5398 | int board_config; |
| 5399 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5400 | board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 5401 | stac9872_models, |
| 5402 | stac9872_cfg_tbl); |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5403 | if (board_config < 0) |
| 5404 | /* unknown config, let generic-parser do its job... */ |
| 5405 | return snd_hda_parse_generic_codec(codec); |
| 5406 | |
| 5407 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5408 | if (spec == NULL) |
| 5409 | return -ENOMEM; |
| 5410 | |
| 5411 | codec->spec = spec; |
| 5412 | switch (board_config) { |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5413 | case CXD9872RD_VAIO: |
| 5414 | case STAC9872AK_VAIO: |
| 5415 | case STAC9872K_VAIO: |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5416 | spec->mixer = vaio_mixer; |
| 5417 | spec->init = vaio_init; |
| 5418 | spec->multiout.max_channels = 2; |
| 5419 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 5420 | spec->multiout.dac_nids = vaio_dacs; |
| 5421 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 5422 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
| 5423 | spec->adc_nids = vaio_adcs; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5424 | spec->num_pwrs = 0; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5425 | spec->input_mux = &vaio_mux; |
| 5426 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 5427 | codec->patch_ops = stac9872_vaio_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5428 | break; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5429 | |
| 5430 | case CXD9872AKD_VAIO: |
| 5431 | spec->mixer = vaio_ar_mixer; |
| 5432 | spec->init = vaio_ar_init; |
| 5433 | spec->multiout.max_channels = 2; |
| 5434 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); |
| 5435 | spec->multiout.dac_nids = vaio_dacs; |
| 5436 | spec->multiout.hp_nid = VAIO_HP_DAC; |
| 5437 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5438 | spec->num_pwrs = 0; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5439 | spec->adc_nids = vaio_adcs; |
| 5440 | spec->input_mux = &vaio_mux; |
| 5441 | spec->mux_nids = vaio_mux_nids; |
Takashi Iwai | 72e7b0d | 2007-08-16 17:33:55 +0200 | [diff] [blame] | 5442 | codec->patch_ops = stac9872_patch_ops; |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5443 | break; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5444 | } |
| 5445 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5446 | return 0; |
| 5447 | } |
| 5448 | |
| 5449 | |
| 5450 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5451 | * patch entries |
| 5452 | */ |
| 5453 | struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
| 5454 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 5455 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 5456 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 5457 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 5458 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 5459 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 5460 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 5461 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 5462 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 5463 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 5464 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 5465 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 5466 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5467 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 5468 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 5469 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 5470 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 5471 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 5472 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 5473 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 5474 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 5475 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 5476 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5477 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 5478 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 5479 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 5480 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 5481 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 5482 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 5483 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 5484 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5485 | /* The following does not take into account .id=0x83847661 when subsys = |
| 5486 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 5487 | * currently not fully supported. |
| 5488 | */ |
| 5489 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 5490 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 5491 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5492 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 5493 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 5494 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 5495 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 5496 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 5497 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 5498 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 5499 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5500 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5501 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
| 5502 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5503 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5504 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 5505 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5506 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5507 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5508 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5509 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5510 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5511 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5512 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5513 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 5514 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5515 | {} /* terminator */ |
| 5516 | }; |