Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for SigmaTel STAC92xx |
| 5 | * |
| 6 | * Copyright (c) 2005 Embedded Alley Solutions, Inc. |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 7 | * Matt Porter <mporter@embeddedalley.com> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 8 | * |
| 9 | * Based on patch_cmedia.c and patch_realtek.c |
| 10 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
| 11 | * |
| 12 | * This driver is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This driver is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
| 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 25 | */ |
| 26 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 27 | #include <linux/init.h> |
| 28 | #include <linux/delay.h> |
| 29 | #include <linux/slab.h> |
| 30 | #include <linux/pci.h> |
| 31 | #include <sound/core.h> |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 32 | #include <sound/asoundef.h> |
Matthew Ranostay | 45a6ac1 | 2008-10-15 14:45:38 -0400 | [diff] [blame] | 33 | #include <sound/jack.h> |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 34 | #include "hda_codec.h" |
| 35 | #include "hda_local.h" |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 36 | #include "hda_beep.h" |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 37 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 38 | enum { |
| 39 | STAC_VREF_EVENT = 1, |
| 40 | STAC_INSERT_EVENT, |
| 41 | STAC_PWR_EVENT, |
| 42 | STAC_HP_EVENT, |
| 43 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 44 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 45 | enum { |
| 46 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 47 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 48 | STAC_9200_DELL_D21, |
| 49 | STAC_9200_DELL_D22, |
| 50 | STAC_9200_DELL_D23, |
| 51 | STAC_9200_DELL_M21, |
| 52 | STAC_9200_DELL_M22, |
| 53 | STAC_9200_DELL_M23, |
| 54 | STAC_9200_DELL_M24, |
| 55 | STAC_9200_DELL_M25, |
| 56 | STAC_9200_DELL_M26, |
| 57 | STAC_9200_DELL_M27, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 58 | STAC_9200_M4, |
| 59 | STAC_9200_M4_2, |
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 | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 69 | STAC_9205_EAPD, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 70 | STAC_9205_MODELS |
| 71 | }; |
| 72 | |
| 73 | enum { |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 74 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 75 | STAC_92HD73XX_REF, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 76 | STAC_DELL_M6_AMIC, |
| 77 | STAC_DELL_M6_DMIC, |
| 78 | STAC_DELL_M6_BOTH, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 79 | STAC_DELL_EQ, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 80 | STAC_92HD73XX_MODELS |
| 81 | }; |
| 82 | |
| 83 | enum { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 84 | STAC_92HD83XXX_REF, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 85 | STAC_92HD83XXX_PWR_REF, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 86 | STAC_92HD83XXX_MODELS |
| 87 | }; |
| 88 | |
| 89 | enum { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 90 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 91 | STAC_DELL_M4_1, |
| 92 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 93 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 94 | STAC_HP_M4, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 95 | STAC_HP_DV5, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 96 | STAC_92HD71BXX_MODELS |
| 97 | }; |
| 98 | |
| 99 | enum { |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 100 | STAC_925x_REF, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 101 | STAC_M1, |
| 102 | STAC_M1_2, |
| 103 | STAC_M2, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 104 | STAC_M2_2, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 105 | STAC_M3, |
| 106 | STAC_M5, |
| 107 | STAC_M6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 108 | STAC_925x_MODELS |
| 109 | }; |
| 110 | |
| 111 | enum { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 112 | STAC_D945_REF, |
| 113 | STAC_D945GTP3, |
| 114 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 115 | STAC_INTEL_MAC_V1, |
| 116 | STAC_INTEL_MAC_V2, |
| 117 | STAC_INTEL_MAC_V3, |
| 118 | STAC_INTEL_MAC_V4, |
| 119 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 120 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 121 | * is given, one of the above models will be |
| 122 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 123 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 124 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 125 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 126 | STAC_MACBOOK_PRO_V1, |
| 127 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 128 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 129 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 130 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 131 | STAC_922X_DELL_D81, |
| 132 | STAC_922X_DELL_D82, |
| 133 | STAC_922X_DELL_M81, |
| 134 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 135 | STAC_922X_MODELS |
| 136 | }; |
| 137 | |
| 138 | enum { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 139 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 140 | STAC_D965_REF, |
| 141 | STAC_D965_3ST, |
| 142 | STAC_D965_5ST, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 143 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 144 | STAC_DELL_BIOS, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 145 | STAC_927X_MODELS |
| 146 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 147 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 148 | struct sigmatel_event { |
| 149 | hda_nid_t nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 150 | unsigned char type; |
| 151 | unsigned char tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 152 | int data; |
| 153 | }; |
| 154 | |
| 155 | struct sigmatel_jack { |
| 156 | hda_nid_t nid; |
| 157 | int type; |
| 158 | struct snd_jack *jack; |
| 159 | }; |
| 160 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 161 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 162 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 163 | unsigned int num_mixers; |
| 164 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 165 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 166 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 167 | unsigned int surr_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 168 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 169 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 170 | unsigned int spdif_mute: 1; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 171 | unsigned int check_volume_offset:1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 172 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 173 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 174 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 175 | unsigned int gpio_mask; |
| 176 | unsigned int gpio_dir; |
| 177 | unsigned int gpio_data; |
| 178 | unsigned int gpio_mute; |
| 179 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 180 | /* stream */ |
| 181 | unsigned int stream_delay; |
| 182 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 183 | /* analog loopback */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 184 | unsigned char aloopback_mask; |
| 185 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 186 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 187 | /* power management */ |
| 188 | unsigned int num_pwrs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 189 | unsigned int *pwr_mapping; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 190 | hda_nid_t *pwr_nids; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 191 | hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 192 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 193 | /* jack detection */ |
| 194 | struct snd_array jacks; |
| 195 | |
| 196 | /* events */ |
| 197 | struct snd_array events; |
| 198 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 199 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 200 | struct hda_input_mux *mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 201 | struct hda_input_mux *amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 202 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 203 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 204 | hda_nid_t dac_nids[5]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 205 | hda_nid_t hp_dacs[5]; |
| 206 | hda_nid_t speaker_dacs[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 207 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 208 | int volume_offset; |
| 209 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 210 | /* capture */ |
| 211 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 212 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 213 | hda_nid_t *mux_nids; |
| 214 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 215 | hda_nid_t *dmic_nids; |
| 216 | unsigned int num_dmics; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 217 | hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 218 | unsigned int num_dmuxes; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 219 | hda_nid_t *smux_nids; |
| 220 | unsigned int num_smuxes; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 221 | const char **spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 222 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 223 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 224 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 225 | hda_nid_t anabeep_nid; |
| 226 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 227 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 228 | /* pin widgets */ |
| 229 | hda_nid_t *pin_nids; |
| 230 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 231 | unsigned int *pin_configs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 232 | |
| 233 | /* codec specific stuff */ |
| 234 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 235 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 236 | |
| 237 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 238 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 239 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 240 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 241 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 242 | struct hda_input_mux *sinput_mux; |
| 243 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 244 | unsigned int cur_amux; |
| 245 | hda_nid_t *amp_nids; |
| 246 | unsigned int num_amps; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 247 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 248 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 249 | /* i/o switches */ |
| 250 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 251 | unsigned int clfe_swap; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 252 | hda_nid_t line_switch; /* shared line-in for input and output */ |
| 253 | hda_nid_t mic_switch; /* shared mic-in for input and output */ |
| 254 | hda_nid_t hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 255 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 256 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 257 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 258 | |
| 259 | /* dynamic controls and input_mux */ |
| 260 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 261 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 262 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 263 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 264 | struct hda_input_mux private_smux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 265 | struct hda_input_mux private_amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 266 | struct hda_input_mux private_mono_mux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 267 | }; |
| 268 | |
| 269 | static hda_nid_t stac9200_adc_nids[1] = { |
| 270 | 0x03, |
| 271 | }; |
| 272 | |
| 273 | static hda_nid_t stac9200_mux_nids[1] = { |
| 274 | 0x0c, |
| 275 | }; |
| 276 | |
| 277 | static hda_nid_t stac9200_dac_nids[1] = { |
| 278 | 0x02, |
| 279 | }; |
| 280 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 281 | static hda_nid_t stac92hd73xx_pwr_nids[8] = { |
| 282 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 283 | 0x0f, 0x10, 0x11 |
| 284 | }; |
| 285 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 286 | static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
| 287 | 0x26, 0, |
| 288 | }; |
| 289 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 290 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
| 291 | 0x1a, 0x1b |
| 292 | }; |
| 293 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 294 | #define DELL_M6_AMP 2 |
| 295 | static hda_nid_t stac92hd73xx_amp_nids[3] = { |
| 296 | 0x0b, 0x0c, 0x0e |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 297 | }; |
| 298 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 299 | #define STAC92HD73XX_NUM_DMICS 2 |
| 300 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
| 301 | 0x13, 0x14, 0 |
| 302 | }; |
| 303 | |
| 304 | #define STAC92HD73_DAC_COUNT 5 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 305 | |
| 306 | static hda_nid_t stac92hd73xx_mux_nids[4] = { |
| 307 | 0x28, 0x29, 0x2a, 0x2b, |
| 308 | }; |
| 309 | |
| 310 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
| 311 | 0x20, 0x21, |
| 312 | }; |
| 313 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 314 | static hda_nid_t stac92hd73xx_smux_nids[2] = { |
| 315 | 0x22, 0x23, |
| 316 | }; |
| 317 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 318 | #define STAC92HD83XXX_NUM_DMICS 2 |
| 319 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { |
| 320 | 0x11, 0x12, 0 |
| 321 | }; |
| 322 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 323 | #define STAC92HD83_DAC_COUNT 3 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 324 | |
| 325 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { |
| 326 | 0x17, 0x18, |
| 327 | }; |
| 328 | |
| 329 | static hda_nid_t stac92hd83xxx_adc_nids[2] = { |
| 330 | 0x15, 0x16, |
| 331 | }; |
| 332 | |
| 333 | static hda_nid_t stac92hd83xxx_pwr_nids[4] = { |
| 334 | 0xa, 0xb, 0xd, 0xe, |
| 335 | }; |
| 336 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 337 | static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
| 338 | 0x1e, 0, |
| 339 | }; |
| 340 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 341 | static unsigned int stac92hd83xxx_pwr_mapping[4] = { |
Matthew Ranostay | 87e88a7 | 2009-01-22 20:38:42 -0500 | [diff] [blame] | 342 | 0x03, 0x0c, 0x20, 0x40, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 343 | }; |
| 344 | |
Takashi Iwai | 9248f26 | 2009-01-14 09:40:25 +0100 | [diff] [blame] | 345 | static hda_nid_t stac92hd83xxx_amp_nids[1] = { |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 346 | 0xc, |
| 347 | }; |
| 348 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 349 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
| 350 | 0x0a, 0x0d, 0x0f |
| 351 | }; |
| 352 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 353 | static hda_nid_t stac92hd71bxx_adc_nids[2] = { |
| 354 | 0x12, 0x13, |
| 355 | }; |
| 356 | |
| 357 | static hda_nid_t stac92hd71bxx_mux_nids[2] = { |
| 358 | 0x1a, 0x1b |
| 359 | }; |
| 360 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 361 | static hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
| 362 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 363 | }; |
| 364 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 365 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { |
| 366 | 0x24, 0x25, |
| 367 | }; |
| 368 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 369 | #define STAC92HD71BXX_NUM_DMICS 2 |
| 370 | static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
| 371 | 0x18, 0x19, 0 |
| 372 | }; |
| 373 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 374 | static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
| 375 | 0x22, 0 |
| 376 | }; |
| 377 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 378 | static hda_nid_t stac925x_adc_nids[1] = { |
| 379 | 0x03, |
| 380 | }; |
| 381 | |
| 382 | static hda_nid_t stac925x_mux_nids[1] = { |
| 383 | 0x0f, |
| 384 | }; |
| 385 | |
| 386 | static hda_nid_t stac925x_dac_nids[1] = { |
| 387 | 0x02, |
| 388 | }; |
| 389 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 390 | #define STAC925X_NUM_DMICS 1 |
| 391 | static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
| 392 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 393 | }; |
| 394 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 395 | static hda_nid_t stac925x_dmux_nids[1] = { |
| 396 | 0x14, |
| 397 | }; |
| 398 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 399 | static hda_nid_t stac922x_adc_nids[2] = { |
| 400 | 0x06, 0x07, |
| 401 | }; |
| 402 | |
| 403 | static hda_nid_t stac922x_mux_nids[2] = { |
| 404 | 0x12, 0x13, |
| 405 | }; |
| 406 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 407 | static hda_nid_t stac927x_adc_nids[3] = { |
| 408 | 0x07, 0x08, 0x09 |
| 409 | }; |
| 410 | |
| 411 | static hda_nid_t stac927x_mux_nids[3] = { |
| 412 | 0x15, 0x16, 0x17 |
| 413 | }; |
| 414 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 415 | static hda_nid_t stac927x_smux_nids[1] = { |
| 416 | 0x21, |
| 417 | }; |
| 418 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 419 | static hda_nid_t stac927x_dac_nids[6] = { |
| 420 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 421 | }; |
| 422 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 423 | static hda_nid_t stac927x_dmux_nids[1] = { |
| 424 | 0x1b, |
| 425 | }; |
| 426 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 427 | #define STAC927X_NUM_DMICS 2 |
| 428 | static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
| 429 | 0x13, 0x14, 0 |
| 430 | }; |
| 431 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 432 | static const char *stac927x_spdif_labels[5] = { |
| 433 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 434 | "Analog Mux 2", "Analog Mux 3" |
| 435 | }; |
| 436 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 437 | static hda_nid_t stac9205_adc_nids[2] = { |
| 438 | 0x12, 0x13 |
| 439 | }; |
| 440 | |
| 441 | static hda_nid_t stac9205_mux_nids[2] = { |
| 442 | 0x19, 0x1a |
| 443 | }; |
| 444 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 445 | static hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 446 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 447 | }; |
| 448 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 449 | static hda_nid_t stac9205_smux_nids[1] = { |
| 450 | 0x21, |
| 451 | }; |
| 452 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 453 | #define STAC9205_NUM_DMICS 2 |
| 454 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
| 455 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 456 | }; |
| 457 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 458 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 459 | 0x08, 0x09, 0x0d, 0x0e, |
| 460 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 461 | }; |
| 462 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 463 | static hda_nid_t stac925x_pin_nids[8] = { |
| 464 | 0x07, 0x08, 0x0a, 0x0b, |
| 465 | 0x0c, 0x0d, 0x10, 0x11, |
| 466 | }; |
| 467 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 468 | static hda_nid_t stac922x_pin_nids[10] = { |
| 469 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 470 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 471 | }; |
| 472 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 473 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 474 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 475 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 476 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 477 | }; |
| 478 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 479 | static hda_nid_t stac92hd83xxx_pin_nids[14] = { |
| 480 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 481 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 482 | 0x1d, 0x1e, 0x1f, 0x20 |
| 483 | }; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 484 | |
| 485 | #define STAC92HD71BXX_NUM_PINS 13 |
| 486 | static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { |
| 487 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, |
| 488 | 0x00, 0x14, 0x18, 0x19, 0x1e, |
| 489 | 0x1f, 0x20, 0x27 |
| 490 | }; |
| 491 | static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 492 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 493 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 494 | 0x1f, 0x20, 0x27 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 495 | }; |
| 496 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 497 | static hda_nid_t stac927x_pin_nids[14] = { |
| 498 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 499 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 500 | 0x14, 0x21, 0x22, 0x23, |
| 501 | }; |
| 502 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 503 | static hda_nid_t stac9205_pin_nids[12] = { |
| 504 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 505 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 506 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 507 | }; |
| 508 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 509 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info |
| 510 | |
| 511 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, |
| 512 | struct snd_ctl_elem_value *ucontrol) |
| 513 | { |
| 514 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 515 | struct sigmatel_spec *spec = codec->spec; |
| 516 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 517 | |
| 518 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 519 | kcontrol->private_value |= nid; |
| 520 | |
| 521 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); |
| 522 | } |
| 523 | |
| 524 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, |
| 525 | struct snd_ctl_elem_value *ucontrol) |
| 526 | { |
| 527 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 528 | struct sigmatel_spec *spec = codec->spec; |
| 529 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 530 | |
| 531 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 532 | kcontrol->private_value |= nid; |
| 533 | |
| 534 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); |
| 535 | } |
| 536 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 537 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 538 | struct snd_ctl_elem_info *uinfo) |
| 539 | { |
| 540 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 541 | struct sigmatel_spec *spec = codec->spec; |
| 542 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 543 | } |
| 544 | |
| 545 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 546 | struct snd_ctl_elem_value *ucontrol) |
| 547 | { |
| 548 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 549 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 550 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 551 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 552 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 553 | return 0; |
| 554 | } |
| 555 | |
| 556 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
| 558 | { |
| 559 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 560 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 561 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 562 | |
| 563 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 564 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 565 | } |
| 566 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 567 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 568 | struct snd_ctl_elem_info *uinfo) |
| 569 | { |
| 570 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 571 | struct sigmatel_spec *spec = codec->spec; |
| 572 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 573 | } |
| 574 | |
| 575 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 576 | struct snd_ctl_elem_value *ucontrol) |
| 577 | { |
| 578 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 579 | struct sigmatel_spec *spec = codec->spec; |
| 580 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 581 | |
| 582 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 583 | return 0; |
| 584 | } |
| 585 | |
| 586 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 587 | struct snd_ctl_elem_value *ucontrol) |
| 588 | { |
| 589 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 590 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 591 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 592 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 593 | int err, val; |
| 594 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 595 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 596 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 597 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 598 | if (err < 0) |
| 599 | return err; |
| 600 | |
| 601 | if (spec->spdif_mute) { |
| 602 | if (smux_idx == 0) |
| 603 | nid = spec->multiout.dig_out_nid; |
| 604 | else |
| 605 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 606 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 607 | val = HDA_AMP_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 608 | else |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 609 | val = 0; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 610 | /* un/mute SPDIF out */ |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 611 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 612 | HDA_AMP_MUTE, val); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 613 | } |
| 614 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 615 | } |
| 616 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 617 | 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] | 618 | { |
| 619 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 620 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 621 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 622 | } |
| 623 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 624 | 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] | 625 | { |
| 626 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 627 | struct sigmatel_spec *spec = codec->spec; |
| 628 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 629 | |
| 630 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 631 | return 0; |
| 632 | } |
| 633 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 634 | 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] | 635 | { |
| 636 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 637 | struct sigmatel_spec *spec = codec->spec; |
| 638 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 639 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 640 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 641 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 642 | } |
| 643 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 644 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 645 | struct snd_ctl_elem_info *uinfo) |
| 646 | { |
| 647 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 648 | struct sigmatel_spec *spec = codec->spec; |
| 649 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 650 | } |
| 651 | |
| 652 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 653 | struct snd_ctl_elem_value *ucontrol) |
| 654 | { |
| 655 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 656 | struct sigmatel_spec *spec = codec->spec; |
| 657 | |
| 658 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 659 | return 0; |
| 660 | } |
| 661 | |
| 662 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
| 664 | { |
| 665 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 666 | struct sigmatel_spec *spec = codec->spec; |
| 667 | |
| 668 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 669 | spec->mono_nid, &spec->cur_mmux); |
| 670 | } |
| 671 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 672 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 673 | struct snd_ctl_elem_info *uinfo) |
| 674 | { |
| 675 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 676 | struct sigmatel_spec *spec = codec->spec; |
| 677 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); |
| 678 | } |
| 679 | |
| 680 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 681 | struct snd_ctl_elem_value *ucontrol) |
| 682 | { |
| 683 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 684 | struct sigmatel_spec *spec = codec->spec; |
| 685 | |
| 686 | ucontrol->value.enumerated.item[0] = spec->cur_amux; |
| 687 | return 0; |
| 688 | } |
| 689 | |
| 690 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 691 | struct snd_ctl_elem_value *ucontrol) |
| 692 | { |
| 693 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 694 | struct sigmatel_spec *spec = codec->spec; |
| 695 | struct snd_kcontrol *ctl = |
| 696 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); |
| 697 | if (!ctl) |
| 698 | return -EINVAL; |
| 699 | |
| 700 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | |
| 701 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
| 702 | |
| 703 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, |
| 704 | 0, &spec->cur_amux); |
| 705 | } |
| 706 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 707 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 708 | |
| 709 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 710 | struct snd_ctl_elem_value *ucontrol) |
| 711 | { |
| 712 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 713 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 714 | struct sigmatel_spec *spec = codec->spec; |
| 715 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 716 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 717 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 718 | return 0; |
| 719 | } |
| 720 | |
| 721 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 722 | struct snd_ctl_elem_value *ucontrol) |
| 723 | { |
| 724 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 725 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 726 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 727 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 728 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 729 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 730 | idx_val = spec->aloopback_mask << idx; |
| 731 | if (ucontrol->value.integer.value[0]) |
| 732 | val = spec->aloopback | idx_val; |
| 733 | else |
| 734 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 735 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 736 | return 0; |
| 737 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 738 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 739 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 740 | /* Only return the bits defined by the shift value of the |
| 741 | * first two bytes of the mask |
| 742 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 743 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 744 | kcontrol->private_value & 0xFFFF, 0x0); |
| 745 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 746 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 747 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 748 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 749 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 750 | } else { |
| 751 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 752 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 756 | kcontrol->private_value >> 16, dac_mode); |
| 757 | |
| 758 | return 1; |
| 759 | } |
| 760 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 761 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 762 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 763 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 764 | {} |
| 765 | }; |
| 766 | |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 767 | static struct hda_verb stac9200_eapd_init[] = { |
| 768 | /* set dac0mux for dac converter */ |
| 769 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 770 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 771 | {} |
| 772 | }; |
| 773 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 774 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { |
| 775 | /* set master volume and direct control */ |
| 776 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 777 | /* setup adcs to point to mixer */ |
| 778 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 779 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 780 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 781 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 782 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 783 | /* setup import muxs */ |
| 784 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 785 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 786 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 787 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 788 | {} |
| 789 | }; |
| 790 | |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 791 | static struct hda_verb dell_eq_core_init[] = { |
| 792 | /* set master volume to max value without distortion |
| 793 | * and direct control */ |
| 794 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 795 | /* setup adcs to point to mixer */ |
| 796 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 797 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 798 | /* setup import muxs */ |
| 799 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 800 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 801 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 802 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 803 | {} |
| 804 | }; |
| 805 | |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 806 | static struct hda_verb dell_m6_core_init[] = { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 807 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 808 | /* setup adcs to point to mixer */ |
| 809 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 810 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 811 | /* setup import muxs */ |
| 812 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 813 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 814 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 815 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 816 | {} |
| 817 | }; |
| 818 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 819 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
| 820 | /* set master volume and direct control */ |
| 821 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 822 | /* setup adcs to point to mixer */ |
| 823 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 824 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 825 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 826 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 827 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 828 | /* setup import muxs */ |
| 829 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 830 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 831 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 832 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 833 | {} |
| 834 | }; |
| 835 | |
| 836 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { |
| 837 | /* set master volume and direct control */ |
| 838 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 839 | /* dac3 is connected to import3 mux */ |
| 840 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 841 | /* setup adcs to point to mixer */ |
| 842 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 843 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 844 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 845 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 846 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 847 | /* setup import muxs */ |
| 848 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 849 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 850 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 851 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 852 | {} |
| 853 | }; |
| 854 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 855 | static struct hda_verb stac92hd83xxx_core_init[] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 856 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 857 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 858 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 859 | |
| 860 | /* power state controls amps */ |
| 861 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 862 | {} |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 863 | }; |
| 864 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 865 | static struct hda_verb stac92hd71bxx_core_init[] = { |
| 866 | /* set master volume and direct control */ |
| 867 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 868 | {} |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 869 | }; |
| 870 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 871 | #define HD_DISABLE_PORTF 1 |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 872 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 873 | /* start of config #1 */ |
| 874 | |
| 875 | /* connect port 0f to audio mixer */ |
| 876 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 877 | /* start of config #2 */ |
| 878 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 879 | /* set master volume and direct control */ |
| 880 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 881 | {} |
| 882 | }; |
| 883 | |
| 884 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
| 885 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
| 886 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 887 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 888 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 889 | {} |
| 890 | }; |
| 891 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 892 | static struct hda_verb stac925x_core_init[] = { |
| 893 | /* set dac0mux for dac converter */ |
| 894 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 895 | /* mute the master volume */ |
| 896 | { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 897 | {} |
| 898 | }; |
| 899 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 900 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 901 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 902 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 903 | {} |
| 904 | }; |
| 905 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 906 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 907 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 908 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 909 | /* unmute node 0x1b */ |
| 910 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 911 | /* select node 0x03 as DAC */ |
| 912 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 913 | {} |
| 914 | }; |
| 915 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 916 | static struct hda_verb stac927x_core_init[] = { |
| 917 | /* set master volume and direct control */ |
| 918 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 919 | /* enable analog pc beep path */ |
| 920 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 921 | {} |
| 922 | }; |
| 923 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 924 | static struct hda_verb stac9205_core_init[] = { |
| 925 | /* set master volume and direct control */ |
| 926 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 927 | /* enable analog pc beep path */ |
| 928 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 929 | {} |
| 930 | }; |
| 931 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 932 | #define STAC_MONO_MUX \ |
| 933 | { \ |
| 934 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 935 | .name = "Mono Mux", \ |
| 936 | .count = 1, \ |
| 937 | .info = stac92xx_mono_mux_enum_info, \ |
| 938 | .get = stac92xx_mono_mux_enum_get, \ |
| 939 | .put = stac92xx_mono_mux_enum_put, \ |
| 940 | } |
| 941 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 942 | #define STAC_AMP_MUX \ |
| 943 | { \ |
| 944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 945 | .name = "Amp Selector Capture Switch", \ |
| 946 | .count = 1, \ |
| 947 | .info = stac92xx_amp_mux_enum_info, \ |
| 948 | .get = stac92xx_amp_mux_enum_get, \ |
| 949 | .put = stac92xx_amp_mux_enum_put, \ |
| 950 | } |
| 951 | |
| 952 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ |
| 953 | { \ |
| 954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 955 | .name = xname, \ |
| 956 | .index = 0, \ |
| 957 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 958 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 959 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
| 960 | .info = stac92xx_amp_volume_info, \ |
| 961 | .get = stac92xx_amp_volume_get, \ |
| 962 | .put = stac92xx_amp_volume_put, \ |
| 963 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ |
| 964 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ |
| 965 | } |
| 966 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 967 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 968 | { \ |
| 969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 970 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 971 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 972 | .info = stac92xx_aloopback_info, \ |
| 973 | .get = stac92xx_aloopback_get, \ |
| 974 | .put = stac92xx_aloopback_put, \ |
| 975 | .private_value = verb_read | (verb_write << 16), \ |
| 976 | } |
| 977 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 978 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 979 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 980 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 981 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 982 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 983 | { } /* end */ |
| 984 | }; |
| 985 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 986 | #define DELL_M6_MIXER 6 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 987 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 988 | /* start of config #1 */ |
| 989 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 990 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 991 | |
| 992 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 993 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 994 | |
| 995 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 996 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 997 | |
| 998 | /* start of config #2 */ |
| 999 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1000 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1001 | |
| 1002 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1003 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1004 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1005 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1006 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1007 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1008 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1009 | |
| 1010 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1011 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1012 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1013 | { } /* end */ |
| 1014 | }; |
| 1015 | |
| 1016 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1017 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1018 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1019 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1020 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
| 1021 | |
| 1022 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1023 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), |
| 1024 | |
| 1025 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1026 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1027 | |
| 1028 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1029 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1030 | |
| 1031 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1032 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1033 | |
| 1034 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1035 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1036 | |
| 1037 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1038 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1039 | { } /* end */ |
| 1040 | }; |
| 1041 | |
| 1042 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1043 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 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 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1068 | |
| 1069 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { |
| 1070 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1071 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), |
| 1072 | |
| 1073 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1074 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), |
| 1075 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1076 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), |
| 1077 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1078 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1079 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1081 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1082 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT), |
| 1083 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1084 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1085 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT), |
| 1086 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1087 | |
| 1088 | /* |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1089 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT), |
| 1090 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1091 | */ |
| 1092 | { } /* end */ |
| 1093 | }; |
| 1094 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1095 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1096 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1097 | |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 1098 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 1099 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 9b35947 | 2007-11-07 13:03:12 +0100 | [diff] [blame] | 1100 | |
| 1101 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 1102 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 1103 | /* analog pc-beep replaced with digital beep support */ |
| 1104 | /* |
Matthew Ranostay | f7c5dda | 2008-07-10 17:49:11 +0200 | [diff] [blame] | 1105 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), |
| 1106 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 1107 | */ |
Matthew Ranostay | f7c5dda | 2008-07-10 17:49:11 +0200 | [diff] [blame] | 1108 | |
Matthew Ranostay | 687cb98 | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1109 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), |
| 1110 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1111 | |
Matthew Ranostay | 687cb98 | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1112 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), |
| 1113 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1114 | |
| 1115 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), |
| 1116 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), |
| 1117 | |
| 1118 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), |
| 1119 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1120 | { } /* end */ |
| 1121 | }; |
| 1122 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1123 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1124 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), |
| 1125 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1126 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
| 1127 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1128 | |
| 1129 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
| 1130 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1131 | { } /* end */ |
| 1132 | }; |
| 1133 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1134 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 1135 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), |
| 1136 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1137 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
Mauro Carvalho Chehab | 587755f | 2008-05-25 18:20:06 +0200 | [diff] [blame] | 1138 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1139 | { } /* end */ |
| 1140 | }; |
| 1141 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 1142 | static struct snd_kcontrol_new stac9205_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1143 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1144 | |
| 1145 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
| 1146 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1147 | |
| 1148 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
| 1149 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1150 | { } /* end */ |
| 1151 | }; |
| 1152 | |
| 1153 | /* This needs to be generated dynamically based on sequence */ |
| 1154 | static struct snd_kcontrol_new stac922x_mixer[] = { |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1155 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
| 1156 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1157 | |
| 1158 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
| 1159 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1160 | { } /* end */ |
| 1161 | }; |
| 1162 | |
| 1163 | |
| 1164 | static struct snd_kcontrol_new stac927x_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1165 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1166 | |
| 1167 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
| 1168 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1169 | |
| 1170 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
| 1171 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1172 | |
| 1173 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1175 | { } /* end */ |
| 1176 | }; |
| 1177 | |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1178 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1179 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1180 | .name = "Digital Input Source", |
| 1181 | /* count set later */ |
| 1182 | .info = stac92xx_dmux_enum_info, |
| 1183 | .get = stac92xx_dmux_enum_get, |
| 1184 | .put = stac92xx_dmux_enum_put, |
| 1185 | }; |
| 1186 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1187 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1188 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1189 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1190 | /* count set later */ |
| 1191 | .info = stac92xx_smux_enum_info, |
| 1192 | .get = stac92xx_smux_enum_get, |
| 1193 | .put = stac92xx_smux_enum_put, |
| 1194 | }; |
| 1195 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1196 | static const char *slave_vols[] = { |
| 1197 | "Front Playback Volume", |
| 1198 | "Surround Playback Volume", |
| 1199 | "Center Playback Volume", |
| 1200 | "LFE Playback Volume", |
| 1201 | "Side Playback Volume", |
| 1202 | "Headphone Playback Volume", |
| 1203 | "Headphone Playback Volume", |
| 1204 | "Speaker Playback Volume", |
| 1205 | "External Speaker Playback Volume", |
| 1206 | "Speaker2 Playback Volume", |
| 1207 | NULL |
| 1208 | }; |
| 1209 | |
| 1210 | static const char *slave_sws[] = { |
| 1211 | "Front Playback Switch", |
| 1212 | "Surround Playback Switch", |
| 1213 | "Center Playback Switch", |
| 1214 | "LFE Playback Switch", |
| 1215 | "Side Playback Switch", |
| 1216 | "Headphone Playback Switch", |
| 1217 | "Headphone Playback Switch", |
| 1218 | "Speaker Playback Switch", |
| 1219 | "External Speaker Playback Switch", |
| 1220 | "Speaker2 Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1221 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1222 | NULL |
| 1223 | }; |
| 1224 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1225 | static void stac92xx_free_kctls(struct hda_codec *codec); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1226 | 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] | 1227 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1228 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1229 | { |
| 1230 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1231 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1232 | hda_nid_t nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1233 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1234 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1235 | |
| 1236 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1237 | if (err < 0) |
| 1238 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1239 | |
| 1240 | for (i = 0; i < spec->num_mixers; i++) { |
| 1241 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1242 | if (err < 0) |
| 1243 | return err; |
| 1244 | } |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1245 | if (spec->num_dmuxes > 0) { |
| 1246 | stac_dmux_mixer.count = spec->num_dmuxes; |
Takashi Iwai | d13bd41 | 2008-07-30 15:01:45 +0200 | [diff] [blame] | 1247 | err = snd_hda_ctl_add(codec, |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1248 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1249 | if (err < 0) |
| 1250 | return err; |
| 1251 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1252 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1253 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1254 | struct hda_input_mux *smux = &spec->private_smux; |
| 1255 | /* check for mute support on SPDIF out */ |
| 1256 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 1257 | smux->items[smux->num_items].label = "Off"; |
| 1258 | smux->items[smux->num_items].index = 0; |
| 1259 | smux->num_items++; |
| 1260 | spec->spdif_mute = 1; |
| 1261 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1262 | stac_smux_mixer.count = spec->num_smuxes; |
Takashi Iwai | 4f2d23e | 2008-12-19 10:14:13 +0100 | [diff] [blame] | 1263 | err = snd_hda_ctl_add(codec, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1264 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1265 | if (err < 0) |
| 1266 | return err; |
| 1267 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1268 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1269 | if (spec->multiout.dig_out_nid) { |
| 1270 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 1271 | if (err < 0) |
| 1272 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1273 | err = snd_hda_create_spdif_share_sw(codec, |
| 1274 | &spec->multiout); |
| 1275 | if (err < 0) |
| 1276 | return err; |
| 1277 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1278 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1279 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1280 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1281 | if (err < 0) |
| 1282 | return err; |
| 1283 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1284 | |
| 1285 | /* if we have no master control, let's create it */ |
| 1286 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1287 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1288 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1289 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 1290 | /* correct volume offset */ |
| 1291 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1292 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1293 | vmaster_tlv, slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1294 | if (err < 0) |
| 1295 | return err; |
| 1296 | } |
| 1297 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1298 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1299 | NULL, slave_sws); |
| 1300 | if (err < 0) |
| 1301 | return err; |
| 1302 | } |
| 1303 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1304 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1305 | |
| 1306 | /* create jack input elements */ |
| 1307 | if (spec->hp_detect) { |
| 1308 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1309 | int type = SND_JACK_HEADPHONE; |
| 1310 | nid = cfg->hp_pins[i]; |
| 1311 | /* jack detection */ |
| 1312 | if (cfg->hp_outs == i) |
| 1313 | type |= SND_JACK_LINEOUT; |
| 1314 | err = stac92xx_add_jack(codec, nid, type); |
| 1315 | if (err < 0) |
| 1316 | return err; |
| 1317 | } |
| 1318 | } |
| 1319 | for (i = 0; i < cfg->line_outs; i++) { |
| 1320 | err = stac92xx_add_jack(codec, cfg->line_out_pins[i], |
| 1321 | SND_JACK_LINEOUT); |
| 1322 | if (err < 0) |
| 1323 | return err; |
| 1324 | } |
| 1325 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 1326 | nid = cfg->input_pins[i]; |
| 1327 | if (nid) { |
| 1328 | err = stac92xx_add_jack(codec, nid, |
| 1329 | SND_JACK_MICROPHONE); |
| 1330 | if (err < 0) |
| 1331 | return err; |
| 1332 | } |
| 1333 | } |
| 1334 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1335 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1336 | } |
| 1337 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1338 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1339 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1340 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1341 | }; |
| 1342 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1343 | static unsigned int gateway9200_m4_pin_configs[8] = { |
| 1344 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1345 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1346 | }; |
| 1347 | static unsigned int gateway9200_m4_2_pin_configs[8] = { |
| 1348 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1349 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1350 | }; |
| 1351 | |
| 1352 | /* |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1353 | STAC 9200 pin configs for |
| 1354 | 102801A8 |
| 1355 | 102801DE |
| 1356 | 102801E8 |
| 1357 | */ |
| 1358 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1359 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1360 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1361 | }; |
| 1362 | |
| 1363 | /* |
| 1364 | STAC 9200 pin configs for |
| 1365 | 102801C0 |
| 1366 | 102801C1 |
| 1367 | */ |
| 1368 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1369 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1370 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1371 | }; |
| 1372 | |
| 1373 | /* |
| 1374 | STAC 9200 pin configs for |
| 1375 | 102801C4 (Dell Dimension E310) |
| 1376 | 102801C5 |
| 1377 | 102801C7 |
| 1378 | 102801D9 |
| 1379 | 102801DA |
| 1380 | 102801E3 |
| 1381 | */ |
| 1382 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1383 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1384 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1385 | }; |
| 1386 | |
| 1387 | |
| 1388 | /* |
| 1389 | STAC 9200-32 pin configs for |
| 1390 | 102801B5 (Dell Inspiron 630m) |
| 1391 | 102801D8 (Dell Inspiron 640m) |
| 1392 | */ |
| 1393 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1394 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1395 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1396 | }; |
| 1397 | |
| 1398 | /* |
| 1399 | STAC 9200-32 pin configs for |
| 1400 | 102801C2 (Dell Latitude D620) |
| 1401 | 102801C8 |
| 1402 | 102801CC (Dell Latitude D820) |
| 1403 | 102801D4 |
| 1404 | 102801D6 |
| 1405 | */ |
| 1406 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1407 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1408 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1409 | }; |
| 1410 | |
| 1411 | /* |
| 1412 | STAC 9200-32 pin configs for |
| 1413 | 102801CE (Dell XPS M1710) |
| 1414 | 102801CF (Dell Precision M90) |
| 1415 | */ |
| 1416 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 1417 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1418 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1419 | }; |
| 1420 | |
| 1421 | /* |
| 1422 | STAC 9200-32 pin configs for |
| 1423 | 102801C9 |
| 1424 | 102801CA |
| 1425 | 102801CB (Dell Latitude 120L) |
| 1426 | 102801D3 |
| 1427 | */ |
| 1428 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1429 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1430 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1431 | }; |
| 1432 | |
| 1433 | /* |
| 1434 | STAC 9200-32 pin configs for |
| 1435 | 102801BD (Dell Inspiron E1505n) |
| 1436 | 102801EE |
| 1437 | 102801EF |
| 1438 | */ |
| 1439 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1440 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1441 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1442 | }; |
| 1443 | |
| 1444 | /* |
| 1445 | STAC 9200-32 pin configs for |
| 1446 | 102801F5 (Dell Inspiron 1501) |
| 1447 | 102801F6 |
| 1448 | */ |
| 1449 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1450 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1451 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1452 | }; |
| 1453 | |
| 1454 | /* |
| 1455 | STAC 9200-32 |
| 1456 | 102801CD (Dell Inspiron E1705/9400) |
| 1457 | */ |
| 1458 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1459 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1460 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1461 | }; |
| 1462 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1463 | static unsigned int oqo9200_pin_configs[8] = { |
| 1464 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1465 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1466 | }; |
| 1467 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1468 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1469 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 1470 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1471 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1472 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1473 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1474 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1475 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1476 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1477 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1478 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1479 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1480 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1481 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1482 | [STAC_9200_M4] = gateway9200_m4_pin_configs, |
| 1483 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1484 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1485 | }; |
| 1486 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1487 | static const char *stac9200_models[STAC_9200_MODELS] = { |
| 1488 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1489 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1490 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1491 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1492 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1493 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1494 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1495 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1496 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1497 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1498 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1499 | [STAC_9200_DELL_M27] = "dell-m27", |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1500 | [STAC_9200_M4] = "gateway-m4", |
| 1501 | [STAC_9200_M4_2] = "gateway-m4-2", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1502 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1503 | }; |
| 1504 | |
| 1505 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 1506 | /* SigmaTel reference board */ |
| 1507 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1508 | "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1509 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1510 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1511 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1512 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1513 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1514 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1515 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1516 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1517 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1518 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1519 | "unknown Dell", STAC_9200_DELL_D22), |
| 1520 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1521 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1522 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1523 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1524 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1525 | "unknown Dell", STAC_9200_DELL_D23), |
| 1526 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1527 | "unknown Dell", STAC_9200_DELL_D23), |
| 1528 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1529 | "unknown Dell", STAC_9200_DELL_M22), |
| 1530 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1531 | "unknown Dell", STAC_9200_DELL_M24), |
| 1532 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1533 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1534 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1535 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1536 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1537 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1538 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1539 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1540 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1541 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1542 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1543 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1544 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1545 | "unknown Dell", STAC_9200_DELL_M22), |
| 1546 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1547 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1548 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1549 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1550 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1551 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1552 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1553 | "unknown Dell", STAC_9200_DELL_D23), |
| 1554 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1555 | "unknown Dell", STAC_9200_DELL_D23), |
| 1556 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1557 | "unknown Dell", STAC_9200_DELL_D21), |
| 1558 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1559 | "unknown Dell", STAC_9200_DELL_D23), |
| 1560 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1561 | "unknown Dell", STAC_9200_DELL_D21), |
| 1562 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1563 | "unknown Dell", STAC_9200_DELL_M25), |
| 1564 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1565 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1566 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1567 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1568 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1569 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1570 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1571 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1572 | /* Gateway machines needs EAPD to be set on resume */ |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1573 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
| 1574 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
| 1575 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1576 | /* OQO Mobile */ |
| 1577 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1578 | {} /* terminator */ |
| 1579 | }; |
| 1580 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1581 | static unsigned int ref925x_pin_configs[8] = { |
| 1582 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1583 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1584 | }; |
| 1585 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1586 | static unsigned int stac925xM1_pin_configs[8] = { |
| 1587 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1588 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1589 | }; |
| 1590 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1591 | static unsigned int stac925xM1_2_pin_configs[8] = { |
| 1592 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1593 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1594 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1595 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1596 | static unsigned int stac925xM2_pin_configs[8] = { |
| 1597 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1598 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1599 | }; |
| 1600 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1601 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1602 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1603 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1604 | }; |
| 1605 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1606 | static unsigned int stac925xM3_pin_configs[8] = { |
| 1607 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1608 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, |
| 1609 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1610 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1611 | static unsigned int stac925xM5_pin_configs[8] = { |
| 1612 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1613 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1614 | }; |
| 1615 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1616 | static unsigned int stac925xM6_pin_configs[8] = { |
| 1617 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1618 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1619 | }; |
| 1620 | |
| 1621 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 1622 | [STAC_REF] = ref925x_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1623 | [STAC_M1] = stac925xM1_pin_configs, |
| 1624 | [STAC_M1_2] = stac925xM1_2_pin_configs, |
| 1625 | [STAC_M2] = stac925xM2_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1626 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1627 | [STAC_M3] = stac925xM3_pin_configs, |
| 1628 | [STAC_M5] = stac925xM5_pin_configs, |
| 1629 | [STAC_M6] = stac925xM6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1630 | }; |
| 1631 | |
| 1632 | static const char *stac925x_models[STAC_925x_MODELS] = { |
| 1633 | [STAC_REF] = "ref", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1634 | [STAC_M1] = "m1", |
| 1635 | [STAC_M1_2] = "m1-2", |
| 1636 | [STAC_M2] = "m2", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1637 | [STAC_M2_2] = "m2-2", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1638 | [STAC_M3] = "m3", |
| 1639 | [STAC_M5] = "m5", |
| 1640 | [STAC_M6] = "m6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1641 | }; |
| 1642 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1643 | static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1644 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), |
| 1645 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), |
| 1646 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), |
| 1647 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1648 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1649 | /* Not sure about the brand name for those */ |
| 1650 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), |
| 1651 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), |
| 1652 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), |
| 1653 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1654 | {} /* terminator */ |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1655 | }; |
| 1656 | |
| 1657 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 1658 | /* SigmaTel reference board */ |
| 1659 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1660 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1661 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1662 | |
| 1663 | /* Default table for unknown ID */ |
| 1664 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
| 1665 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1666 | {} /* terminator */ |
| 1667 | }; |
| 1668 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1669 | static unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1670 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1671 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1672 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1673 | 0x01452050, |
| 1674 | }; |
| 1675 | |
| 1676 | static unsigned int dell_m6_pin_configs[13] = { |
| 1677 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1678 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1679 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1680 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1681 | }; |
| 1682 | |
| 1683 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1684 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1685 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
| 1686 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
| 1687 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1688 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1689 | }; |
| 1690 | |
| 1691 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 1692 | [STAC_92HD73XX_NO_JD] = "no-jd", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1693 | [STAC_92HD73XX_REF] = "ref", |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1694 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
| 1695 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
| 1696 | [STAC_DELL_M6_BOTH] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1697 | [STAC_DELL_EQ] = "dell-eq", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1698 | }; |
| 1699 | |
| 1700 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
| 1701 | /* SigmaTel reference board */ |
| 1702 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1703 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1704 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1705 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1706 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1707 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1708 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1709 | "unknown Dell", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1710 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1711 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1712 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1713 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1714 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1715 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1716 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1717 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1718 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1719 | "unknown Dell", STAC_DELL_M6_DMIC), |
| 1720 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, |
| 1721 | "unknown Dell", STAC_DELL_M6_DMIC), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1722 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1723 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
Joerg Schirottke | fa620e9 | 2008-12-19 08:13:49 +0100 | [diff] [blame] | 1724 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, |
| 1725 | "Dell Studio 17", STAC_DELL_M6_DMIC), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1726 | {} /* terminator */ |
| 1727 | }; |
| 1728 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1729 | static unsigned int ref92hd83xxx_pin_configs[14] = { |
| 1730 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1731 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
| 1732 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, |
| 1733 | 0x01451160, 0x98560170, |
| 1734 | }; |
| 1735 | |
| 1736 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
| 1737 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1738 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1739 | }; |
| 1740 | |
| 1741 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
| 1742 | [STAC_92HD83XXX_REF] = "ref", |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1743 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1744 | }; |
| 1745 | |
| 1746 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
| 1747 | /* SigmaTel reference board */ |
| 1748 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Takashi Iwai | f9d088b | 2009-01-13 11:54:49 +0100 | [diff] [blame] | 1749 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1750 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1751 | "DFI LanParty", STAC_92HD83XXX_REF), |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 1752 | {} /* terminator */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1753 | }; |
| 1754 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1755 | static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1756 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1757 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1758 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
| 1759 | 0x00000000 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1760 | }; |
| 1761 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1762 | static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1763 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1764 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1765 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
| 1766 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1767 | }; |
| 1768 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1769 | static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1770 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1771 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1772 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1773 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1774 | }; |
| 1775 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1776 | static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1777 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1778 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 1779 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1780 | 0x00000000 |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1781 | }; |
| 1782 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1783 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
| 1784 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1785 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1786 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1787 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1788 | [STAC_HP_M4] = NULL, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1789 | [STAC_HP_DV5] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1790 | }; |
| 1791 | |
| 1792 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
| 1793 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1794 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1795 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1796 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1797 | [STAC_HP_M4] = "hp-m4", |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1798 | [STAC_HP_DV5] = "hp-dv5", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1799 | }; |
| 1800 | |
| 1801 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
| 1802 | /* SigmaTel reference board */ |
| 1803 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1804 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1806 | "DFI LanParty", STAC_92HD71BXX_REF), |
Takashi Iwai | 80bf272 | 2008-11-18 10:48:41 +0100 | [diff] [blame] | 1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, |
| 1808 | "HP dv5", STAC_HP_M4), |
| 1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, |
| 1810 | "HP dv7", STAC_HP_M4), |
Takashi Iwai | e0c0e94 | 2009-01-22 12:58:11 +0100 | [diff] [blame] | 1811 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, |
| 1812 | "HP dv4", STAC_HP_DV5), |
Takashi Iwai | 69dfaef | 2008-12-20 16:57:50 +0100 | [diff] [blame] | 1813 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, |
| 1814 | "HP dv7", STAC_HP_M4), |
Takashi Iwai | 42de55c | 2009-01-30 15:49:58 +0100 | [diff] [blame] | 1815 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, |
| 1816 | "HP dv5", STAC_HP_DV5), |
Giuseppe Bilotta | dafb70c | 2009-01-13 08:58:49 -0500 | [diff] [blame] | 1817 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1818 | "HP dv5", STAC_HP_DV5), |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1819 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
| 1820 | "unknown HP", STAC_HP_M4), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1821 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1822 | "unknown Dell", STAC_DELL_M4_1), |
| 1823 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1824 | "unknown Dell", STAC_DELL_M4_1), |
| 1825 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1826 | "unknown Dell", STAC_DELL_M4_1), |
| 1827 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1828 | "unknown Dell", STAC_DELL_M4_1), |
| 1829 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1830 | "unknown Dell", STAC_DELL_M4_1), |
| 1831 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1832 | "unknown Dell", STAC_DELL_M4_1), |
| 1833 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1834 | "unknown Dell", STAC_DELL_M4_1), |
| 1835 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1836 | "unknown Dell", STAC_DELL_M4_2), |
| 1837 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1838 | "unknown Dell", STAC_DELL_M4_2), |
| 1839 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1840 | "unknown Dell", STAC_DELL_M4_2), |
| 1841 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1842 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1843 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1844 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1845 | {} /* terminator */ |
| 1846 | }; |
| 1847 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1848 | static unsigned int ref922x_pin_configs[10] = { |
| 1849 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1850 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1851 | 0x40000100, 0x40000100, |
| 1852 | }; |
| 1853 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1854 | /* |
| 1855 | STAC 922X pin configs for |
| 1856 | 102801A7 |
| 1857 | 102801AB |
| 1858 | 102801A9 |
| 1859 | 102801D1 |
| 1860 | 102801D2 |
| 1861 | */ |
| 1862 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 1863 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1864 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1865 | 0x01813122, 0x400001f2, |
| 1866 | }; |
| 1867 | |
| 1868 | /* |
| 1869 | STAC 922X pin configs for |
| 1870 | 102801AC |
| 1871 | 102801D0 |
| 1872 | */ |
| 1873 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 1874 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1875 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1876 | 0x01813122, 0x400001f1, |
| 1877 | }; |
| 1878 | |
| 1879 | /* |
| 1880 | STAC 922X pin configs for |
| 1881 | 102801BF |
| 1882 | */ |
| 1883 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 1884 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1885 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1886 | 0x40C003f1, 0x405003f0, |
| 1887 | }; |
| 1888 | |
| 1889 | /* |
| 1890 | STAC 9221 A1 pin configs for |
| 1891 | 102801D7 (Dell XPS M1210) |
| 1892 | */ |
| 1893 | static unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1894 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1895 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1896 | 0x508003f3, 0x405003f4, |
| 1897 | }; |
| 1898 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1899 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1900 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1901 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 1902 | 0x02a19120, 0x40000100, |
| 1903 | }; |
| 1904 | |
| 1905 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1906 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 1907 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1908 | 0x02a19320, 0x40000100, |
| 1909 | }; |
| 1910 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1911 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 1912 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 1913 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1914 | 0x400000fc, 0x400000fb, |
| 1915 | }; |
| 1916 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1917 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 1918 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1919 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1920 | 0x400000fc, 0x400000fb, |
| 1921 | }; |
| 1922 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1923 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 1924 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 1925 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 1926 | 0x400000fc, 0x400000fb, |
| 1927 | }; |
| 1928 | |
| 1929 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 1930 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1931 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1932 | 0x400000fc, 0x400000fb, |
| 1933 | }; |
| 1934 | |
| 1935 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 1936 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 1937 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 1938 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1939 | }; |
| 1940 | |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1941 | static unsigned int ecs202_pin_configs[10] = { |
| 1942 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 1943 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 1944 | 0x9037012e, 0x40e000f2, |
| 1945 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 1946 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1947 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1948 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1949 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 1950 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1951 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 1952 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 1953 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 1954 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 1955 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1956 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1957 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1958 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 1959 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 1960 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 1961 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 1962 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 1963 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1964 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1965 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 1966 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 1967 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 1968 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1969 | }; |
| 1970 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1971 | static const char *stac922x_models[STAC_922X_MODELS] = { |
| 1972 | [STAC_D945_REF] = "ref", |
| 1973 | [STAC_D945GTP5] = "5stack", |
| 1974 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 1975 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 1976 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 1977 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 1978 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 1979 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 1980 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1981 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1982 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 1983 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 1984 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 1985 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 1986 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 1987 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 1988 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1989 | [STAC_922X_DELL_D81] = "dell-d81", |
| 1990 | [STAC_922X_DELL_D82] = "dell-d82", |
| 1991 | [STAC_922X_DELL_M81] = "dell-m81", |
| 1992 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1993 | }; |
| 1994 | |
| 1995 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 1996 | /* SigmaTel reference board */ |
| 1997 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1998 | "DFI LanParty", STAC_D945_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1999 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2000 | "DFI LanParty", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2001 | /* Intel 945G based systems */ |
| 2002 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 2003 | "Intel D945G", STAC_D945GTP3), |
| 2004 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 2005 | "Intel D945G", STAC_D945GTP3), |
| 2006 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 2007 | "Intel D945G", STAC_D945GTP3), |
| 2008 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 2009 | "Intel D945G", STAC_D945GTP3), |
| 2010 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 2011 | "Intel D945G", STAC_D945GTP3), |
| 2012 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 2013 | "Intel D945G", STAC_D945GTP3), |
| 2014 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 2015 | "Intel D945G", STAC_D945GTP3), |
| 2016 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 2017 | "Intel D945G", STAC_D945GTP3), |
| 2018 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 2019 | "Intel D945G", STAC_D945GTP3), |
| 2020 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 2021 | "Intel D945G", STAC_D945GTP3), |
| 2022 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 2023 | "Intel D945G", STAC_D945GTP3), |
| 2024 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 2025 | "Intel D945G", STAC_D945GTP3), |
| 2026 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 2027 | "Intel D945G", STAC_D945GTP3), |
| 2028 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 2029 | "Intel D945G", STAC_D945GTP3), |
| 2030 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 2031 | "Intel D945G", STAC_D945GTP3), |
| 2032 | /* Intel D945G 5-stack systems */ |
| 2033 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 2034 | "Intel D945G", STAC_D945GTP5), |
| 2035 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 2036 | "Intel D945G", STAC_D945GTP5), |
| 2037 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 2038 | "Intel D945G", STAC_D945GTP5), |
| 2039 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 2040 | "Intel D945G", STAC_D945GTP5), |
| 2041 | /* Intel 945P based systems */ |
| 2042 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 2043 | "Intel D945P", STAC_D945GTP3), |
| 2044 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 2045 | "Intel D945P", STAC_D945GTP3), |
| 2046 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 2047 | "Intel D945P", STAC_D945GTP3), |
| 2048 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 2049 | "Intel D945P", STAC_D945GTP3), |
| 2050 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 2051 | "Intel D945P", STAC_D945GTP3), |
| 2052 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 2053 | "Intel D945P", STAC_D945GTP5), |
Takashi Iwai | 8056d47 | 2009-01-23 09:09:43 +0100 | [diff] [blame] | 2054 | /* other intel */ |
| 2055 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, |
| 2056 | "Intel D945", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2057 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2058 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2059 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2060 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2061 | /* Dell systems */ |
| 2062 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2063 | "unknown Dell", STAC_922X_DELL_D81), |
| 2064 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2065 | "unknown Dell", STAC_922X_DELL_D81), |
| 2066 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2067 | "unknown Dell", STAC_922X_DELL_D81), |
| 2068 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2069 | "unknown Dell", STAC_922X_DELL_D82), |
| 2070 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2071 | "unknown Dell", STAC_922X_DELL_M81), |
| 2072 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2073 | "unknown Dell", STAC_922X_DELL_D82), |
| 2074 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2075 | "unknown Dell", STAC_922X_DELL_D81), |
| 2076 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2077 | "unknown Dell", STAC_922X_DELL_D81), |
| 2078 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2079 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2080 | /* ECS/PC Chips boards */ |
| 2081 | SND_PCI_QUIRK(0x1019, 0x2144, |
| 2082 | "ECS/PC chips", STAC_ECS_202), |
| 2083 | SND_PCI_QUIRK(0x1019, 0x2608, |
| 2084 | "ECS/PC chips", STAC_ECS_202), |
| 2085 | SND_PCI_QUIRK(0x1019, 0x2633, |
| 2086 | "ECS/PC chips P17G/1333", STAC_ECS_202), |
| 2087 | SND_PCI_QUIRK(0x1019, 0x2811, |
| 2088 | "ECS/PC chips", STAC_ECS_202), |
| 2089 | SND_PCI_QUIRK(0x1019, 0x2812, |
| 2090 | "ECS/PC chips", STAC_ECS_202), |
| 2091 | SND_PCI_QUIRK(0x1019, 0x2813, |
| 2092 | "ECS/PC chips", STAC_ECS_202), |
| 2093 | SND_PCI_QUIRK(0x1019, 0x2814, |
| 2094 | "ECS/PC chips", STAC_ECS_202), |
| 2095 | SND_PCI_QUIRK(0x1019, 0x2815, |
| 2096 | "ECS/PC chips", STAC_ECS_202), |
| 2097 | SND_PCI_QUIRK(0x1019, 0x2816, |
| 2098 | "ECS/PC chips", STAC_ECS_202), |
| 2099 | SND_PCI_QUIRK(0x1019, 0x2817, |
| 2100 | "ECS/PC chips", STAC_ECS_202), |
| 2101 | SND_PCI_QUIRK(0x1019, 0x2818, |
| 2102 | "ECS/PC chips", STAC_ECS_202), |
| 2103 | SND_PCI_QUIRK(0x1019, 0x2819, |
| 2104 | "ECS/PC chips", STAC_ECS_202), |
| 2105 | SND_PCI_QUIRK(0x1019, 0x2820, |
| 2106 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2107 | {} /* terminator */ |
| 2108 | }; |
| 2109 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2110 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2111 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2112 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2113 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2114 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2115 | }; |
| 2116 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2117 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2118 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2119 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2120 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2121 | 0x40000100, 0x40000100 |
| 2122 | }; |
| 2123 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2124 | static unsigned int d965_5st_pin_configs[14] = { |
| 2125 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2126 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2127 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2128 | 0x40000100, 0x40000100 |
| 2129 | }; |
| 2130 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2131 | static unsigned int dell_3st_pin_configs[14] = { |
| 2132 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2133 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2134 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2135 | 0x40c003fc, 0x40000100 |
| 2136 | }; |
| 2137 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2138 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2139 | [STAC_D965_REF_NO_JD] = ref927x_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2140 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2141 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2142 | [STAC_D965_5ST] = d965_5st_pin_configs, |
| 2143 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2144 | [STAC_DELL_BIOS] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2145 | }; |
| 2146 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2147 | static const char *stac927x_models[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2148 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2149 | [STAC_D965_REF] = "ref", |
| 2150 | [STAC_D965_3ST] = "3stack", |
| 2151 | [STAC_D965_5ST] = "5stack", |
| 2152 | [STAC_DELL_3ST] = "dell-3stack", |
| 2153 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2154 | }; |
| 2155 | |
| 2156 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 2157 | /* SigmaTel reference board */ |
| 2158 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2159 | "DFI LanParty", STAC_D965_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2160 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2161 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2162 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2163 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2164 | 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] | 2165 | /* 965 based 3 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2166 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), |
| 2167 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), |
| 2168 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), |
| 2169 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), |
| 2170 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), |
| 2171 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), |
| 2172 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), |
| 2173 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), |
| 2174 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), |
| 2175 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), |
| 2176 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), |
| 2177 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), |
| 2178 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), |
| 2179 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), |
| 2180 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), |
| 2181 | 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] | 2182 | /* Dell 3 stack systems */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2183 | 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] | 2184 | 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] | 2185 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2186 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2187 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2188 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
| 2189 | 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] | 2190 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Takashi Iwai | 24918b6 | 2008-09-30 12:58:54 +0200 | [diff] [blame] | 2191 | 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] | 2192 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2193 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2194 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2195 | 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] | 2196 | /* 965 based 5 stack systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2197 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), |
| 2198 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), |
| 2199 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), |
| 2200 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), |
| 2201 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), |
| 2202 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), |
| 2203 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), |
| 2204 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), |
| 2205 | 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] | 2206 | {} /* terminator */ |
| 2207 | }; |
| 2208 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2209 | static unsigned int ref9205_pin_configs[12] = { |
| 2210 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2211 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2212 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2213 | }; |
| 2214 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2215 | /* |
| 2216 | STAC 9205 pin configs for |
| 2217 | 102801F1 |
| 2218 | 102801F2 |
| 2219 | 102801FC |
| 2220 | 102801FD |
| 2221 | 10280204 |
| 2222 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2223 | 10280228 (Dell Vostro 1500) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2224 | */ |
| 2225 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 2226 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2227 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2228 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2229 | }; |
| 2230 | |
| 2231 | /* |
| 2232 | STAC 9205 pin configs for |
| 2233 | 102801F9 |
| 2234 | 102801FA |
| 2235 | 102801FE |
| 2236 | 102801FF (Dell Precision M4300) |
| 2237 | 10280206 |
| 2238 | 10280200 |
| 2239 | 10280201 |
| 2240 | */ |
| 2241 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2242 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2243 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2244 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2245 | }; |
| 2246 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2247 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2248 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2249 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2250 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2251 | }; |
| 2252 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2253 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2254 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2255 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2256 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2257 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2258 | [STAC_9205_EAPD] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2259 | }; |
| 2260 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2261 | static const char *stac9205_models[STAC_9205_MODELS] = { |
| 2262 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2263 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2264 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2265 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2266 | [STAC_9205_EAPD] = "eapd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2267 | }; |
| 2268 | |
| 2269 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 2270 | /* SigmaTel reference board */ |
| 2271 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2272 | "DFI LanParty", STAC_9205_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2273 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2274 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2275 | /* Dell */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2276 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2277 | "unknown Dell", STAC_9205_DELL_M42), |
| 2278 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2279 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2280 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2281 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2282 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2283 | "Dell Precision", STAC_9205_DELL_M43), |
| 2284 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2285 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2286 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2287 | "unknown Dell", STAC_9205_DELL_M42), |
| 2288 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2289 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2290 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2291 | "Dell Precision", STAC_9205_DELL_M43), |
| 2292 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2293 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2294 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2295 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2296 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2297 | "Dell Precision", STAC_9205_DELL_M43), |
| 2298 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2299 | "Dell Precision", STAC_9205_DELL_M43), |
| 2300 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2301 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2302 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2303 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2304 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2305 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2306 | /* Gateway */ |
| 2307 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2308 | {} /* terminator */ |
| 2309 | }; |
| 2310 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2311 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) |
| 2312 | { |
| 2313 | int i; |
| 2314 | struct sigmatel_spec *spec = codec->spec; |
| 2315 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2316 | kfree(spec->pin_configs); |
| 2317 | spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs), |
| 2318 | GFP_KERNEL); |
| 2319 | if (!spec->pin_configs) |
| 2320 | return -ENOMEM; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2321 | |
| 2322 | for (i = 0; i < spec->num_pins; i++) { |
| 2323 | hda_nid_t nid = spec->pin_nids[i]; |
| 2324 | unsigned int pin_cfg; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 2325 | |
| 2326 | if (!nid) |
| 2327 | continue; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2328 | pin_cfg = snd_hda_codec_read(codec, nid, 0, |
| 2329 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); |
| 2330 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", |
| 2331 | nid, pin_cfg); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2332 | spec->pin_configs[i] = pin_cfg; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2333 | } |
| 2334 | |
| 2335 | return 0; |
| 2336 | } |
| 2337 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2338 | static void stac92xx_set_config_reg(struct hda_codec *codec, |
| 2339 | hda_nid_t pin_nid, unsigned int pin_config) |
| 2340 | { |
| 2341 | int i; |
| 2342 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2343 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, |
| 2344 | pin_config & 0x000000ff); |
| 2345 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2346 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, |
| 2347 | (pin_config & 0x0000ff00) >> 8); |
| 2348 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2349 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, |
| 2350 | (pin_config & 0x00ff0000) >> 16); |
| 2351 | snd_hda_codec_write(codec, pin_nid, 0, |
| 2352 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, |
| 2353 | pin_config >> 24); |
| 2354 | i = snd_hda_codec_read(codec, pin_nid, 0, |
| 2355 | AC_VERB_GET_CONFIG_DEFAULT, |
| 2356 | 0x00); |
| 2357 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", |
| 2358 | pin_nid, i); |
| 2359 | } |
| 2360 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2361 | static void stac92xx_set_config_regs(struct hda_codec *codec) |
| 2362 | { |
| 2363 | int i; |
| 2364 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2365 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2366 | if (!spec->pin_configs) |
| 2367 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2368 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2369 | for (i = 0; i < spec->num_pins; i++) |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 2370 | if (spec->pin_nids[i] && spec->pin_configs[i]) |
| 2371 | stac92xx_set_config_reg(codec, spec->pin_nids[i], |
| 2372 | spec->pin_configs[i]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2373 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2374 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2375 | static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins) |
| 2376 | { |
| 2377 | struct sigmatel_spec *spec = codec->spec; |
| 2378 | |
| 2379 | if (!pins) |
| 2380 | return stac92xx_save_bios_config_regs(codec); |
| 2381 | |
| 2382 | kfree(spec->pin_configs); |
| 2383 | spec->pin_configs = kmemdup(pins, |
| 2384 | spec->num_pins * sizeof(*pins), |
| 2385 | GFP_KERNEL); |
| 2386 | if (!spec->pin_configs) |
| 2387 | return -ENOMEM; |
| 2388 | |
| 2389 | stac92xx_set_config_regs(codec); |
| 2390 | return 0; |
| 2391 | } |
| 2392 | |
| 2393 | static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid, |
| 2394 | unsigned int cfg) |
| 2395 | { |
| 2396 | struct sigmatel_spec *spec = codec->spec; |
| 2397 | int i; |
| 2398 | |
| 2399 | for (i = 0; i < spec->num_pins; i++) { |
| 2400 | if (spec->pin_nids[i] == nid) { |
| 2401 | spec->pin_configs[i] = cfg; |
| 2402 | stac92xx_set_config_reg(codec, nid, cfg); |
| 2403 | break; |
| 2404 | } |
| 2405 | } |
| 2406 | } |
| 2407 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2408 | /* |
| 2409 | * Analog playback callbacks |
| 2410 | */ |
| 2411 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2412 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2413 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2414 | { |
| 2415 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2416 | if (spec->stream_delay) |
| 2417 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2418 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2419 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2420 | } |
| 2421 | |
| 2422 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2423 | struct hda_codec *codec, |
| 2424 | unsigned int stream_tag, |
| 2425 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2426 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2427 | { |
| 2428 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2429 | 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] | 2430 | } |
| 2431 | |
| 2432 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2433 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2434 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2435 | { |
| 2436 | struct sigmatel_spec *spec = codec->spec; |
| 2437 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2438 | } |
| 2439 | |
| 2440 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2441 | * Digital playback callbacks |
| 2442 | */ |
| 2443 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2444 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2445 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2446 | { |
| 2447 | struct sigmatel_spec *spec = codec->spec; |
| 2448 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2449 | } |
| 2450 | |
| 2451 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2452 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2453 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2454 | { |
| 2455 | struct sigmatel_spec *spec = codec->spec; |
| 2456 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2457 | } |
| 2458 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2459 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2460 | struct hda_codec *codec, |
| 2461 | unsigned int stream_tag, |
| 2462 | unsigned int format, |
| 2463 | struct snd_pcm_substream *substream) |
| 2464 | { |
| 2465 | struct sigmatel_spec *spec = codec->spec; |
| 2466 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2467 | stream_tag, format, substream); |
| 2468 | } |
| 2469 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2470 | |
| 2471 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2472 | * Analog capture callbacks |
| 2473 | */ |
| 2474 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2475 | struct hda_codec *codec, |
| 2476 | unsigned int stream_tag, |
| 2477 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2478 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2479 | { |
| 2480 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2481 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2482 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2483 | if (spec->powerdown_adcs) { |
| 2484 | msleep(40); |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2485 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2486 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2487 | } |
| 2488 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2489 | return 0; |
| 2490 | } |
| 2491 | |
| 2492 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2493 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2494 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2495 | { |
| 2496 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2497 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2498 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2499 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2500 | if (spec->powerdown_adcs) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2501 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2502 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2503 | return 0; |
| 2504 | } |
| 2505 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2506 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 2507 | .substreams = 1, |
| 2508 | .channels_min = 2, |
| 2509 | .channels_max = 2, |
| 2510 | /* NID is set in stac92xx_build_pcms */ |
| 2511 | .ops = { |
| 2512 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2513 | .close = stac92xx_dig_playback_pcm_close, |
| 2514 | .prepare = stac92xx_dig_playback_pcm_prepare |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2515 | }, |
| 2516 | }; |
| 2517 | |
| 2518 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 2519 | .substreams = 1, |
| 2520 | .channels_min = 2, |
| 2521 | .channels_max = 2, |
| 2522 | /* NID is set in stac92xx_build_pcms */ |
| 2523 | }; |
| 2524 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2525 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 2526 | .substreams = 1, |
| 2527 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2528 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2529 | .nid = 0x02, /* NID to query formats and rates */ |
| 2530 | .ops = { |
| 2531 | .open = stac92xx_playback_pcm_open, |
| 2532 | .prepare = stac92xx_playback_pcm_prepare, |
| 2533 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2534 | }, |
| 2535 | }; |
| 2536 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2537 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 2538 | .substreams = 1, |
| 2539 | .channels_min = 2, |
| 2540 | .channels_max = 2, |
| 2541 | .nid = 0x06, /* NID to query formats and rates */ |
| 2542 | .ops = { |
| 2543 | .open = stac92xx_playback_pcm_open, |
| 2544 | .prepare = stac92xx_playback_pcm_prepare, |
| 2545 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2546 | }, |
| 2547 | }; |
| 2548 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2549 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2550 | .channels_min = 2, |
| 2551 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2552 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2553 | .ops = { |
| 2554 | .prepare = stac92xx_capture_pcm_prepare, |
| 2555 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2556 | }, |
| 2557 | }; |
| 2558 | |
| 2559 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2560 | { |
| 2561 | struct sigmatel_spec *spec = codec->spec; |
| 2562 | struct hda_pcm *info = spec->pcm_rec; |
| 2563 | |
| 2564 | codec->num_pcms = 1; |
| 2565 | codec->pcm_info = info; |
| 2566 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2567 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2568 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Takashi Iwai | 00a602d | 2009-01-23 11:55:42 +0100 | [diff] [blame] | 2569 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2570 | spec->multiout.dac_nids[0]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2571 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2572 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2573 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2574 | |
| 2575 | if (spec->alt_switch) { |
| 2576 | codec->num_pcms++; |
| 2577 | info++; |
| 2578 | info->name = "STAC92xx Analog Alt"; |
| 2579 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2580 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2581 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2582 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2583 | codec->num_pcms++; |
| 2584 | info++; |
| 2585 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 8c44198 | 2009-01-20 18:30:20 +0100 | [diff] [blame] | 2586 | info->pcm_type = spec->autocfg.dig_out_type; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2587 | if (spec->multiout.dig_out_nid) { |
| 2588 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2589 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2590 | } |
| 2591 | if (spec->dig_in_nid) { |
| 2592 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2593 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2594 | } |
| 2595 | } |
| 2596 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2597 | return 0; |
| 2598 | } |
| 2599 | |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2600 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
| 2601 | { |
| 2602 | unsigned int pincap = snd_hda_param_read(codec, nid, |
| 2603 | AC_PAR_PIN_CAP); |
| 2604 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2605 | if (pincap & AC_PINCAP_VREF_100) |
| 2606 | return AC_PINCTL_VREF_100; |
| 2607 | if (pincap & AC_PINCAP_VREF_80) |
| 2608 | return AC_PINCTL_VREF_80; |
| 2609 | if (pincap & AC_PINCAP_VREF_50) |
| 2610 | return AC_PINCTL_VREF_50; |
| 2611 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2612 | return AC_PINCTL_VREF_GRD; |
| 2613 | return 0; |
| 2614 | } |
| 2615 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2616 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2617 | |
| 2618 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2619 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2620 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2621 | } |
| 2622 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2623 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2624 | |
| 2625 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2626 | struct snd_ctl_elem_value *ucontrol) |
| 2627 | { |
| 2628 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2629 | struct sigmatel_spec *spec = codec->spec; |
| 2630 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2631 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2632 | return 0; |
| 2633 | } |
| 2634 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2635 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 2636 | unsigned char type); |
| 2637 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2638 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2639 | struct snd_ctl_elem_value *ucontrol) |
| 2640 | { |
| 2641 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2642 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2643 | int nid = kcontrol->private_value; |
| 2644 | |
| 2645 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2646 | |
| 2647 | /* check to be sure that the ports are upto date with |
| 2648 | * switch changes |
| 2649 | */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2650 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2651 | |
| 2652 | return 1; |
| 2653 | } |
| 2654 | |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 2655 | #define stac92xx_io_switch_info snd_ctl_boolean_mono_info |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2656 | |
| 2657 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2658 | { |
| 2659 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2660 | struct sigmatel_spec *spec = codec->spec; |
| 2661 | int io_idx = kcontrol-> private_value & 0xff; |
| 2662 | |
| 2663 | ucontrol->value.integer.value[0] = spec->io_switch[io_idx]; |
| 2664 | return 0; |
| 2665 | } |
| 2666 | |
| 2667 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2668 | { |
| 2669 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2670 | struct sigmatel_spec *spec = codec->spec; |
| 2671 | hda_nid_t nid = kcontrol->private_value >> 8; |
| 2672 | int io_idx = kcontrol-> private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2673 | unsigned short val = !!ucontrol->value.integer.value[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2674 | |
| 2675 | spec->io_switch[io_idx] = val; |
| 2676 | |
| 2677 | if (val) |
| 2678 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2679 | else { |
| 2680 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2681 | if (io_idx) /* set VREF for mic */ |
| 2682 | pinctl |= stac92xx_get_vref(codec, nid); |
| 2683 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2684 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2685 | |
| 2686 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2687 | * appropriately according to the pin direction |
| 2688 | */ |
| 2689 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2690 | stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2691 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2692 | return 1; |
| 2693 | } |
| 2694 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2695 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2696 | |
| 2697 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2698 | struct snd_ctl_elem_value *ucontrol) |
| 2699 | { |
| 2700 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2701 | struct sigmatel_spec *spec = codec->spec; |
| 2702 | |
| 2703 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2704 | return 0; |
| 2705 | } |
| 2706 | |
| 2707 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2708 | struct snd_ctl_elem_value *ucontrol) |
| 2709 | { |
| 2710 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2711 | struct sigmatel_spec *spec = codec->spec; |
| 2712 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2713 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2714 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2715 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2716 | return 0; |
| 2717 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2718 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2719 | |
| 2720 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2721 | spec->clfe_swap ? 0x4 : 0x0); |
| 2722 | |
| 2723 | return 1; |
| 2724 | } |
| 2725 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2726 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2727 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2728 | .name = xname, \ |
| 2729 | .index = 0, \ |
| 2730 | .info = stac92xx_hp_switch_info, \ |
| 2731 | .get = stac92xx_hp_switch_get, \ |
| 2732 | .put = stac92xx_hp_switch_put, \ |
| 2733 | } |
| 2734 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2735 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2736 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2737 | .name = xname, \ |
| 2738 | .index = 0, \ |
| 2739 | .info = stac92xx_io_switch_info, \ |
| 2740 | .get = stac92xx_io_switch_get, \ |
| 2741 | .put = stac92xx_io_switch_put, \ |
| 2742 | .private_value = xpval, \ |
| 2743 | } |
| 2744 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2745 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2746 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2747 | .name = xname, \ |
| 2748 | .index = 0, \ |
| 2749 | .info = stac92xx_clfe_switch_info, \ |
| 2750 | .get = stac92xx_clfe_switch_get, \ |
| 2751 | .put = stac92xx_clfe_switch_put, \ |
| 2752 | .private_value = xpval, \ |
| 2753 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2754 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2755 | enum { |
| 2756 | STAC_CTL_WIDGET_VOL, |
| 2757 | STAC_CTL_WIDGET_MUTE, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2758 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2759 | STAC_CTL_WIDGET_AMP_MUX, |
| 2760 | STAC_CTL_WIDGET_AMP_VOL, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2761 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2762 | STAC_CTL_WIDGET_IO_SWITCH, |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2763 | STAC_CTL_WIDGET_CLFE_SWITCH |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2764 | }; |
| 2765 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2766 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2767 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2768 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2769 | STAC_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2770 | STAC_AMP_MUX, |
| 2771 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2772 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2773 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2774 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2775 | }; |
| 2776 | |
| 2777 | /* add dynamic controls */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2778 | static struct snd_kcontrol_new * |
| 2779 | stac_control_new(struct sigmatel_spec *spec, |
| 2780 | struct snd_kcontrol_new *ktemp, |
| 2781 | const char *name) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2782 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2783 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2784 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2785 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2786 | knew = snd_array_new(&spec->kctls); |
| 2787 | if (!knew) |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2788 | return NULL; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2789 | *knew = *ktemp; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2790 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2791 | if (!knew->name) { |
| 2792 | /* roolback */ |
| 2793 | memset(knew, 0, sizeof(*knew)); |
| 2794 | spec->kctls.alloced--; |
| 2795 | return NULL; |
| 2796 | } |
| 2797 | return knew; |
| 2798 | } |
| 2799 | |
| 2800 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
| 2801 | struct snd_kcontrol_new *ktemp, |
| 2802 | int idx, const char *name, |
| 2803 | unsigned long val) |
| 2804 | { |
| 2805 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); |
| 2806 | if (!knew) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2807 | return -ENOMEM; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2808 | knew->index = idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2809 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2810 | return 0; |
| 2811 | } |
| 2812 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2813 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2814 | int type, int idx, const char *name, |
| 2815 | unsigned long val) |
| 2816 | { |
| 2817 | return stac92xx_add_control_temp(spec, |
| 2818 | &stac92xx_control_templates[type], |
| 2819 | idx, name, val); |
| 2820 | } |
| 2821 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2822 | |
| 2823 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2824 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2825 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2826 | { |
| 2827 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2828 | } |
| 2829 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2830 | static struct snd_kcontrol_new stac_input_src_temp = { |
| 2831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2832 | .name = "Input Source", |
| 2833 | .info = stac92xx_mux_enum_info, |
| 2834 | .get = stac92xx_mux_enum_get, |
| 2835 | .put = stac92xx_mux_enum_put, |
| 2836 | }; |
| 2837 | |
| 2838 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) |
| 2839 | { |
| 2840 | struct snd_kcontrol_new *knew; |
| 2841 | struct hda_input_mux *imux = &spec->private_imux; |
| 2842 | |
| 2843 | if (!spec->num_adcs || imux->num_items <= 1) |
| 2844 | return 0; /* no need for input source control */ |
| 2845 | knew = stac_control_new(spec, &stac_input_src_temp, |
| 2846 | stac_input_src_temp.name); |
| 2847 | if (!knew) |
| 2848 | return -ENOMEM; |
| 2849 | knew->count = spec->num_adcs; |
| 2850 | return 0; |
| 2851 | } |
| 2852 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2853 | /* check whether the line-input can be used as line-out */ |
| 2854 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2855 | { |
| 2856 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2857 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2858 | hda_nid_t nid; |
| 2859 | unsigned int pincap; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2860 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2861 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2862 | return 0; |
| 2863 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
| 2864 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 2865 | if (pincap & AC_PINCAP_OUT) |
| 2866 | return nid; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2867 | return 0; |
| 2868 | } |
| 2869 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2870 | /* check whether the mic-input can be used as line-out */ |
| 2871 | static hda_nid_t check_mic_out_switch(struct hda_codec *codec) |
| 2872 | { |
| 2873 | struct sigmatel_spec *spec = codec->spec; |
| 2874 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2875 | unsigned int def_conf, pincap; |
| 2876 | unsigned int mic_pin; |
| 2877 | |
| 2878 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2879 | return 0; |
| 2880 | mic_pin = AUTO_PIN_MIC; |
| 2881 | for (;;) { |
| 2882 | hda_nid_t nid = cfg->input_pins[mic_pin]; |
| 2883 | def_conf = snd_hda_codec_read(codec, nid, 0, |
| 2884 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 2885 | /* some laptops have an internal analog microphone |
| 2886 | * which can't be used as a output */ |
| 2887 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
| 2888 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 2889 | if (pincap & AC_PINCAP_OUT) |
| 2890 | return nid; |
| 2891 | } |
| 2892 | if (mic_pin == AUTO_PIN_MIC) |
| 2893 | mic_pin = AUTO_PIN_FRONT_MIC; |
| 2894 | else |
| 2895 | break; |
| 2896 | } |
| 2897 | return 0; |
| 2898 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2899 | |
| 2900 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2901 | { |
| 2902 | int i; |
| 2903 | |
| 2904 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 2905 | if (spec->multiout.dac_nids[i] == nid) |
| 2906 | return 1; |
| 2907 | } |
| 2908 | |
| 2909 | return 0; |
| 2910 | } |
| 2911 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2912 | static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 2913 | { |
| 2914 | int i; |
| 2915 | if (is_in_dac_nids(spec, nid)) |
| 2916 | return 1; |
| 2917 | for (i = 0; i < spec->autocfg.hp_outs; i++) |
| 2918 | if (spec->hp_dacs[i] == nid) |
| 2919 | return 1; |
| 2920 | for (i = 0; i < spec->autocfg.speaker_outs; i++) |
| 2921 | if (spec->speaker_dacs[i] == nid) |
| 2922 | return 1; |
| 2923 | return 0; |
| 2924 | } |
| 2925 | |
| 2926 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
| 2927 | { |
| 2928 | struct sigmatel_spec *spec = codec->spec; |
| 2929 | int j, conn_len; |
| 2930 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
| 2931 | unsigned int wcaps, wtype; |
| 2932 | |
| 2933 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 2934 | HDA_MAX_CONNECTIONS); |
| 2935 | for (j = 0; j < conn_len; j++) { |
| 2936 | wcaps = snd_hda_param_read(codec, conn[j], |
| 2937 | AC_PAR_AUDIO_WIDGET_CAP); |
| 2938 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 2939 | /* we check only analog outputs */ |
| 2940 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
| 2941 | continue; |
| 2942 | /* if this route has a free DAC, assign it */ |
| 2943 | if (!check_all_dac_nids(spec, conn[j])) { |
| 2944 | if (conn_len > 1) { |
| 2945 | /* select this DAC in the pin's input mux */ |
| 2946 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2947 | AC_VERB_SET_CONNECT_SEL, j); |
| 2948 | } |
| 2949 | return conn[j]; |
| 2950 | } |
| 2951 | } |
| 2952 | return 0; |
| 2953 | } |
| 2954 | |
| 2955 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 2956 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 2957 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2958 | /* |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2959 | * Fill in the dac_nids table from the parsed pin configuration |
| 2960 | * This function only works when every pin in line_out_pins[] |
| 2961 | * contains atleast one DAC in its connection list. Some 92xx |
| 2962 | * codecs are not connected directly to a DAC, such as the 9200 |
| 2963 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2964 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2965 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2966 | { |
| 2967 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2968 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2969 | int i; |
| 2970 | hda_nid_t nid, dac; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2971 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2972 | for (i = 0; i < cfg->line_outs; i++) { |
| 2973 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2974 | dac = get_unassigned_dac(codec, nid); |
| 2975 | if (!dac) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 2976 | if (spec->multiout.num_dacs > 0) { |
| 2977 | /* we have already working output pins, |
| 2978 | * so let's drop the broken ones again |
| 2979 | */ |
| 2980 | cfg->line_outs = spec->multiout.num_dacs; |
| 2981 | break; |
| 2982 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2983 | /* error out, no available DAC found */ |
| 2984 | snd_printk(KERN_ERR |
| 2985 | "%s: No available DAC for pin 0x%x\n", |
| 2986 | __func__, nid); |
| 2987 | return -ENODEV; |
| 2988 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2989 | add_spec_dacs(spec, dac); |
| 2990 | } |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 2991 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2992 | /* add line-in as output */ |
| 2993 | nid = check_line_out_switch(codec); |
| 2994 | if (nid) { |
| 2995 | dac = get_unassigned_dac(codec, nid); |
| 2996 | if (dac) { |
| 2997 | snd_printdd("STAC: Add line-in 0x%x as output %d\n", |
| 2998 | nid, cfg->line_outs); |
| 2999 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3000 | cfg->line_outs++; |
| 3001 | spec->line_switch = nid; |
| 3002 | add_spec_dacs(spec, dac); |
| 3003 | } |
| 3004 | } |
| 3005 | /* add mic as output */ |
| 3006 | nid = check_mic_out_switch(codec); |
| 3007 | if (nid) { |
| 3008 | dac = get_unassigned_dac(codec, nid); |
| 3009 | if (dac) { |
| 3010 | snd_printdd("STAC: Add mic-in 0x%x as output %d\n", |
| 3011 | nid, cfg->line_outs); |
| 3012 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3013 | cfg->line_outs++; |
| 3014 | spec->mic_switch = nid; |
| 3015 | add_spec_dacs(spec, dac); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3016 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3017 | } |
| 3018 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3019 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3020 | nid = cfg->hp_pins[i]; |
| 3021 | dac = get_unassigned_dac(codec, nid); |
| 3022 | if (dac) { |
| 3023 | if (!spec->multiout.hp_nid) |
| 3024 | spec->multiout.hp_nid = dac; |
| 3025 | else |
| 3026 | add_spec_extra_dacs(spec, dac); |
| 3027 | } |
| 3028 | spec->hp_dacs[i] = dac; |
| 3029 | } |
| 3030 | |
| 3031 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 3032 | nid = cfg->speaker_pins[i]; |
| 3033 | dac = get_unassigned_dac(codec, nid); |
| 3034 | if (dac) |
| 3035 | add_spec_extra_dacs(spec, dac); |
| 3036 | spec->speaker_dacs[i] = dac; |
| 3037 | } |
| 3038 | |
| 3039 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3040 | spec->multiout.num_dacs, |
| 3041 | spec->multiout.dac_nids[0], |
| 3042 | spec->multiout.dac_nids[1], |
| 3043 | spec->multiout.dac_nids[2], |
| 3044 | spec->multiout.dac_nids[3], |
| 3045 | spec->multiout.dac_nids[4]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3046 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3047 | return 0; |
| 3048 | } |
| 3049 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3050 | /* create volume control/switch for the given prefx type */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3051 | static int create_controls(struct hda_codec *codec, const char *pfx, |
| 3052 | hda_nid_t nid, int chs) |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3053 | { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3054 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3055 | char name[32]; |
| 3056 | int err; |
| 3057 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3058 | if (!spec->check_volume_offset) { |
| 3059 | unsigned int caps, step, nums, db_scale; |
| 3060 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3061 | step = (caps & AC_AMPCAP_STEP_SIZE) >> |
| 3062 | AC_AMPCAP_STEP_SIZE_SHIFT; |
| 3063 | step = (step + 1) * 25; /* in .01dB unit */ |
| 3064 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> |
| 3065 | AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3066 | db_scale = nums * step; |
| 3067 | /* if dB scale is over -64dB, and finer enough, |
| 3068 | * let's reduce it to half |
| 3069 | */ |
| 3070 | if (db_scale > 6400 && nums >= 0x1f) |
| 3071 | spec->volume_offset = nums / 2; |
| 3072 | spec->check_volume_offset = 1; |
| 3073 | } |
| 3074 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3075 | sprintf(name, "%s Playback Volume", pfx); |
| 3076 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3077 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
| 3078 | spec->volume_offset)); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3079 | if (err < 0) |
| 3080 | return err; |
| 3081 | sprintf(name, "%s Playback Switch", pfx); |
| 3082 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, |
| 3083 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 3084 | if (err < 0) |
| 3085 | return err; |
| 3086 | return 0; |
| 3087 | } |
| 3088 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3089 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3090 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3091 | if (spec->multiout.num_dacs > 4) { |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3092 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 3093 | return 1; |
| 3094 | } else { |
| 3095 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 3096 | spec->multiout.num_dacs++; |
| 3097 | } |
| 3098 | return 0; |
| 3099 | } |
| 3100 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3101 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3102 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3103 | int i; |
| 3104 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { |
| 3105 | if (!spec->multiout.extra_out_nid[i]) { |
| 3106 | spec->multiout.extra_out_nid[i] = nid; |
| 3107 | return 0; |
| 3108 | } |
| 3109 | } |
| 3110 | printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); |
| 3111 | return 1; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3112 | } |
| 3113 | |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3114 | static int is_unique_dac(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3115 | { |
| 3116 | int i; |
| 3117 | |
| 3118 | if (spec->autocfg.line_outs != 1) |
| 3119 | return 0; |
| 3120 | if (spec->multiout.hp_nid == nid) |
| 3121 | return 0; |
| 3122 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) |
| 3123 | if (spec->multiout.extra_out_nid[i] == nid) |
| 3124 | return 0; |
| 3125 | return 1; |
| 3126 | } |
| 3127 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3128 | /* add playback controls from the parsed DAC table */ |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3129 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3130 | const struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3131 | { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3132 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3133 | static const char *chname[4] = { |
| 3134 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3135 | }; |
Matthew Ranostay | d21995e | 2008-10-13 13:22:45 -0400 | [diff] [blame] | 3136 | hda_nid_t nid = 0; |
Takashi Iwai | 9158923 | 2008-12-19 15:59:40 +0100 | [diff] [blame] | 3137 | int i, err; |
| 3138 | unsigned int wid_caps; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3139 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3140 | for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3141 | nid = spec->multiout.dac_nids[i]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3142 | if (i == 2) { |
| 3143 | /* Center/LFE */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3144 | err = create_controls(codec, "Center", nid, 1); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3145 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3146 | return err; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3147 | err = create_controls(codec, "LFE", nid, 2); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3148 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3149 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3150 | |
| 3151 | wid_caps = get_wcaps(codec, nid); |
| 3152 | |
| 3153 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 3154 | err = stac92xx_add_control(spec, |
| 3155 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 3156 | "Swap Center/LFE Playback Switch", nid); |
| 3157 | |
| 3158 | if (err < 0) |
| 3159 | return err; |
| 3160 | } |
| 3161 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3162 | } else { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3163 | const char *name = chname[i]; |
| 3164 | /* if it's a single DAC, assign a better name */ |
| 3165 | if (!i && is_unique_dac(spec, nid)) { |
| 3166 | switch (cfg->line_out_type) { |
| 3167 | case AUTO_PIN_HP_OUT: |
| 3168 | name = "Headphone"; |
| 3169 | break; |
| 3170 | case AUTO_PIN_SPEAKER_OUT: |
| 3171 | name = "Speaker"; |
| 3172 | break; |
| 3173 | } |
| 3174 | } |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3175 | err = create_controls(codec, name, nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3176 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3177 | return err; |
| 3178 | } |
| 3179 | } |
| 3180 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 3181 | 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] | 3182 | err = stac92xx_add_control(spec, |
| 3183 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 3184 | "Headphone as Line Out Switch", |
| 3185 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3186 | if (err < 0) |
| 3187 | return err; |
| 3188 | } |
| 3189 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3190 | if (spec->line_switch) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3191 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, |
| 3192 | "Line In as Output Switch", |
| 3193 | spec->line_switch << 8); |
| 3194 | if (err < 0) |
| 3195 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3196 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3197 | |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3198 | if (spec->mic_switch) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3199 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, |
| 3200 | "Mic as Output Switch", |
| 3201 | (spec->mic_switch << 8) | 1); |
| 3202 | if (err < 0) |
| 3203 | return err; |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3204 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3205 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3206 | return 0; |
| 3207 | } |
| 3208 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3209 | /* add playback controls for Speaker and HP outputs */ |
| 3210 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3211 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3212 | { |
| 3213 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3214 | hda_nid_t nid; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3215 | int i, err, nums; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3216 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3217 | nums = 0; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3218 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3219 | static const char *pfxs[] = { |
| 3220 | "Headphone", "Headphone2", "Headphone3", |
| 3221 | }; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3222 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); |
| 3223 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 3224 | spec->hp_detect = 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3225 | if (nums >= ARRAY_SIZE(pfxs)) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3226 | continue; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3227 | nid = spec->hp_dacs[i]; |
| 3228 | if (!nid) |
| 3229 | continue; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3230 | err = create_controls(codec, pfxs[nums++], nid, 3); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3231 | if (err < 0) |
| 3232 | return err; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3233 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3234 | nums = 0; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3235 | for (i = 0; i < cfg->speaker_outs; i++) { |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3236 | static const char *pfxs[] = { |
| 3237 | "Speaker", "External Speaker", "Speaker2", |
| 3238 | }; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3239 | if (nums >= ARRAY_SIZE(pfxs)) |
| 3240 | continue; |
| 3241 | nid = spec->speaker_dacs[i]; |
| 3242 | if (!nid) |
| 3243 | continue; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3244 | err = create_controls(codec, pfxs[nums++], nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3245 | if (err < 0) |
| 3246 | return err; |
| 3247 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3248 | return 0; |
| 3249 | } |
| 3250 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3251 | /* labels for mono mux outputs */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3252 | static const char *stac92xx_mono_labels[4] = { |
| 3253 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3254 | }; |
| 3255 | |
| 3256 | /* create mono mux for mono out on capable codecs */ |
| 3257 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3258 | { |
| 3259 | struct sigmatel_spec *spec = codec->spec; |
| 3260 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3261 | int i, num_cons; |
| 3262 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3263 | |
| 3264 | num_cons = snd_hda_get_connections(codec, |
| 3265 | spec->mono_nid, |
| 3266 | con_lst, |
| 3267 | HDA_MAX_NUM_INPUTS); |
| 3268 | if (!num_cons || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
| 3269 | return -EINVAL; |
| 3270 | |
| 3271 | for (i = 0; i < num_cons; i++) { |
| 3272 | mono_mux->items[mono_mux->num_items].label = |
| 3273 | stac92xx_mono_labels[i]; |
| 3274 | mono_mux->items[mono_mux->num_items].index = i; |
| 3275 | mono_mux->num_items++; |
| 3276 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3277 | |
| 3278 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3279 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3280 | } |
| 3281 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3282 | /* labels for amp mux outputs */ |
| 3283 | static const char *stac92xx_amp_labels[3] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 3284 | "Front Microphone", "Microphone", "Line In", |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3285 | }; |
| 3286 | |
| 3287 | /* create amp out controls mux on capable codecs */ |
| 3288 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) |
| 3289 | { |
| 3290 | struct sigmatel_spec *spec = codec->spec; |
| 3291 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; |
| 3292 | int i, err; |
| 3293 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3294 | for (i = 0; i < spec->num_amps; i++) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3295 | amp_mux->items[amp_mux->num_items].label = |
| 3296 | stac92xx_amp_labels[i]; |
| 3297 | amp_mux->items[amp_mux->num_items].index = i; |
| 3298 | amp_mux->num_items++; |
| 3299 | } |
| 3300 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3301 | if (spec->num_amps > 1) { |
| 3302 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, |
| 3303 | "Amp Selector Capture Switch", 0); |
| 3304 | if (err < 0) |
| 3305 | return err; |
| 3306 | } |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3307 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, |
| 3308 | "Amp Capture Volume", |
| 3309 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); |
| 3310 | } |
| 3311 | |
| 3312 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3313 | /* create PC beep volume controls */ |
| 3314 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3315 | hda_nid_t nid) |
| 3316 | { |
| 3317 | struct sigmatel_spec *spec = codec->spec; |
| 3318 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3319 | int err; |
| 3320 | |
| 3321 | /* check for mute support for the the amp */ |
| 3322 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
| 3323 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3324 | "PC Beep Playback Switch", |
| 3325 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3326 | if (err < 0) |
| 3327 | return err; |
| 3328 | } |
| 3329 | |
| 3330 | /* check to see if there is volume support for the amp */ |
| 3331 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3332 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
| 3333 | "PC Beep Playback Volume", |
| 3334 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3335 | if (err < 0) |
| 3336 | return err; |
| 3337 | } |
| 3338 | return 0; |
| 3339 | } |
| 3340 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3341 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3342 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3343 | |
| 3344 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3345 | struct snd_ctl_elem_value *ucontrol) |
| 3346 | { |
| 3347 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3348 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3349 | return 0; |
| 3350 | } |
| 3351 | |
| 3352 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3353 | struct snd_ctl_elem_value *ucontrol) |
| 3354 | { |
| 3355 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3356 | int enabled = !!ucontrol->value.integer.value[0]; |
| 3357 | if (codec->beep->enabled != enabled) { |
| 3358 | codec->beep->enabled = enabled; |
| 3359 | return 1; |
| 3360 | } |
| 3361 | return 0; |
| 3362 | } |
| 3363 | |
| 3364 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
| 3365 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3366 | .info = stac92xx_dig_beep_switch_info, |
| 3367 | .get = stac92xx_dig_beep_switch_get, |
| 3368 | .put = stac92xx_dig_beep_switch_put, |
| 3369 | }; |
| 3370 | |
| 3371 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3372 | { |
| 3373 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
| 3374 | 0, "PC Beep Playback Switch", 0); |
| 3375 | } |
| 3376 | #endif |
| 3377 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3378 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3379 | { |
| 3380 | struct sigmatel_spec *spec = codec->spec; |
| 3381 | int wcaps, nid, i, err = 0; |
| 3382 | |
| 3383 | for (i = 0; i < spec->num_muxes; i++) { |
| 3384 | nid = spec->mux_nids[i]; |
| 3385 | wcaps = get_wcaps(codec, nid); |
| 3386 | |
| 3387 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 3388 | err = stac92xx_add_control_idx(spec, |
| 3389 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", |
| 3390 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3391 | if (err < 0) |
| 3392 | return err; |
| 3393 | } |
| 3394 | } |
| 3395 | return 0; |
| 3396 | }; |
| 3397 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3398 | static const char *stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3399 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3400 | }; |
| 3401 | |
| 3402 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3403 | { |
| 3404 | struct sigmatel_spec *spec = codec->spec; |
| 3405 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3406 | const char **labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3407 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3408 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3409 | |
| 3410 | num_cons = snd_hda_get_connections(codec, |
| 3411 | spec->smux_nids[0], |
| 3412 | con_lst, |
| 3413 | HDA_MAX_NUM_INPUTS); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3414 | if (!num_cons) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3415 | return -EINVAL; |
| 3416 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3417 | if (!labels) |
| 3418 | labels = stac92xx_spdif_labels; |
| 3419 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3420 | for (i = 0; i < num_cons; i++) { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3421 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3422 | spdif_mux->items[spdif_mux->num_items].index = i; |
| 3423 | spdif_mux->num_items++; |
| 3424 | } |
| 3425 | |
| 3426 | return 0; |
| 3427 | } |
| 3428 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3429 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 3430 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3431 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3432 | "Digital Mic 3", "Digital Mic 4" |
| 3433 | }; |
| 3434 | |
| 3435 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3436 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3437 | const struct auto_pin_cfg *cfg) |
| 3438 | { |
| 3439 | struct sigmatel_spec *spec = codec->spec; |
| 3440 | struct hda_input_mux *dimux = &spec->private_dimux; |
| 3441 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3442 | int err, i, j; |
| 3443 | char name[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3444 | |
| 3445 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 3446 | dimux->items[dimux->num_items].index = 0; |
| 3447 | dimux->num_items++; |
| 3448 | |
| 3449 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3450 | hda_nid_t nid; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3451 | int index; |
| 3452 | int num_cons; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3453 | unsigned int wcaps; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3454 | unsigned int def_conf; |
| 3455 | |
| 3456 | def_conf = snd_hda_codec_read(codec, |
| 3457 | spec->dmic_nids[i], |
| 3458 | 0, |
| 3459 | AC_VERB_GET_CONFIG_DEFAULT, |
| 3460 | 0); |
| 3461 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3462 | continue; |
| 3463 | |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3464 | nid = spec->dmic_nids[i]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3465 | num_cons = snd_hda_get_connections(codec, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 3466 | spec->dmux_nids[0], |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3467 | con_lst, |
| 3468 | HDA_MAX_NUM_INPUTS); |
| 3469 | for (j = 0; j < num_cons; j++) |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3470 | if (con_lst[j] == nid) { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3471 | index = j; |
| 3472 | goto found; |
| 3473 | } |
| 3474 | continue; |
| 3475 | found: |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3476 | wcaps = get_wcaps(codec, nid) & |
| 3477 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3478 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3479 | if (wcaps) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3480 | sprintf(name, "%s Capture Volume", |
| 3481 | stac92xx_dmic_labels[dimux->num_items]); |
| 3482 | |
| 3483 | err = stac92xx_add_control(spec, |
| 3484 | STAC_CTL_WIDGET_VOL, |
| 3485 | name, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3486 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3487 | (wcaps & AC_WCAP_OUT_AMP) ? |
| 3488 | HDA_OUTPUT : HDA_INPUT)); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3489 | if (err < 0) |
| 3490 | return err; |
| 3491 | } |
| 3492 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3493 | dimux->items[dimux->num_items].label = |
| 3494 | stac92xx_dmic_labels[dimux->num_items]; |
| 3495 | dimux->items[dimux->num_items].index = index; |
| 3496 | dimux->num_items++; |
| 3497 | } |
| 3498 | |
| 3499 | return 0; |
| 3500 | } |
| 3501 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3502 | /* create playback/capture controls for input pins */ |
| 3503 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3504 | { |
| 3505 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3506 | struct hda_input_mux *imux = &spec->private_imux; |
| 3507 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 3508 | int i, j, k; |
| 3509 | |
| 3510 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3511 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3512 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3513 | if (!cfg->input_pins[i]) |
| 3514 | continue; |
| 3515 | index = -1; |
| 3516 | for (j = 0; j < spec->num_muxes; j++) { |
| 3517 | int num_cons; |
| 3518 | num_cons = snd_hda_get_connections(codec, |
| 3519 | spec->mux_nids[j], |
| 3520 | con_lst, |
| 3521 | HDA_MAX_NUM_INPUTS); |
| 3522 | for (k = 0; k < num_cons; k++) |
| 3523 | if (con_lst[k] == cfg->input_pins[i]) { |
| 3524 | index = k; |
| 3525 | goto found; |
| 3526 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3527 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3528 | continue; |
| 3529 | found: |
| 3530 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 3531 | imux->items[imux->num_items].index = index; |
| 3532 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3533 | } |
| 3534 | |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3535 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3536 | /* |
| 3537 | * Set the current input for the muxes. |
| 3538 | * The STAC9221 has two input muxes with identical source |
| 3539 | * NID lists. Hopefully this won't get confused. |
| 3540 | */ |
| 3541 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3542 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3543 | AC_VERB_SET_CONNECT_SEL, |
| 3544 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3545 | } |
| 3546 | } |
| 3547 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3548 | return 0; |
| 3549 | } |
| 3550 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3551 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3552 | { |
| 3553 | struct sigmatel_spec *spec = codec->spec; |
| 3554 | int i; |
| 3555 | |
| 3556 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3557 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3558 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3559 | } |
| 3560 | } |
| 3561 | |
| 3562 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3563 | { |
| 3564 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3565 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3566 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3567 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3568 | hda_nid_t pin; |
| 3569 | pin = spec->autocfg.hp_pins[i]; |
| 3570 | if (pin) /* connect to front */ |
| 3571 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3572 | } |
| 3573 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3574 | hda_nid_t pin; |
| 3575 | pin = spec->autocfg.speaker_pins[i]; |
| 3576 | if (pin) /* connect to front */ |
| 3577 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3578 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3579 | } |
| 3580 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3581 | 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] | 3582 | { |
| 3583 | struct sigmatel_spec *spec = codec->spec; |
| 3584 | int err; |
| 3585 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3586 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3587 | &spec->autocfg, |
| 3588 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3589 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3590 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3591 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3592 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3593 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3594 | * be set up as multi-channel outputs. |
| 3595 | */ |
| 3596 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && |
| 3597 | spec->autocfg.hp_outs > 1) { |
| 3598 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3599 | * speaker_outs so that the following routines can handle |
| 3600 | * HP pins as primary outputs. |
| 3601 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3602 | snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3603 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3604 | sizeof(spec->autocfg.line_out_pins)); |
| 3605 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3606 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3607 | sizeof(spec->autocfg.hp_pins)); |
| 3608 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3609 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3610 | spec->autocfg.hp_outs = 0; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3611 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3612 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3613 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3614 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3615 | u32 caps = query_amp_caps(codec, |
| 3616 | spec->autocfg.mono_out_pin, dir); |
| 3617 | hda_nid_t conn_list[1]; |
| 3618 | |
| 3619 | /* get the mixer node and then the mono mux if it exists */ |
| 3620 | if (snd_hda_get_connections(codec, |
| 3621 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3622 | snd_hda_get_connections(codec, conn_list[0], |
| 3623 | conn_list, 1)) { |
| 3624 | |
| 3625 | int wcaps = get_wcaps(codec, conn_list[0]); |
| 3626 | int wid_type = (wcaps & AC_WCAP_TYPE) |
| 3627 | >> AC_WCAP_TYPE_SHIFT; |
| 3628 | /* LR swap check, some stac925x have a mux that |
| 3629 | * changes the DACs output path instead of the |
| 3630 | * mono-mux path. |
| 3631 | */ |
| 3632 | if (wid_type == AC_WID_AUD_SEL && |
| 3633 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3634 | spec->mono_nid = conn_list[0]; |
| 3635 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3636 | if (dir) { |
| 3637 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3638 | |
| 3639 | /* most mono outs have a least a mute/unmute switch */ |
| 3640 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3641 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3642 | "Mono Playback Switch", |
| 3643 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3644 | if (err < 0) |
| 3645 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3646 | /* check for volume support for the amp */ |
| 3647 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3648 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3649 | err = stac92xx_add_control(spec, |
| 3650 | STAC_CTL_WIDGET_VOL, |
| 3651 | "Mono Playback Volume", |
| 3652 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3653 | if (err < 0) |
| 3654 | return err; |
| 3655 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3656 | } |
| 3657 | |
| 3658 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3659 | AC_PINCTL_OUT_EN); |
| 3660 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3661 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3662 | if (!spec->multiout.num_dacs) { |
| 3663 | err = stac92xx_auto_fill_dac_nids(codec); |
| 3664 | if (err < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3665 | return err; |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 3666 | err = stac92xx_auto_create_multi_out_ctls(codec, |
| 3667 | &spec->autocfg); |
| 3668 | if (err < 0) |
| 3669 | return err; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3670 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3671 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3672 | /* setup analog beep controls */ |
| 3673 | if (spec->anabeep_nid > 0) { |
| 3674 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3675 | spec->anabeep_nid); |
| 3676 | if (err < 0) |
| 3677 | return err; |
| 3678 | } |
| 3679 | |
| 3680 | /* setup digital beep controls and input device */ |
| 3681 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3682 | if (spec->digbeep_nid > 0) { |
| 3683 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3684 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3685 | |
| 3686 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3687 | if (err < 0) |
| 3688 | return err; |
| 3689 | err = snd_hda_attach_beep_device(codec, nid); |
| 3690 | if (err < 0) |
| 3691 | return err; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3692 | /* if no beep switch is available, make its own one */ |
| 3693 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3694 | if (codec->beep && |
| 3695 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { |
| 3696 | err = stac92xx_beep_switch_ctl(codec); |
| 3697 | if (err < 0) |
| 3698 | return err; |
| 3699 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3700 | } |
| 3701 | #endif |
| 3702 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3703 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
| 3704 | |
| 3705 | if (err < 0) |
| 3706 | return err; |
| 3707 | |
| 3708 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
| 3709 | |
| 3710 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3711 | return err; |
| 3712 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3713 | if (spec->mono_nid > 0) { |
| 3714 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3715 | if (err < 0) |
| 3716 | return err; |
| 3717 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3718 | if (spec->num_amps > 0) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3719 | err = stac92xx_auto_create_amp_output_ctls(codec); |
| 3720 | if (err < 0) |
| 3721 | return err; |
| 3722 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3723 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3724 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3725 | &spec->autocfg)) < 0) |
| 3726 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3727 | if (spec->num_muxes > 0) { |
| 3728 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3729 | if (err < 0) |
| 3730 | return err; |
| 3731 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3732 | if (spec->num_smuxes > 0) { |
| 3733 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3734 | if (err < 0) |
| 3735 | return err; |
| 3736 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3737 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3738 | err = stac92xx_add_input_source(spec); |
| 3739 | if (err < 0) |
| 3740 | return err; |
| 3741 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3742 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3743 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3744 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3745 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3746 | if (spec->autocfg.dig_out_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3747 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3748 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3749 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3750 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3751 | if (spec->kctls.list) |
| 3752 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3753 | |
| 3754 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | f8ccbf6 | 2008-12-20 17:36:28 -0500 | [diff] [blame] | 3755 | if (!spec->dinput_mux) |
| 3756 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3757 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3758 | spec->mono_mux = &spec->private_mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3759 | spec->amp_mux = &spec->private_amp_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3760 | return 1; |
| 3761 | } |
| 3762 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3763 | /* add playback controls for HP output */ |
| 3764 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 3765 | struct auto_pin_cfg *cfg) |
| 3766 | { |
| 3767 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3768 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3769 | unsigned int wid_caps; |
| 3770 | |
| 3771 | if (! pin) |
| 3772 | return 0; |
| 3773 | |
| 3774 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 3775 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3776 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3777 | |
| 3778 | return 0; |
| 3779 | } |
| 3780 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3781 | /* add playback controls for LFE output */ |
| 3782 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 3783 | struct auto_pin_cfg *cfg) |
| 3784 | { |
| 3785 | struct sigmatel_spec *spec = codec->spec; |
| 3786 | int err; |
| 3787 | hda_nid_t lfe_pin = 0x0; |
| 3788 | int i; |
| 3789 | |
| 3790 | /* |
| 3791 | * search speaker outs and line outs for a mono speaker pin |
| 3792 | * with an amp. If one is found, add LFE controls |
| 3793 | * for it. |
| 3794 | */ |
| 3795 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 3796 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3797 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3798 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3799 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3800 | /* found a mono speaker with an amp, must be lfe */ |
| 3801 | lfe_pin = pin; |
| 3802 | } |
| 3803 | |
| 3804 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 3805 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 3806 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 3807 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3808 | unsigned int defcfg; |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 3809 | defcfg = snd_hda_codec_read(codec, pin, 0, |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3810 | AC_VERB_GET_CONFIG_DEFAULT, |
| 3811 | 0x00); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 3812 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 3813 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3814 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 3815 | if (wcaps == AC_WCAP_OUT_AMP) |
| 3816 | /* found a mono speaker with an amp, |
| 3817 | must be lfe */ |
| 3818 | lfe_pin = pin; |
| 3819 | } |
| 3820 | } |
| 3821 | } |
| 3822 | |
| 3823 | if (lfe_pin) { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3824 | err = create_controls(codec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3825 | if (err < 0) |
| 3826 | return err; |
| 3827 | } |
| 3828 | |
| 3829 | return 0; |
| 3830 | } |
| 3831 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3832 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 3833 | { |
| 3834 | struct sigmatel_spec *spec = codec->spec; |
| 3835 | int err; |
| 3836 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3837 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3838 | return err; |
| 3839 | |
| 3840 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 3841 | return err; |
| 3842 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3843 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 3844 | return err; |
| 3845 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 3846 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 3847 | return err; |
| 3848 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 3849 | if (spec->num_muxes > 0) { |
| 3850 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3851 | if (err < 0) |
| 3852 | return err; |
| 3853 | } |
| 3854 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3855 | err = stac92xx_add_input_source(spec); |
| 3856 | if (err < 0) |
| 3857 | return err; |
| 3858 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3859 | if (spec->autocfg.dig_out_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3860 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3861 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3862 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3863 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3864 | if (spec->kctls.list) |
| 3865 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3866 | |
| 3867 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3868 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3869 | |
| 3870 | return 1; |
| 3871 | } |
| 3872 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3873 | /* |
| 3874 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 3875 | * funky external mute control using GPIO pins. |
| 3876 | */ |
| 3877 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3878 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3879 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3880 | { |
| 3881 | unsigned int gpiostate, gpiomask, gpiodir; |
| 3882 | |
| 3883 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 3884 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3885 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3886 | |
| 3887 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 3888 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3889 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3890 | |
| 3891 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 3892 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 3893 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3894 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3895 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3896 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 3897 | |
| 3898 | snd_hda_codec_write(codec, codec->afg, 0, |
| 3899 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3900 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3901 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3902 | |
| 3903 | msleep(1); |
| 3904 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 3905 | snd_hda_codec_read(codec, codec->afg, 0, |
| 3906 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3907 | } |
| 3908 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3909 | static int stac92xx_add_jack(struct hda_codec *codec, |
| 3910 | hda_nid_t nid, int type) |
| 3911 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3912 | #ifdef CONFIG_SND_JACK |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3913 | struct sigmatel_spec *spec = codec->spec; |
| 3914 | struct sigmatel_jack *jack; |
| 3915 | int def_conf = snd_hda_codec_read(codec, nid, |
| 3916 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 3917 | int connectivity = get_defcfg_connect(def_conf); |
| 3918 | char name[32]; |
| 3919 | |
| 3920 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
| 3921 | return 0; |
| 3922 | |
| 3923 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 3924 | jack = snd_array_new(&spec->jacks); |
| 3925 | if (!jack) |
| 3926 | return -ENOMEM; |
| 3927 | jack->nid = nid; |
| 3928 | jack->type = type; |
| 3929 | |
| 3930 | sprintf(name, "%s at %s %s Jack", |
| 3931 | snd_hda_get_jack_type(def_conf), |
| 3932 | snd_hda_get_jack_connectivity(def_conf), |
| 3933 | snd_hda_get_jack_location(def_conf)); |
| 3934 | |
| 3935 | return snd_jack_new(codec->bus->card, name, type, &jack->jack); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 3936 | #else |
| 3937 | return 0; |
| 3938 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3939 | } |
| 3940 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3941 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, |
| 3942 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3943 | { |
| 3944 | struct sigmatel_event *event; |
| 3945 | |
| 3946 | snd_array_init(&spec->events, sizeof(*event), 32); |
| 3947 | event = snd_array_new(&spec->events); |
| 3948 | if (!event) |
| 3949 | return -ENOMEM; |
| 3950 | event->nid = nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3951 | event->type = type; |
| 3952 | event->tag = spec->events.used; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3953 | event->data = data; |
| 3954 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3955 | return event->tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3956 | } |
| 3957 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3958 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, |
| 3959 | hda_nid_t nid, unsigned char type) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3960 | { |
| 3961 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3962 | struct sigmatel_event *event = spec->events.list; |
| 3963 | int i; |
| 3964 | |
| 3965 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3966 | if (event->nid == nid && event->type == type) |
| 3967 | return event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3968 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3969 | return NULL; |
| 3970 | } |
| 3971 | |
| 3972 | static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, |
| 3973 | unsigned char tag) |
| 3974 | { |
| 3975 | struct sigmatel_spec *spec = codec->spec; |
| 3976 | struct sigmatel_event *event = spec->events.list; |
| 3977 | int i; |
| 3978 | |
| 3979 | for (i = 0; i < spec->events.used; i++, event++) { |
| 3980 | if (event->tag == tag) |
| 3981 | return event; |
| 3982 | } |
| 3983 | return NULL; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 3984 | } |
| 3985 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3986 | 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] | 3987 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3988 | { |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 3989 | struct sigmatel_event *event; |
| 3990 | int tag; |
| 3991 | |
| 3992 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
| 3993 | return; |
| 3994 | event = stac_get_event(codec, nid, type); |
| 3995 | if (event) |
| 3996 | tag = event->tag; |
| 3997 | else |
| 3998 | tag = stac_add_event(codec->spec, nid, type, 0); |
| 3999 | if (tag < 0) |
| 4000 | return; |
| 4001 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4002 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 4003 | AC_USRSP_EN | tag); |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4004 | } |
| 4005 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4006 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
| 4007 | { |
| 4008 | int i; |
| 4009 | for (i = 0; i < cfg->hp_outs; i++) |
| 4010 | if (cfg->hp_pins[i] == nid) |
| 4011 | return 1; /* nid is a HP-Out */ |
| 4012 | |
| 4013 | return 0; /* nid is not a HP-Out */ |
| 4014 | }; |
| 4015 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4016 | static void stac92xx_power_down(struct hda_codec *codec) |
| 4017 | { |
| 4018 | struct sigmatel_spec *spec = codec->spec; |
| 4019 | |
| 4020 | /* power down inactive DACs */ |
| 4021 | hda_nid_t *dac; |
| 4022 | for (dac = spec->dac_list; *dac; dac++) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4023 | if (!check_all_dac_nids(spec, *dac)) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4024 | snd_hda_codec_write(codec, *dac, 0, |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4025 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 4026 | } |
| 4027 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4028 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4029 | int enable); |
| 4030 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4031 | static int stac92xx_init(struct hda_codec *codec) |
| 4032 | { |
| 4033 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4034 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4035 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4036 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4037 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4038 | snd_hda_sequence_write(codec, spec->init); |
| 4039 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4040 | /* power down adcs initially */ |
| 4041 | if (spec->powerdown_adcs) |
| 4042 | for (i = 0; i < spec->num_adcs; i++) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4043 | snd_hda_codec_write(codec, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4044 | spec->adc_nids[i], 0, |
| 4045 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4046 | |
| 4047 | /* set up GPIO */ |
| 4048 | gpio = spec->gpio_data; |
| 4049 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 4050 | * otherwise, unsol event will turn it on/off dynamically |
| 4051 | */ |
| 4052 | if (!spec->eapd_switch) |
| 4053 | gpio |= spec->eapd_mask; |
| 4054 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 4055 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4056 | /* set up pins */ |
| 4057 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4058 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4059 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4060 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4061 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4062 | } |
Takashi Iwai | 0a07acaf | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 4063 | /* force to enable the first line-out; the others are set up |
| 4064 | * in unsol_event |
| 4065 | */ |
| 4066 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4067 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4068 | /* fake event to set up pins */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4069 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 4070 | STAC_HP_EVENT); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4071 | } else { |
| 4072 | stac92xx_auto_init_multi_out(codec); |
| 4073 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4074 | for (i = 0; i < cfg->hp_outs; i++) |
| 4075 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4076 | } |
| 4077 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4078 | hda_nid_t nid = cfg->input_pins[i]; |
| 4079 | if (nid) { |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4080 | unsigned int pinctl, conf; |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4081 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
| 4082 | /* for mic pins, force to initialize */ |
| 4083 | pinctl = stac92xx_get_vref(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4084 | pinctl |= AC_PINCTL_IN_EN; |
| 4085 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4086 | } else { |
| 4087 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4088 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4089 | /* if PINCTL already set then skip */ |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4090 | if (!(pinctl & AC_PINCTL_IN_EN)) { |
| 4091 | pinctl |= AC_PINCTL_IN_EN; |
| 4092 | stac92xx_auto_set_pinctl(codec, nid, |
| 4093 | pinctl); |
| 4094 | } |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4095 | } |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4096 | conf = snd_hda_codec_read(codec, nid, 0, |
| 4097 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 4098 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
| 4099 | enable_pin_detect(codec, nid, |
| 4100 | STAC_INSERT_EVENT); |
| 4101 | stac_issue_unsol_event(codec, nid, |
| 4102 | STAC_INSERT_EVENT); |
| 4103 | } |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4104 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4105 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4106 | for (i = 0; i < spec->num_dmics; i++) |
| 4107 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 4108 | AC_PINCTL_IN_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4109 | if (cfg->dig_out_pin) |
| 4110 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, |
| 4111 | AC_PINCTL_OUT_EN); |
| 4112 | if (cfg->dig_in_pin) |
| 4113 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 4114 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4115 | for (i = 0; i < spec->num_pwrs; i++) { |
| 4116 | hda_nid_t nid = spec->pwr_nids[i]; |
| 4117 | int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4118 | |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4119 | /* power on when no jack detection is available */ |
| 4120 | if (!spec->hp_detect) { |
| 4121 | stac_toggle_power_map(codec, nid, 1); |
| 4122 | continue; |
| 4123 | } |
| 4124 | |
| 4125 | if (is_nid_hp_pin(cfg, nid)) |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4126 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4127 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4128 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4129 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4130 | /* outputs are only ports capable of power management |
| 4131 | * any attempts on powering down a input port cause the |
| 4132 | * referenced VREF to act quirky. |
| 4133 | */ |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4134 | if (pinctl & AC_PINCTL_IN_EN) { |
| 4135 | stac_toggle_power_map(codec, nid, 1); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4136 | continue; |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4137 | } |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4138 | def_conf = snd_hda_codec_read(codec, nid, 0, |
| 4139 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 4140 | def_conf = get_defcfg_connect(def_conf); |
| 4141 | /* skip any ports that don't have jacks since presence |
| 4142 | * detection is useless */ |
| 4143 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
| 4144 | if (def_conf != AC_JACK_PORT_NONE) |
| 4145 | stac_toggle_power_map(codec, nid, 1); |
| 4146 | continue; |
| 4147 | } |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4148 | if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { |
| 4149 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); |
| 4150 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); |
| 4151 | } |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4152 | } |
| 4153 | if (spec->dac_list) |
| 4154 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4155 | return 0; |
| 4156 | } |
| 4157 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4158 | static void stac92xx_free_jacks(struct hda_codec *codec) |
| 4159 | { |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4160 | #ifdef CONFIG_SND_JACK |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4161 | /* free jack instances manually when clearing/reconfiguring */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4162 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | b94d3539 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4163 | if (!codec->bus->shutdown && spec->jacks.list) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4164 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4165 | int i; |
| 4166 | for (i = 0; i < spec->jacks.used; i++) |
| 4167 | snd_device_free(codec->bus->card, &jacks[i].jack); |
| 4168 | } |
| 4169 | snd_array_free(&spec->jacks); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4170 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4171 | } |
| 4172 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4173 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 4174 | { |
| 4175 | struct sigmatel_spec *spec = codec->spec; |
| 4176 | |
| 4177 | if (spec->kctls.list) { |
| 4178 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4179 | int i; |
| 4180 | for (i = 0; i < spec->kctls.used; i++) |
| 4181 | kfree(kctl[i].name); |
| 4182 | } |
| 4183 | snd_array_free(&spec->kctls); |
| 4184 | } |
| 4185 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4186 | static void stac92xx_free(struct hda_codec *codec) |
| 4187 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4188 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4189 | |
| 4190 | if (! spec) |
| 4191 | return; |
| 4192 | |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4193 | kfree(spec->pin_configs); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4194 | stac92xx_free_jacks(codec); |
| 4195 | snd_array_free(&spec->events); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4196 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4197 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4198 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4199 | } |
| 4200 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4201 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4202 | unsigned int flag) |
| 4203 | { |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4204 | unsigned int old_ctl, pin_ctl; |
| 4205 | |
| 4206 | pin_ctl = snd_hda_codec_read(codec, nid, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4207 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4208 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4209 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4210 | /* |
| 4211 | * we need to check the current set-up direction of |
| 4212 | * shared input pins since they can be switched via |
| 4213 | * "xxx as Output" mixer switch |
| 4214 | */ |
| 4215 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4216 | if (nid == spec->line_switch || nid == spec->mic_switch) |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4217 | return; |
| 4218 | } |
| 4219 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4220 | old_ctl = pin_ctl; |
Steve Longerbeam | 7b043899 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4221 | /* if setting pin direction bits, clear the current |
| 4222 | direction bits first */ |
| 4223 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4224 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4225 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4226 | pin_ctl |= flag; |
| 4227 | if (old_ctl != pin_ctl) |
| 4228 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4229 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4230 | pin_ctl); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4231 | } |
| 4232 | |
| 4233 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4234 | unsigned int flag) |
| 4235 | { |
| 4236 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4237 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4238 | if (pin_ctl & flag) |
| 4239 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4240 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4241 | pin_ctl & ~flag); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4242 | } |
| 4243 | |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4244 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4245 | { |
| 4246 | if (!nid) |
| 4247 | return 0; |
| 4248 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4249 | & (1 << 31)) |
| 4250 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4251 | return 0; |
| 4252 | } |
| 4253 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4254 | /* return non-zero if the hp-pin of the given array index isn't |
| 4255 | * a jack-detection target |
| 4256 | */ |
| 4257 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4258 | { |
| 4259 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4260 | |
| 4261 | /* ignore sensing of shared line and mic jacks */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4262 | if (cfg->hp_pins[i] == spec->line_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4263 | return 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4264 | if (cfg->hp_pins[i] == spec->mic_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4265 | return 1; |
| 4266 | /* ignore if the pin is set as line-out */ |
| 4267 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4268 | return 1; |
| 4269 | return 0; |
| 4270 | } |
| 4271 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4272 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4273 | { |
| 4274 | struct sigmatel_spec *spec = codec->spec; |
| 4275 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4276 | int i, presence; |
| 4277 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4278 | presence = 0; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4279 | if (spec->gpio_mute) |
| 4280 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4281 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4282 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4283 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4284 | if (presence) |
| 4285 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4286 | if (no_hp_sensing(spec, i)) |
| 4287 | continue; |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4288 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 4289 | if (presence) { |
| 4290 | unsigned int pinctl; |
| 4291 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 4292 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4293 | if (pinctl & AC_PINCTL_IN_EN) |
| 4294 | presence = 0; /* mic- or line-input */ |
| 4295 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4296 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4297 | |
| 4298 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4299 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4300 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4301 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4302 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4303 | for (i = 0; i < cfg->line_outs; i++) |
| 4304 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4305 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4306 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4307 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4308 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4309 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4310 | stac_gpio_set(codec, spec->gpio_mask, |
| 4311 | spec->gpio_dir, spec->gpio_data & |
| 4312 | ~spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4313 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4314 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4315 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4316 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4317 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4318 | for (i = 0; i < cfg->line_outs; i++) |
| 4319 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4320 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4321 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4322 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4323 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4324 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4325 | stac_gpio_set(codec, spec->gpio_mask, |
| 4326 | spec->gpio_dir, spec->gpio_data | |
| 4327 | spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4328 | } |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4329 | /* toggle hp outs */ |
| 4330 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4331 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4332 | if (no_hp_sensing(spec, i)) |
| 4333 | continue; |
| 4334 | if (presence) |
| 4335 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4336 | #if 0 /* FIXME */ |
| 4337 | /* Resetting the pinctl like below may lead to (a sort of) regressions |
| 4338 | * on some devices since they use the HP pin actually for line/speaker |
| 4339 | * outs although the default pin config shows a different pin (that is |
| 4340 | * wrong and useless). |
| 4341 | * |
| 4342 | * So, it's basically a problem of default pin configs, likely a BIOS issue. |
| 4343 | * But, disabling the code below just works around it, and I'm too tired of |
| 4344 | * bug reports with such devices... |
| 4345 | */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4346 | else |
| 4347 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4348 | #endif /* FIXME */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4349 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4350 | } |
| 4351 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4352 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4353 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4354 | { |
| 4355 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4356 | unsigned int idx, val; |
| 4357 | |
| 4358 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4359 | if (spec->pwr_nids[idx] == nid) |
| 4360 | break; |
| 4361 | } |
| 4362 | if (idx >= spec->num_pwrs) |
| 4363 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4364 | |
| 4365 | /* several codecs have two power down bits */ |
| 4366 | if (spec->pwr_mapping) |
| 4367 | idx = spec->pwr_mapping[idx]; |
| 4368 | else |
| 4369 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4370 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4371 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
| 4372 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4373 | val &= ~idx; |
| 4374 | else |
| 4375 | val |= idx; |
| 4376 | |
| 4377 | /* power down unused output ports */ |
| 4378 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4379 | } |
| 4380 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4381 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4382 | { |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4383 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4384 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4385 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4386 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 4387 | { |
| 4388 | struct sigmatel_spec *spec = codec->spec; |
| 4389 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4390 | |
| 4391 | if (jacks) { |
| 4392 | int i; |
| 4393 | for (i = 0; i < spec->jacks.used; i++) { |
| 4394 | if (jacks->nid == nid) { |
| 4395 | unsigned int pin_ctl = |
| 4396 | snd_hda_codec_read(codec, nid, |
| 4397 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 4398 | 0x00); |
| 4399 | int type = jacks->type; |
| 4400 | if (type == (SND_JACK_LINEOUT |
| 4401 | | SND_JACK_HEADPHONE)) |
| 4402 | type = (pin_ctl & AC_PINCTL_HP_EN) |
| 4403 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; |
| 4404 | snd_jack_report(jacks->jack, |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4405 | get_pin_presence(codec, nid) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4406 | ? type : 0); |
| 4407 | } |
| 4408 | jacks++; |
| 4409 | } |
| 4410 | } |
| 4411 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4412 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4413 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, |
| 4414 | unsigned char type) |
| 4415 | { |
| 4416 | struct sigmatel_event *event = stac_get_event(codec, nid, type); |
| 4417 | if (!event) |
| 4418 | return; |
| 4419 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); |
| 4420 | } |
| 4421 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4422 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4423 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4424 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4425 | struct sigmatel_event *event; |
| 4426 | int tag, data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4427 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4428 | tag = (res >> 26) & 0x7f; |
| 4429 | event = stac_get_event_from_tag(codec, tag); |
| 4430 | if (!event) |
| 4431 | return; |
| 4432 | |
| 4433 | switch (event->type) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4434 | case STAC_HP_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4435 | stac92xx_hp_detect(codec); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4436 | /* fallthru */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4437 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4438 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4439 | if (spec->num_pwrs > 0) |
| 4440 | stac92xx_pin_sense(codec, event->nid); |
| 4441 | stac92xx_report_jack(codec, event->nid); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4442 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4443 | case STAC_VREF_EVENT: |
| 4444 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4445 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4446 | /* toggle VREF state based on GPIOx status */ |
| 4447 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4448 | !!(data & (1 << event->data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4449 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4450 | } |
| 4451 | } |
| 4452 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4453 | #ifdef CONFIG_PROC_FS |
| 4454 | static void stac92hd_proc_hook(struct snd_info_buffer *buffer, |
| 4455 | struct hda_codec *codec, hda_nid_t nid) |
| 4456 | { |
| 4457 | if (nid == codec->afg) |
| 4458 | snd_iprintf(buffer, "Power-Map: 0x%02x\n", |
| 4459 | snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); |
| 4460 | } |
| 4461 | |
| 4462 | static void analog_loop_proc_hook(struct snd_info_buffer *buffer, |
| 4463 | struct hda_codec *codec, |
| 4464 | unsigned int verb) |
| 4465 | { |
| 4466 | snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", |
| 4467 | snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); |
| 4468 | } |
| 4469 | |
| 4470 | /* stac92hd71bxx, stac92hd73xx */ |
| 4471 | static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, |
| 4472 | struct hda_codec *codec, hda_nid_t nid) |
| 4473 | { |
| 4474 | stac92hd_proc_hook(buffer, codec, nid); |
| 4475 | if (nid == codec->afg) |
| 4476 | analog_loop_proc_hook(buffer, codec, 0xfa0); |
| 4477 | } |
| 4478 | |
| 4479 | static void stac9205_proc_hook(struct snd_info_buffer *buffer, |
| 4480 | struct hda_codec *codec, hda_nid_t nid) |
| 4481 | { |
| 4482 | if (nid == codec->afg) |
| 4483 | analog_loop_proc_hook(buffer, codec, 0xfe0); |
| 4484 | } |
| 4485 | |
| 4486 | static void stac927x_proc_hook(struct snd_info_buffer *buffer, |
| 4487 | struct hda_codec *codec, hda_nid_t nid) |
| 4488 | { |
| 4489 | if (nid == codec->afg) |
| 4490 | analog_loop_proc_hook(buffer, codec, 0xfeb); |
| 4491 | } |
| 4492 | #else |
| 4493 | #define stac92hd_proc_hook NULL |
| 4494 | #define stac92hd7x_proc_hook NULL |
| 4495 | #define stac9205_proc_hook NULL |
| 4496 | #define stac927x_proc_hook NULL |
| 4497 | #endif |
| 4498 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4499 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4500 | static int stac92xx_resume(struct hda_codec *codec) |
| 4501 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4502 | struct sigmatel_spec *spec = codec->spec; |
| 4503 | |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4504 | stac92xx_set_config_regs(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4505 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4506 | snd_hda_codec_resume_amp(codec); |
| 4507 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4508 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4509 | if (spec->hp_detect) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4510 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], |
| 4511 | STAC_HP_EVENT); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4512 | return 0; |
| 4513 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4514 | |
| 4515 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4516 | { |
| 4517 | struct sigmatel_spec *spec = codec->spec; |
| 4518 | if (spec->eapd_mask) |
| 4519 | stac_gpio_set(codec, spec->gpio_mask, |
| 4520 | spec->gpio_dir, spec->gpio_data & |
| 4521 | ~spec->eapd_mask); |
| 4522 | return 0; |
| 4523 | } |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4524 | #endif |
| 4525 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4526 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 4527 | .build_controls = stac92xx_build_controls, |
| 4528 | .build_pcms = stac92xx_build_pcms, |
| 4529 | .init = stac92xx_init, |
| 4530 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4531 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4532 | #ifdef SND_HDA_NEEDS_RESUME |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4533 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4534 | .resume = stac92xx_resume, |
| 4535 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4536 | }; |
| 4537 | |
| 4538 | static int patch_stac9200(struct hda_codec *codec) |
| 4539 | { |
| 4540 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4541 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4542 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4543 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4544 | if (spec == NULL) |
| 4545 | return -ENOMEM; |
| 4546 | |
| 4547 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4548 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4549 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4550 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 4551 | stac9200_models, |
| 4552 | stac9200_cfg_tbl); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4553 | if (spec->board_config < 0) { |
| 4554 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
| 4555 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4556 | } else |
| 4557 | err = stac_save_pin_cfgs(codec, |
| 4558 | stac9200_brd_tbl[spec->board_config]); |
| 4559 | if (err < 0) { |
| 4560 | stac92xx_free(codec); |
| 4561 | return err; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 4562 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4563 | |
| 4564 | spec->multiout.max_channels = 2; |
| 4565 | spec->multiout.num_dacs = 1; |
| 4566 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 4567 | spec->adc_nids = stac9200_adc_nids; |
| 4568 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 4569 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4570 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4571 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4572 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4573 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4574 | if (spec->board_config == STAC_9200_M4 || |
| 4575 | spec->board_config == STAC_9200_M4_2 || |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 4576 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 4577 | spec->init = stac9200_eapd_init; |
| 4578 | else |
| 4579 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4580 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4581 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 4582 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 4583 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 4584 | spec->gpio_data = 0x00; |
| 4585 | } |
| 4586 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4587 | err = stac9200_parse_auto_config(codec); |
| 4588 | if (err < 0) { |
| 4589 | stac92xx_free(codec); |
| 4590 | return err; |
| 4591 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4592 | |
Takashi Iwai | 2acc9dc | 2009-01-09 16:57:14 +0100 | [diff] [blame] | 4593 | /* CF-74 has no headphone detection, and the driver should *NOT* |
| 4594 | * do detection and HP/speaker toggle because the hardware does it. |
| 4595 | */ |
| 4596 | if (spec->board_config == STAC_9200_PANASONIC) |
| 4597 | spec->hp_detect = 0; |
| 4598 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4599 | codec->patch_ops = stac92xx_patch_ops; |
| 4600 | |
| 4601 | return 0; |
| 4602 | } |
| 4603 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4604 | static int patch_stac925x(struct hda_codec *codec) |
| 4605 | { |
| 4606 | struct sigmatel_spec *spec; |
| 4607 | int err; |
| 4608 | |
| 4609 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4610 | if (spec == NULL) |
| 4611 | return -ENOMEM; |
| 4612 | |
| 4613 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4614 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4615 | spec->pin_nids = stac925x_pin_nids; |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4616 | |
| 4617 | /* Check first for codec ID */ |
| 4618 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, |
| 4619 | STAC_925x_MODELS, |
| 4620 | stac925x_models, |
| 4621 | stac925x_codec_id_cfg_tbl); |
| 4622 | |
| 4623 | /* Now checks for PCI ID, if codec ID is not found */ |
| 4624 | if (spec->board_config < 0) |
| 4625 | spec->board_config = snd_hda_check_board_config(codec, |
| 4626 | STAC_925x_MODELS, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4627 | stac925x_models, |
| 4628 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4629 | again: |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4630 | if (spec->board_config < 0) { |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4631 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4632 | "using BIOS defaults\n"); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4633 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4634 | } else |
| 4635 | err = stac_save_pin_cfgs(codec, |
| 4636 | stac925x_brd_tbl[spec->board_config]); |
| 4637 | if (err < 0) { |
| 4638 | stac92xx_free(codec); |
| 4639 | return err; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4640 | } |
| 4641 | |
| 4642 | spec->multiout.max_channels = 2; |
| 4643 | spec->multiout.num_dacs = 1; |
| 4644 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 4645 | spec->adc_nids = stac925x_adc_nids; |
| 4646 | spec->mux_nids = stac925x_mux_nids; |
| 4647 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4648 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4649 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4650 | switch (codec->vendor_id) { |
| 4651 | case 0x83847632: /* STAC9202 */ |
| 4652 | case 0x83847633: /* STAC9202D */ |
| 4653 | case 0x83847636: /* STAC9251 */ |
| 4654 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 4655 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4656 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4657 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 4658 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 4659 | break; |
| 4660 | default: |
| 4661 | spec->num_dmics = 0; |
| 4662 | break; |
| 4663 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4664 | |
| 4665 | spec->init = stac925x_core_init; |
| 4666 | spec->mixer = stac925x_mixer; |
| 4667 | |
| 4668 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 4669 | if (!err) { |
| 4670 | if (spec->board_config < 0) { |
| 4671 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4672 | "available, default to model=ref\n"); |
| 4673 | spec->board_config = STAC_925x_REF; |
| 4674 | goto again; |
| 4675 | } |
| 4676 | err = -EINVAL; |
| 4677 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4678 | if (err < 0) { |
| 4679 | stac92xx_free(codec); |
| 4680 | return err; |
| 4681 | } |
| 4682 | |
| 4683 | codec->patch_ops = stac92xx_patch_ops; |
| 4684 | |
| 4685 | return 0; |
| 4686 | } |
| 4687 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4688 | static struct hda_input_mux stac92hd73xx_dmux = { |
| 4689 | .num_items = 4, |
| 4690 | .items = { |
| 4691 | { "Analog Inputs", 0x0b }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4692 | { "Digital Mic 1", 0x09 }, |
| 4693 | { "Digital Mic 2", 0x0a }, |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4694 | { "CD", 0x08 }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4695 | } |
| 4696 | }; |
| 4697 | |
| 4698 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 4699 | { |
| 4700 | struct sigmatel_spec *spec; |
| 4701 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 4702 | int err = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4703 | int num_dacs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4704 | |
| 4705 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4706 | if (spec == NULL) |
| 4707 | return -ENOMEM; |
| 4708 | |
| 4709 | codec->spec = spec; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 4710 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4711 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 4712 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 4713 | spec->board_config = snd_hda_check_board_config(codec, |
| 4714 | STAC_92HD73XX_MODELS, |
| 4715 | stac92hd73xx_models, |
| 4716 | stac92hd73xx_cfg_tbl); |
| 4717 | again: |
| 4718 | if (spec->board_config < 0) { |
| 4719 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4720 | " STAC92HD73XX, using BIOS defaults\n"); |
| 4721 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4722 | } else |
| 4723 | err = stac_save_pin_cfgs(codec, |
| 4724 | stac92hd73xx_brd_tbl[spec->board_config]); |
| 4725 | if (err < 0) { |
| 4726 | stac92xx_free(codec); |
| 4727 | return err; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4728 | } |
| 4729 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4730 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4731 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 4732 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4733 | if (num_dacs < 3 || num_dacs > 5) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4734 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 4735 | "number of channels defaulting to DAC count\n"); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4736 | num_dacs = STAC92HD73_DAC_COUNT; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4737 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4738 | switch (num_dacs) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4739 | case 0x3: /* 6 Channel */ |
| 4740 | spec->mixer = stac92hd73xx_6ch_mixer; |
| 4741 | spec->init = stac92hd73xx_6ch_core_init; |
| 4742 | break; |
| 4743 | case 0x4: /* 8 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4744 | spec->mixer = stac92hd73xx_8ch_mixer; |
| 4745 | spec->init = stac92hd73xx_8ch_core_init; |
| 4746 | break; |
| 4747 | case 0x5: /* 10 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4748 | spec->mixer = stac92hd73xx_10ch_mixer; |
| 4749 | spec->init = stac92hd73xx_10ch_core_init; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4750 | } |
| 4751 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4752 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4753 | spec->aloopback_mask = 0x01; |
| 4754 | spec->aloopback_shift = 8; |
| 4755 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4756 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4757 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 4758 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 4759 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 4760 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4761 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 4762 | spec->amp_nids = stac92hd73xx_amp_nids; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4763 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4764 | |
| 4765 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 4766 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 4767 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4768 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
| 4769 | sizeof(stac92hd73xx_dmux)); |
| 4770 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4771 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4772 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 4773 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4774 | /* fallthru */ |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4775 | case STAC_DELL_M6_AMIC: |
| 4776 | case STAC_DELL_M6_DMIC: |
| 4777 | case STAC_DELL_M6_BOTH: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4778 | spec->num_smuxes = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4779 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
| 4780 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4781 | spec->eapd_switch = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4782 | spec->num_amps = 1; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4783 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4784 | if (spec->board_config != STAC_DELL_EQ) |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 4785 | spec->init = dell_m6_core_init; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4786 | switch (spec->board_config) { |
| 4787 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4788 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 4789 | spec->num_dmics = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4790 | spec->private_dimux.num_items = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4791 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4792 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4793 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 4794 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4795 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4796 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 4797 | case STAC_DELL_M6_BOTH: /* Both */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4798 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
| 4799 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
| 4800 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4801 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4802 | break; |
| 4803 | } |
| 4804 | break; |
| 4805 | default: |
| 4806 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4807 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4808 | spec->eapd_switch = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4809 | } |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 4810 | if (spec->board_config > STAC_92HD73XX_REF) { |
| 4811 | /* GPIO0 High = Enable EAPD */ |
| 4812 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 4813 | spec->gpio_data = 0x01; |
| 4814 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 4815 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 4816 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4817 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 4818 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 4819 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4820 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4821 | |
| 4822 | if (!err) { |
| 4823 | if (spec->board_config < 0) { |
| 4824 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4825 | "available, default to model=ref\n"); |
| 4826 | spec->board_config = STAC_92HD73XX_REF; |
| 4827 | goto again; |
| 4828 | } |
| 4829 | err = -EINVAL; |
| 4830 | } |
| 4831 | |
| 4832 | if (err < 0) { |
| 4833 | stac92xx_free(codec); |
| 4834 | return err; |
| 4835 | } |
| 4836 | |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 4837 | if (spec->board_config == STAC_92HD73XX_NO_JD) |
| 4838 | spec->hp_detect = 0; |
| 4839 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4840 | codec->patch_ops = stac92xx_patch_ops; |
| 4841 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4842 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 4843 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 4844 | return 0; |
| 4845 | } |
| 4846 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4847 | static struct hda_input_mux stac92hd83xxx_dmux = { |
| 4848 | .num_items = 3, |
| 4849 | .items = { |
| 4850 | { "Analog Inputs", 0x03 }, |
| 4851 | { "Digital Mic 1", 0x04 }, |
| 4852 | { "Digital Mic 2", 0x05 }, |
| 4853 | } |
| 4854 | }; |
| 4855 | |
| 4856 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 4857 | { |
| 4858 | struct sigmatel_spec *spec; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 4859 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4860 | int err; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 4861 | int num_dacs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4862 | |
| 4863 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4864 | if (spec == NULL) |
| 4865 | return -ENOMEM; |
| 4866 | |
| 4867 | codec->spec = spec; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 4868 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4869 | spec->mono_nid = 0x19; |
| 4870 | spec->digbeep_nid = 0x21; |
| 4871 | spec->dmic_nids = stac92hd83xxx_dmic_nids; |
| 4872 | spec->dmux_nids = stac92hd83xxx_dmux_nids; |
| 4873 | spec->adc_nids = stac92hd83xxx_adc_nids; |
| 4874 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 4875 | spec->amp_nids = stac92hd83xxx_amp_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4876 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; |
| 4877 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4878 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4879 | |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 4880 | |
| 4881 | /* set port 0xe to select the last DAC |
| 4882 | */ |
| 4883 | num_dacs = snd_hda_get_connections(codec, 0x0e, |
| 4884 | conn, STAC92HD83_DAC_COUNT + 1) - 1; |
| 4885 | |
| 4886 | snd_hda_codec_write_cache(codec, 0xe, 0, |
| 4887 | AC_VERB_SET_CONNECT_SEL, num_dacs); |
| 4888 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4889 | spec->init = stac92hd83xxx_core_init; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4890 | spec->mixer = stac92hd83xxx_mixer; |
| 4891 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
| 4892 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); |
| 4893 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 4894 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4895 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; |
| 4896 | spec->dinput_mux = &stac92hd83xxx_dmux; |
| 4897 | spec->pin_nids = stac92hd83xxx_pin_nids; |
| 4898 | spec->board_config = snd_hda_check_board_config(codec, |
| 4899 | STAC_92HD83XXX_MODELS, |
| 4900 | stac92hd83xxx_models, |
| 4901 | stac92hd83xxx_cfg_tbl); |
| 4902 | again: |
| 4903 | if (spec->board_config < 0) { |
| 4904 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4905 | " STAC92HD83XXX, using BIOS defaults\n"); |
| 4906 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4907 | } else |
| 4908 | err = stac_save_pin_cfgs(codec, |
| 4909 | stac92hd83xxx_brd_tbl[spec->board_config]); |
| 4910 | if (err < 0) { |
| 4911 | stac92xx_free(codec); |
| 4912 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4913 | } |
| 4914 | |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 4915 | switch (codec->vendor_id) { |
| 4916 | case 0x111d7604: |
| 4917 | case 0x111d7605: |
| 4918 | if (spec->board_config == STAC_92HD83XXX_PWR_REF) |
| 4919 | break; |
| 4920 | spec->num_pwrs = 0; |
| 4921 | break; |
| 4922 | } |
| 4923 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4924 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); |
| 4925 | if (!err) { |
| 4926 | if (spec->board_config < 0) { |
| 4927 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 4928 | "available, default to model=ref\n"); |
| 4929 | spec->board_config = STAC_92HD83XXX_REF; |
| 4930 | goto again; |
| 4931 | } |
| 4932 | err = -EINVAL; |
| 4933 | } |
| 4934 | |
| 4935 | if (err < 0) { |
| 4936 | stac92xx_free(codec); |
| 4937 | return err; |
| 4938 | } |
| 4939 | |
| 4940 | codec->patch_ops = stac92xx_patch_ops; |
| 4941 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4942 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 4943 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4944 | return 0; |
| 4945 | } |
| 4946 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4947 | static struct hda_input_mux stac92hd71bxx_dmux = { |
| 4948 | .num_items = 4, |
| 4949 | .items = { |
| 4950 | { "Analog Inputs", 0x00 }, |
| 4951 | { "Mixer", 0x01 }, |
| 4952 | { "Digital Mic 1", 0x02 }, |
| 4953 | { "Digital Mic 2", 0x03 }, |
| 4954 | } |
| 4955 | }; |
| 4956 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4957 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 4958 | { |
| 4959 | struct sigmatel_spec *spec; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 4960 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4961 | int err = 0; |
| 4962 | |
| 4963 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4964 | if (spec == NULL) |
| 4965 | return -ENOMEM; |
| 4966 | |
| 4967 | codec->spec = spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4968 | codec->patch_ops = stac92xx_patch_ops; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 4969 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
| 4970 | switch (codec->vendor_id) { |
| 4971 | case 0x111d76b6: |
| 4972 | case 0x111d76b7: |
| 4973 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; |
| 4974 | break; |
| 4975 | case 0x111d7603: |
| 4976 | case 0x111d7608: |
| 4977 | /* On 92HD75Bx 0x27 isn't a pin nid */ |
| 4978 | spec->num_pins--; |
| 4979 | /* fallthrough */ |
| 4980 | default: |
| 4981 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; |
| 4982 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 4983 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 4984 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, |
| 4985 | sizeof(stac92hd71bxx_dmux)); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 4986 | spec->board_config = snd_hda_check_board_config(codec, |
| 4987 | STAC_92HD71BXX_MODELS, |
| 4988 | stac92hd71bxx_models, |
| 4989 | stac92hd71bxx_cfg_tbl); |
| 4990 | again: |
| 4991 | if (spec->board_config < 0) { |
| 4992 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 4993 | " STAC92HD71BXX, using BIOS defaults\n"); |
| 4994 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4995 | } else |
| 4996 | err = stac_save_pin_cfgs(codec, |
| 4997 | stac92hd71bxx_brd_tbl[spec->board_config]); |
| 4998 | if (err < 0) { |
| 4999 | stac92xx_free(codec); |
| 5000 | return err; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5001 | } |
| 5002 | |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 5003 | if (spec->board_config > STAC_92HD71BXX_REF) { |
| 5004 | /* GPIO0 = EAPD */ |
| 5005 | spec->gpio_mask = 0x01; |
| 5006 | spec->gpio_dir = 0x01; |
| 5007 | spec->gpio_data = 0x01; |
| 5008 | } |
| 5009 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5010 | switch (codec->vendor_id) { |
| 5011 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 5012 | case 0x111d76b7: |
| 5013 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 5014 | case 0x111d76b5: |
| 5015 | spec->mixer = stac92hd71bxx_mixer; |
| 5016 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5017 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5018 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5019 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 5020 | switch (spec->board_config) { |
| 5021 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5022 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5023 | err = stac_add_event(spec, codec->afg, |
| 5024 | STAC_VREF_EVENT, 0x02); |
| 5025 | if (err < 0) |
| 5026 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5027 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5028 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
| 5029 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 5030 | AC_VERB_SET_UNSOLICITED_ENABLE, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5031 | AC_USRSP_EN | err); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5032 | spec->gpio_mask |= 0x02; |
| 5033 | break; |
| 5034 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5035 | if ((codec->revision_id & 0xf) == 0 || |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5036 | (codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5037 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5038 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5039 | /* no output amps */ |
| 5040 | spec->num_pwrs = 0; |
| 5041 | spec->mixer = stac92hd71bxx_analog_mixer; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5042 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5043 | |
| 5044 | /* disable VSW */ |
| 5045 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5046 | unmute_init++; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame^] | 5047 | stac_change_pin_config(codec, 0x0f, 0x40f000f0); |
| 5048 | stac_change_pin_config(codec, 0x19, 0x40f000f3); |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5049 | break; |
| 5050 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5051 | if ((codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5052 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5053 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5054 | /* no output amps */ |
| 5055 | spec->num_pwrs = 0; |
| 5056 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5057 | default: |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5058 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5059 | spec->mixer = stac92hd71bxx_analog_mixer; |
| 5060 | spec->init = stac92hd71bxx_analog_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5061 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5062 | } |
| 5063 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5064 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
| 5065 | snd_hda_sequence_write_cache(codec, unmute_init); |
| 5066 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5067 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5068 | spec->aloopback_shift = 0; |
| 5069 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5070 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5071 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5072 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 5073 | spec->adc_nids = stac92hd71bxx_adc_nids; |
| 5074 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5075 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5076 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5077 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5078 | |
| 5079 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 5080 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5081 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5082 | switch (spec->board_config) { |
| 5083 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5084 | /* enable internal microphone */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5085 | stac_change_pin_config(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea715 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 5086 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 5087 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 5088 | /* fallthru */ |
| 5089 | case STAC_DELL_M4_2: |
| 5090 | spec->num_dmics = 0; |
| 5091 | spec->num_smuxes = 0; |
| 5092 | spec->num_dmuxes = 0; |
| 5093 | break; |
| 5094 | case STAC_DELL_M4_1: |
| 5095 | case STAC_DELL_M4_3: |
| 5096 | spec->num_dmics = 1; |
| 5097 | spec->num_smuxes = 0; |
| 5098 | spec->num_dmuxes = 0; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5099 | break; |
| 5100 | default: |
| 5101 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; |
| 5102 | spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); |
| 5103 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5104 | }; |
| 5105 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5106 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5107 | if (spec->dinput_mux) |
| 5108 | spec->private_dimux.num_items += |
| 5109 | spec->num_dmics - |
| 5110 | (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5111 | |
| 5112 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); |
| 5113 | if (!err) { |
| 5114 | if (spec->board_config < 0) { |
| 5115 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5116 | "available, default to model=ref\n"); |
| 5117 | spec->board_config = STAC_92HD71BXX_REF; |
| 5118 | goto again; |
| 5119 | } |
| 5120 | err = -EINVAL; |
| 5121 | } |
| 5122 | |
| 5123 | if (err < 0) { |
| 5124 | stac92xx_free(codec); |
| 5125 | return err; |
| 5126 | } |
| 5127 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5128 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5129 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5130 | return 0; |
| 5131 | }; |
| 5132 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5133 | static int patch_stac922x(struct hda_codec *codec) |
| 5134 | { |
| 5135 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5136 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5137 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5138 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5139 | if (spec == NULL) |
| 5140 | return -ENOMEM; |
| 5141 | |
| 5142 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5143 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5144 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5145 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 5146 | stac922x_models, |
| 5147 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5148 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5149 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 5150 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5151 | /* Intel Macs have all same PCI SSID, so we need to check |
| 5152 | * codec SSID to distinguish the exact models |
| 5153 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5154 | 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] | 5155 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5156 | |
| 5157 | case 0x106b0800: |
| 5158 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 5159 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5160 | case 0x106b0600: |
| 5161 | case 0x106b0700: |
| 5162 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5163 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5164 | case 0x106b0e00: |
| 5165 | case 0x106b0f00: |
| 5166 | case 0x106b1600: |
| 5167 | case 0x106b1700: |
| 5168 | case 0x106b0200: |
| 5169 | case 0x106b1e00: |
| 5170 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5171 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5172 | case 0x106b1a00: |
| 5173 | case 0x00000100: |
| 5174 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 5175 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5176 | case 0x106b0a00: |
| 5177 | case 0x106b2200: |
| 5178 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 5179 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5180 | default: |
| 5181 | spec->board_config = STAC_INTEL_MAC_V3; |
| 5182 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5183 | } |
| 5184 | } |
| 5185 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5186 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5187 | if (spec->board_config < 0) { |
| 5188 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
| 5189 | "using BIOS defaults\n"); |
| 5190 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5191 | } else |
| 5192 | err = stac_save_pin_cfgs(codec, |
| 5193 | stac922x_brd_tbl[spec->board_config]); |
| 5194 | if (err < 0) { |
| 5195 | stac92xx_free(codec); |
| 5196 | return err; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 5197 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5198 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5199 | spec->adc_nids = stac922x_adc_nids; |
| 5200 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5201 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5202 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5203 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5204 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5205 | |
| 5206 | spec->init = stac922x_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5207 | spec->mixer = stac922x_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5208 | |
| 5209 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 5210 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5211 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5212 | if (!err) { |
| 5213 | if (spec->board_config < 0) { |
| 5214 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5215 | "available, default to model=ref\n"); |
| 5216 | spec->board_config = STAC_D945_REF; |
| 5217 | goto again; |
| 5218 | } |
| 5219 | err = -EINVAL; |
| 5220 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5221 | if (err < 0) { |
| 5222 | stac92xx_free(codec); |
| 5223 | return err; |
| 5224 | } |
| 5225 | |
| 5226 | codec->patch_ops = stac92xx_patch_ops; |
| 5227 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 5228 | /* Fix Mux capture level; max to 2 */ |
| 5229 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 5230 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 5231 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 5232 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 5233 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 5234 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5235 | return 0; |
| 5236 | } |
| 5237 | |
| 5238 | static int patch_stac927x(struct hda_codec *codec) |
| 5239 | { |
| 5240 | struct sigmatel_spec *spec; |
| 5241 | int err; |
| 5242 | |
| 5243 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5244 | if (spec == NULL) |
| 5245 | return -ENOMEM; |
| 5246 | |
| 5247 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5248 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5249 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5250 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 5251 | stac927x_models, |
| 5252 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5253 | again: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5254 | if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { |
| 5255 | if (spec->board_config < 0) |
| 5256 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
| 5257 | "STAC927x, using BIOS defaults\n"); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5258 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5259 | } else |
| 5260 | err = stac_save_pin_cfgs(codec, |
| 5261 | stac927x_brd_tbl[spec->board_config]); |
| 5262 | if (err < 0) { |
| 5263 | stac92xx_free(codec); |
| 5264 | return err; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5265 | } |
| 5266 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5267 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5268 | spec->adc_nids = stac927x_adc_nids; |
| 5269 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 5270 | spec->mux_nids = stac927x_mux_nids; |
| 5271 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5272 | spec->smux_nids = stac927x_smux_nids; |
| 5273 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 5274 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 5275 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5276 | spec->multiout.dac_nids = spec->dac_nids; |
| 5277 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5278 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5279 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5280 | case STAC_D965_5ST: |
| 5281 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5282 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5283 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5284 | spec->num_dmics = 0; |
| 5285 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5286 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5287 | spec->mixer = stac927x_mixer; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5288 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5289 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5290 | switch (codec->subsystem_id) { |
| 5291 | case 0x10280209: |
| 5292 | case 0x1028022e: |
| 5293 | /* correct the device field to SPDIF out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5294 | stac_change_pin_config(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5295 | break; |
| 5296 | }; |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 5297 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5298 | stac_change_pin_config(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 5299 | /* correct the front output jack as a hp out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5300 | stac_change_pin_config(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5301 | /* correct the front input jack as a mic */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5302 | stac_change_pin_config(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5303 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5304 | case STAC_DELL_3ST: |
| 5305 | /* GPIO2 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5306 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5307 | spec->gpio_data = 0x04; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5308 | spec->dmic_nids = stac927x_dmic_nids; |
| 5309 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 5310 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5311 | spec->init = d965_core_init; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5312 | spec->mixer = stac927x_mixer; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5313 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5314 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5315 | break; |
| 5316 | default: |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5317 | if (spec->board_config > STAC_D965_REF) { |
| 5318 | /* GPIO0 High = Enable EAPD */ |
| 5319 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 5320 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 5321 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5322 | spec->num_dmics = 0; |
| 5323 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5324 | spec->init = stac927x_core_init; |
| 5325 | spec->mixer = stac927x_mixer; |
| 5326 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5327 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5328 | spec->num_pwrs = 0; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5329 | spec->aloopback_mask = 0x40; |
| 5330 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5331 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5332 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5333 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5334 | if (!err) { |
| 5335 | if (spec->board_config < 0) { |
| 5336 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5337 | "available, default to model=ref\n"); |
| 5338 | spec->board_config = STAC_D965_REF; |
| 5339 | goto again; |
| 5340 | } |
| 5341 | err = -EINVAL; |
| 5342 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5343 | if (err < 0) { |
| 5344 | stac92xx_free(codec); |
| 5345 | return err; |
| 5346 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5347 | |
| 5348 | codec->patch_ops = stac92xx_patch_ops; |
| 5349 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5350 | codec->proc_widget_hook = stac927x_proc_hook; |
| 5351 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 5352 | /* |
| 5353 | * !!FIXME!! |
| 5354 | * The STAC927x seem to require fairly long delays for certain |
| 5355 | * command sequences. With too short delays (even if the answer |
| 5356 | * is set to RIRB properly), it results in the silence output |
| 5357 | * on some hardwares like Dell. |
| 5358 | * |
| 5359 | * The below flag enables the longer delay (see get_response |
| 5360 | * in hda_intel.c). |
| 5361 | */ |
| 5362 | codec->bus->needs_damn_long_delay = 1; |
| 5363 | |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 5364 | /* no jack detecion for ref-no-jd model */ |
| 5365 | if (spec->board_config == STAC_D965_REF_NO_JD) |
| 5366 | spec->hp_detect = 0; |
| 5367 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5368 | return 0; |
| 5369 | } |
| 5370 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5371 | static int patch_stac9205(struct hda_codec *codec) |
| 5372 | { |
| 5373 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 5374 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5375 | |
| 5376 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5377 | if (spec == NULL) |
| 5378 | return -ENOMEM; |
| 5379 | |
| 5380 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5381 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5382 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5383 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 5384 | stac9205_models, |
| 5385 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5386 | again: |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5387 | if (spec->board_config < 0) { |
| 5388 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
| 5389 | err = stac92xx_save_bios_config_regs(codec); |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5390 | } else |
| 5391 | err = stac_save_pin_cfgs(codec, |
| 5392 | stac9205_brd_tbl[spec->board_config]); |
| 5393 | if (err < 0) { |
| 5394 | stac92xx_free(codec); |
| 5395 | return err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5396 | } |
| 5397 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5398 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5399 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5400 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5401 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5402 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5403 | spec->smux_nids = stac9205_smux_nids; |
| 5404 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5405 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5406 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5407 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055e | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5408 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5409 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5410 | |
| 5411 | spec->init = stac9205_core_init; |
| 5412 | spec->mixer = stac9205_mixer; |
| 5413 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5414 | spec->aloopback_mask = 0x40; |
| 5415 | spec->aloopback_shift = 0; |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 5416 | /* Turn on/off EAPD per HP plugging */ |
| 5417 | if (spec->board_config != STAC_9205_EAPD) |
| 5418 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5419 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5420 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5421 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5422 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5423 | /* Enable SPDIF in/out */ |
Takashi Iwai | af9f341a | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5424 | stac_change_pin_config(codec, 0x1f, 0x01441030); |
| 5425 | stac_change_pin_config(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 5426 | |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5427 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5428 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); |
| 5429 | if (err < 0) |
| 5430 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5431 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5432 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
| 5433 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5434 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 5435 | AC_USRSP_EN | err); |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5436 | |
| 5437 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5438 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5439 | spec->gpio_mask = 0x1b; |
| 5440 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 5441 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5442 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5443 | */ |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5444 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5445 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5446 | case STAC_9205_REF: |
| 5447 | /* SPDIF-In enabled */ |
| 5448 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5449 | default: |
| 5450 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5451 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195c | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5452 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5453 | break; |
| 5454 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5455 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5456 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5457 | if (!err) { |
| 5458 | if (spec->board_config < 0) { |
| 5459 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5460 | "available, default to model=ref\n"); |
| 5461 | spec->board_config = STAC_9205_REF; |
| 5462 | goto again; |
| 5463 | } |
| 5464 | err = -EINVAL; |
| 5465 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5466 | if (err < 0) { |
| 5467 | stac92xx_free(codec); |
| 5468 | return err; |
| 5469 | } |
| 5470 | |
| 5471 | codec->patch_ops = stac92xx_patch_ops; |
| 5472 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5473 | codec->proc_widget_hook = stac9205_proc_hook; |
| 5474 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5475 | return 0; |
| 5476 | } |
| 5477 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5478 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5479 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5480 | */ |
| 5481 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5482 | static struct hda_verb stac9872_core_init[] = { |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 5483 | {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] | 5484 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 5485 | {} |
| 5486 | }; |
| 5487 | |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5488 | static struct snd_kcontrol_new stac9872_mixer[] = { |
| 5489 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
| 5490 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5491 | { } /* end */ |
| 5492 | }; |
| 5493 | |
| 5494 | static hda_nid_t stac9872_pin_nids[] = { |
| 5495 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 5496 | 0x11, 0x13, 0x14, |
| 5497 | }; |
| 5498 | |
| 5499 | static hda_nid_t stac9872_adc_nids[] = { |
| 5500 | 0x8 /*,0x6*/ |
| 5501 | }; |
| 5502 | |
| 5503 | static hda_nid_t stac9872_mux_nids[] = { |
| 5504 | 0x15 |
| 5505 | }; |
| 5506 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5507 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5508 | { |
| 5509 | struct sigmatel_spec *spec; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5510 | int err; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5511 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5512 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5513 | if (spec == NULL) |
| 5514 | return -ENOMEM; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5515 | codec->spec = spec; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5516 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5517 | #if 0 /* no model right now */ |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5518 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 5519 | stac9872_models, |
| 5520 | stac9872_cfg_tbl); |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5521 | #endif |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5522 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5523 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
| 5524 | spec->pin_nids = stac9872_pin_nids; |
| 5525 | spec->multiout.dac_nids = spec->dac_nids; |
| 5526 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); |
| 5527 | spec->adc_nids = stac9872_adc_nids; |
| 5528 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
| 5529 | spec->mux_nids = stac9872_mux_nids; |
| 5530 | spec->mixer = stac9872_mixer; |
| 5531 | spec->init = stac9872_core_init; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5532 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5533 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); |
| 5534 | if (err < 0) { |
| 5535 | stac92xx_free(codec); |
| 5536 | return -EINVAL; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 5537 | } |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 5538 | spec->input_mux = &spec->private_imux; |
| 5539 | codec->patch_ops = stac92xx_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 5540 | return 0; |
| 5541 | } |
| 5542 | |
| 5543 | |
| 5544 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5545 | * patch entries |
| 5546 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 5547 | static struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5548 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 5549 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 5550 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 5551 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 5552 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 5553 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 5554 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 5555 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 5556 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 5557 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 5558 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 5559 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 5560 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5561 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 5562 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 5563 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 5564 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 5565 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 5566 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 5567 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 5568 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 5569 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 5570 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5571 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 5572 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 5573 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 5574 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 5575 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 5576 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 5577 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 5578 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 5579 | /* The following does not take into account .id=0x83847661 when subsys = |
| 5580 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 5581 | * currently not fully supported. |
| 5582 | */ |
| 5583 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 5584 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 5585 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5586 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 5587 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 5588 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 5589 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 5590 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 5591 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 5592 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 5593 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5594 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5595 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
| 5596 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5597 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5598 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 5599 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5600 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5601 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5602 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 5603 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5604 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 5605 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5606 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 5607 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 5608 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5609 | {} /* terminator */ |
| 5610 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 5611 | |
| 5612 | MODULE_ALIAS("snd-hda-codec-id:8384*"); |
| 5613 | MODULE_ALIAS("snd-hda-codec-id:111d*"); |
| 5614 | |
| 5615 | MODULE_LICENSE("GPL"); |
| 5616 | MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); |
| 5617 | |
| 5618 | static struct hda_codec_preset_list sigmatel_list = { |
| 5619 | .preset = snd_hda_preset_sigmatel, |
| 5620 | .owner = THIS_MODULE, |
| 5621 | }; |
| 5622 | |
| 5623 | static int __init patch_sigmatel_init(void) |
| 5624 | { |
| 5625 | return snd_hda_add_codec_preset(&sigmatel_list); |
| 5626 | } |
| 5627 | |
| 5628 | static void __exit patch_sigmatel_exit(void) |
| 5629 | { |
| 5630 | snd_hda_delete_codec_preset(&sigmatel_list); |
| 5631 | } |
| 5632 | |
| 5633 | module_init(patch_sigmatel_init) |
| 5634 | module_exit(patch_sigmatel_exit) |