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