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, |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 43 | STAC_MIC_EVENT, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 44 | }; |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 45 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 46 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 47 | STAC_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 48 | STAC_REF, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 49 | STAC_9200_OQO, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 50 | STAC_9200_DELL_D21, |
| 51 | STAC_9200_DELL_D22, |
| 52 | STAC_9200_DELL_D23, |
| 53 | STAC_9200_DELL_M21, |
| 54 | STAC_9200_DELL_M22, |
| 55 | STAC_9200_DELL_M23, |
| 56 | STAC_9200_DELL_M24, |
| 57 | STAC_9200_DELL_M25, |
| 58 | STAC_9200_DELL_M26, |
| 59 | STAC_9200_DELL_M27, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 60 | STAC_9200_M4, |
| 61 | STAC_9200_M4_2, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 62 | STAC_9200_PANASONIC, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 63 | STAC_9200_MODELS |
| 64 | }; |
| 65 | |
| 66 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 67 | STAC_9205_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 68 | STAC_9205_REF, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 69 | STAC_9205_DELL_M42, |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 70 | STAC_9205_DELL_M43, |
| 71 | STAC_9205_DELL_M44, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 72 | STAC_9205_EAPD, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 73 | STAC_9205_MODELS |
| 74 | }; |
| 75 | |
| 76 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 77 | STAC_92HD73XX_AUTO, |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 78 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 79 | STAC_92HD73XX_REF, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 80 | STAC_DELL_M6_AMIC, |
| 81 | STAC_DELL_M6_DMIC, |
| 82 | STAC_DELL_M6_BOTH, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 83 | STAC_DELL_EQ, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 84 | STAC_92HD73XX_MODELS |
| 85 | }; |
| 86 | |
| 87 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 88 | STAC_92HD83XXX_AUTO, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 89 | STAC_92HD83XXX_REF, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 90 | STAC_92HD83XXX_PWR_REF, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 91 | STAC_DELL_S14, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 92 | STAC_92HD83XXX_MODELS |
| 93 | }; |
| 94 | |
| 95 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 96 | STAC_92HD71BXX_AUTO, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 97 | STAC_92HD71BXX_REF, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 98 | STAC_DELL_M4_1, |
| 99 | STAC_DELL_M4_2, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 100 | STAC_DELL_M4_3, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 101 | STAC_HP_M4, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 102 | STAC_HP_DV5, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 103 | STAC_HP_HDX, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 104 | STAC_HP_DV4_1222NR, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 105 | STAC_92HD71BXX_MODELS |
| 106 | }; |
| 107 | |
| 108 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 109 | STAC_925x_AUTO, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 110 | STAC_925x_REF, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 111 | STAC_M1, |
| 112 | STAC_M1_2, |
| 113 | STAC_M2, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 114 | STAC_M2_2, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 115 | STAC_M3, |
| 116 | STAC_M5, |
| 117 | STAC_M6, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 118 | STAC_925x_MODELS |
| 119 | }; |
| 120 | |
| 121 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 122 | STAC_922X_AUTO, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 123 | STAC_D945_REF, |
| 124 | STAC_D945GTP3, |
| 125 | STAC_D945GTP5, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 126 | STAC_INTEL_MAC_V1, |
| 127 | STAC_INTEL_MAC_V2, |
| 128 | STAC_INTEL_MAC_V3, |
| 129 | STAC_INTEL_MAC_V4, |
| 130 | STAC_INTEL_MAC_V5, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 131 | STAC_INTEL_MAC_AUTO, /* This model is selected if no module parameter |
| 132 | * is given, one of the above models will be |
| 133 | * chosen according to the subsystem id. */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 134 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 135 | STAC_MACMINI, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 136 | STAC_MACBOOK, |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 137 | STAC_MACBOOK_PRO_V1, |
| 138 | STAC_MACBOOK_PRO_V2, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 139 | STAC_IMAC_INTEL, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 140 | STAC_IMAC_INTEL_20, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 141 | STAC_ECS_202, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 142 | STAC_922X_DELL_D81, |
| 143 | STAC_922X_DELL_D82, |
| 144 | STAC_922X_DELL_M81, |
| 145 | STAC_922X_DELL_M82, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 146 | STAC_922X_MODELS |
| 147 | }; |
| 148 | |
| 149 | enum { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 150 | STAC_927X_AUTO, |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 151 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 152 | STAC_D965_REF, |
| 153 | STAC_D965_3ST, |
| 154 | STAC_D965_5ST, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 155 | STAC_D965_5ST_NO_FP, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 156 | STAC_DELL_3ST, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 157 | STAC_DELL_BIOS, |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 158 | STAC_927X_MODELS |
| 159 | }; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 160 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 161 | enum { |
| 162 | STAC_9872_AUTO, |
| 163 | STAC_9872_VAIO, |
| 164 | STAC_9872_MODELS |
| 165 | }; |
| 166 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 167 | struct sigmatel_event { |
| 168 | hda_nid_t nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 169 | unsigned char type; |
| 170 | unsigned char tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 171 | int data; |
| 172 | }; |
| 173 | |
| 174 | struct sigmatel_jack { |
| 175 | hda_nid_t nid; |
| 176 | int type; |
| 177 | struct snd_jack *jack; |
| 178 | }; |
| 179 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 180 | struct sigmatel_mic_route { |
| 181 | hda_nid_t pin; |
| 182 | unsigned char mux_idx; |
| 183 | unsigned char dmux_idx; |
| 184 | }; |
| 185 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 186 | struct sigmatel_spec { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 187 | struct snd_kcontrol_new *mixers[4]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 188 | unsigned int num_mixers; |
| 189 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 190 | int board_config; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 191 | unsigned int eapd_switch: 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 192 | unsigned int surr_switch: 1; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 193 | unsigned int alt_switch: 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 194 | unsigned int hp_detect: 1; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 195 | unsigned int spdif_mute: 1; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 196 | unsigned int check_volume_offset:1; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 197 | unsigned int auto_mic:1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 198 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 199 | /* gpio lines */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 200 | unsigned int eapd_mask; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 201 | unsigned int gpio_mask; |
| 202 | unsigned int gpio_dir; |
| 203 | unsigned int gpio_data; |
| 204 | unsigned int gpio_mute; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 205 | unsigned int gpio_led; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 206 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 207 | /* stream */ |
| 208 | unsigned int stream_delay; |
| 209 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 210 | /* analog loopback */ |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 211 | struct snd_kcontrol_new *aloopback_ctl; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 212 | unsigned char aloopback_mask; |
| 213 | unsigned char aloopback_shift; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 214 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 215 | /* power management */ |
| 216 | unsigned int num_pwrs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 217 | unsigned int *pwr_mapping; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 218 | hda_nid_t *pwr_nids; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 219 | hda_nid_t *dac_list; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 220 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 221 | /* jack detection */ |
| 222 | struct snd_array jacks; |
| 223 | |
| 224 | /* events */ |
| 225 | struct snd_array events; |
| 226 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 227 | /* playback */ |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 228 | struct hda_input_mux *mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 229 | struct hda_input_mux *amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 230 | unsigned int cur_mmux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 231 | struct hda_multi_out multiout; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 232 | hda_nid_t dac_nids[5]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 233 | hda_nid_t hp_dacs[5]; |
| 234 | hda_nid_t speaker_dacs[5]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 235 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 236 | int volume_offset; |
| 237 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 238 | /* capture */ |
| 239 | hda_nid_t *adc_nids; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 240 | unsigned int num_adcs; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 241 | hda_nid_t *mux_nids; |
| 242 | unsigned int num_muxes; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 243 | hda_nid_t *dmic_nids; |
| 244 | unsigned int num_dmics; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 245 | hda_nid_t *dmux_nids; |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 246 | unsigned int num_dmuxes; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 247 | hda_nid_t *smux_nids; |
| 248 | unsigned int num_smuxes; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 249 | |
| 250 | unsigned long *capvols; /* amp-volume attr: HDA_COMPOSE_AMP_VAL() */ |
| 251 | unsigned long *capsws; /* amp-mute attr: HDA_COMPOSE_AMP_VAL() */ |
| 252 | unsigned int num_caps; /* number of capture volume/switch elements */ |
| 253 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 254 | struct sigmatel_mic_route ext_mic; |
| 255 | struct sigmatel_mic_route int_mic; |
| 256 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 257 | const char **spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 258 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 259 | hda_nid_t dig_in_nid; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 260 | hda_nid_t mono_nid; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 261 | hda_nid_t anabeep_nid; |
| 262 | hda_nid_t digbeep_nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 263 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 264 | /* pin widgets */ |
| 265 | hda_nid_t *pin_nids; |
| 266 | unsigned int num_pins; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 267 | |
| 268 | /* codec specific stuff */ |
| 269 | struct hda_verb *init; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 270 | struct snd_kcontrol_new *mixer; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 271 | |
| 272 | /* capture source */ |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 273 | struct hda_input_mux *dinput_mux; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 274 | unsigned int cur_dmux[2]; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 275 | struct hda_input_mux *input_mux; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 276 | unsigned int cur_mux[3]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 277 | struct hda_input_mux *sinput_mux; |
| 278 | unsigned int cur_smux[2]; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 279 | unsigned int cur_amux; |
| 280 | hda_nid_t *amp_nids; |
| 281 | unsigned int num_amps; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 282 | unsigned int powerdown_adcs; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 283 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 284 | /* i/o switches */ |
| 285 | unsigned int io_switch[2]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 286 | unsigned int clfe_swap; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 287 | hda_nid_t line_switch; /* shared line-in for input and output */ |
| 288 | hda_nid_t mic_switch; /* shared mic-in for input and output */ |
| 289 | hda_nid_t hp_switch; /* NID of HP as line-out */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 290 | unsigned int aloopback; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 291 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 292 | struct hda_pcm pcm_rec[2]; /* PCM information */ |
| 293 | |
| 294 | /* dynamic controls and input_mux */ |
| 295 | struct auto_pin_cfg autocfg; |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 296 | struct snd_array kctls; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 297 | struct hda_input_mux private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 298 | struct hda_input_mux private_imux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 299 | struct hda_input_mux private_smux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 300 | struct hda_input_mux private_amp_mux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 301 | struct hda_input_mux private_mono_mux; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 302 | }; |
| 303 | |
| 304 | static hda_nid_t stac9200_adc_nids[1] = { |
| 305 | 0x03, |
| 306 | }; |
| 307 | |
| 308 | static hda_nid_t stac9200_mux_nids[1] = { |
| 309 | 0x0c, |
| 310 | }; |
| 311 | |
| 312 | static hda_nid_t stac9200_dac_nids[1] = { |
| 313 | 0x02, |
| 314 | }; |
| 315 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 316 | static hda_nid_t stac92hd73xx_pwr_nids[8] = { |
| 317 | 0x0a, 0x0b, 0x0c, 0xd, 0x0e, |
| 318 | 0x0f, 0x10, 0x11 |
| 319 | }; |
| 320 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 321 | static hda_nid_t stac92hd73xx_slave_dig_outs[2] = { |
| 322 | 0x26, 0, |
| 323 | }; |
| 324 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 325 | static hda_nid_t stac92hd73xx_adc_nids[2] = { |
| 326 | 0x1a, 0x1b |
| 327 | }; |
| 328 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 329 | #define DELL_M6_AMP 2 |
| 330 | static hda_nid_t stac92hd73xx_amp_nids[3] = { |
| 331 | 0x0b, 0x0c, 0x0e |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 332 | }; |
| 333 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 334 | #define STAC92HD73XX_NUM_DMICS 2 |
| 335 | static hda_nid_t stac92hd73xx_dmic_nids[STAC92HD73XX_NUM_DMICS + 1] = { |
| 336 | 0x13, 0x14, 0 |
| 337 | }; |
| 338 | |
| 339 | #define STAC92HD73_DAC_COUNT 5 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 340 | |
| 341 | static hda_nid_t stac92hd73xx_mux_nids[4] = { |
| 342 | 0x28, 0x29, 0x2a, 0x2b, |
| 343 | }; |
| 344 | |
| 345 | static hda_nid_t stac92hd73xx_dmux_nids[2] = { |
| 346 | 0x20, 0x21, |
| 347 | }; |
| 348 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 349 | static hda_nid_t stac92hd73xx_smux_nids[2] = { |
| 350 | 0x22, 0x23, |
| 351 | }; |
| 352 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 353 | #define STAC92HD73XX_NUM_CAPS 2 |
| 354 | static unsigned long stac92hd73xx_capvols[] = { |
| 355 | HDA_COMPOSE_AMP_VAL(0x20, 3, 0, HDA_OUTPUT), |
| 356 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), |
| 357 | }; |
| 358 | #define stac92hd73xx_capsws stac92hd73xx_capvols |
| 359 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 360 | #define STAC92HD83XXX_NUM_DMICS 2 |
| 361 | static hda_nid_t stac92hd83xxx_dmic_nids[STAC92HD83XXX_NUM_DMICS + 1] = { |
| 362 | 0x11, 0x12, 0 |
| 363 | }; |
| 364 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 365 | #define STAC92HD83_DAC_COUNT 3 |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 366 | |
| 367 | static hda_nid_t stac92hd83xxx_dmux_nids[2] = { |
| 368 | 0x17, 0x18, |
| 369 | }; |
| 370 | |
| 371 | static hda_nid_t stac92hd83xxx_adc_nids[2] = { |
| 372 | 0x15, 0x16, |
| 373 | }; |
| 374 | |
| 375 | static hda_nid_t stac92hd83xxx_pwr_nids[4] = { |
| 376 | 0xa, 0xb, 0xd, 0xe, |
| 377 | }; |
| 378 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 379 | static hda_nid_t stac92hd83xxx_slave_dig_outs[2] = { |
| 380 | 0x1e, 0, |
| 381 | }; |
| 382 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 383 | static unsigned int stac92hd83xxx_pwr_mapping[4] = { |
Matthew Ranostay | 87e88a7 | 2009-01-22 20:38:42 -0500 | [diff] [blame] | 384 | 0x03, 0x0c, 0x20, 0x40, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 385 | }; |
| 386 | |
Takashi Iwai | 9248f26 | 2009-01-14 09:40:25 +0100 | [diff] [blame] | 387 | static hda_nid_t stac92hd83xxx_amp_nids[1] = { |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 388 | 0xc, |
| 389 | }; |
| 390 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 391 | #define STAC92HD83XXX_NUM_CAPS 2 |
| 392 | static unsigned long stac92hd83xxx_capvols[] = { |
| 393 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), |
| 394 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_OUTPUT), |
| 395 | }; |
| 396 | #define stac92hd83xxx_capsws stac92hd83xxx_capvols |
| 397 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 398 | static hda_nid_t stac92hd71bxx_pwr_nids[3] = { |
| 399 | 0x0a, 0x0d, 0x0f |
| 400 | }; |
| 401 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 402 | static hda_nid_t stac92hd71bxx_adc_nids[2] = { |
| 403 | 0x12, 0x13, |
| 404 | }; |
| 405 | |
| 406 | static hda_nid_t stac92hd71bxx_mux_nids[2] = { |
| 407 | 0x1a, 0x1b |
| 408 | }; |
| 409 | |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 410 | static hda_nid_t stac92hd71bxx_dmux_nids[2] = { |
| 411 | 0x1c, 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 412 | }; |
| 413 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 414 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { |
| 415 | 0x24, 0x25, |
| 416 | }; |
| 417 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 418 | #define STAC92HD71BXX_NUM_DMICS 2 |
| 419 | static hda_nid_t stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS + 1] = { |
| 420 | 0x18, 0x19, 0 |
| 421 | }; |
| 422 | |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 423 | static hda_nid_t stac92hd71bxx_slave_dig_outs[2] = { |
| 424 | 0x22, 0 |
| 425 | }; |
| 426 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 427 | #define STAC92HD71BXX_NUM_CAPS 2 |
| 428 | static unsigned long stac92hd71bxx_capvols[] = { |
| 429 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 430 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 431 | }; |
| 432 | #define stac92hd71bxx_capsws stac92hd71bxx_capvols |
| 433 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 434 | static hda_nid_t stac925x_adc_nids[1] = { |
| 435 | 0x03, |
| 436 | }; |
| 437 | |
| 438 | static hda_nid_t stac925x_mux_nids[1] = { |
| 439 | 0x0f, |
| 440 | }; |
| 441 | |
| 442 | static hda_nid_t stac925x_dac_nids[1] = { |
| 443 | 0x02, |
| 444 | }; |
| 445 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 446 | #define STAC925X_NUM_DMICS 1 |
| 447 | static hda_nid_t stac925x_dmic_nids[STAC925X_NUM_DMICS + 1] = { |
| 448 | 0x15, 0 |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 449 | }; |
| 450 | |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 451 | static hda_nid_t stac925x_dmux_nids[1] = { |
| 452 | 0x14, |
| 453 | }; |
| 454 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 455 | static unsigned long stac925x_capvols[] = { |
| 456 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), |
| 457 | }; |
| 458 | static unsigned long stac925x_capsws[] = { |
| 459 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 460 | }; |
| 461 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 462 | static hda_nid_t stac922x_adc_nids[2] = { |
| 463 | 0x06, 0x07, |
| 464 | }; |
| 465 | |
| 466 | static hda_nid_t stac922x_mux_nids[2] = { |
| 467 | 0x12, 0x13, |
| 468 | }; |
| 469 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 470 | #define STAC922X_NUM_CAPS 2 |
| 471 | static unsigned long stac922x_capvols[] = { |
| 472 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_INPUT), |
| 473 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 474 | }; |
| 475 | #define stac922x_capsws stac922x_capvols |
| 476 | |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 477 | static hda_nid_t stac927x_slave_dig_outs[2] = { |
| 478 | 0x1f, 0, |
| 479 | }; |
| 480 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 481 | static hda_nid_t stac927x_adc_nids[3] = { |
| 482 | 0x07, 0x08, 0x09 |
| 483 | }; |
| 484 | |
| 485 | static hda_nid_t stac927x_mux_nids[3] = { |
| 486 | 0x15, 0x16, 0x17 |
| 487 | }; |
| 488 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 489 | static hda_nid_t stac927x_smux_nids[1] = { |
| 490 | 0x21, |
| 491 | }; |
| 492 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 493 | static hda_nid_t stac927x_dac_nids[6] = { |
| 494 | 0x02, 0x03, 0x04, 0x05, 0x06, 0 |
| 495 | }; |
| 496 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 497 | static hda_nid_t stac927x_dmux_nids[1] = { |
| 498 | 0x1b, |
| 499 | }; |
| 500 | |
Matthew Ranostay | 7f16859 | 2007-10-18 17:38:17 +0200 | [diff] [blame] | 501 | #define STAC927X_NUM_DMICS 2 |
| 502 | static hda_nid_t stac927x_dmic_nids[STAC927X_NUM_DMICS + 1] = { |
| 503 | 0x13, 0x14, 0 |
| 504 | }; |
| 505 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 506 | #define STAC927X_NUM_CAPS 3 |
| 507 | static unsigned long stac927x_capvols[] = { |
| 508 | HDA_COMPOSE_AMP_VAL(0x18, 3, 0, HDA_INPUT), |
| 509 | HDA_COMPOSE_AMP_VAL(0x19, 3, 0, HDA_INPUT), |
| 510 | HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_INPUT), |
| 511 | }; |
| 512 | static unsigned long stac927x_capsws[] = { |
| 513 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 514 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_OUTPUT), |
| 515 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 516 | }; |
| 517 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 518 | static const char *stac927x_spdif_labels[5] = { |
| 519 | "Digital Playback", "ADAT", "Analog Mux 1", |
| 520 | "Analog Mux 2", "Analog Mux 3" |
| 521 | }; |
| 522 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 523 | static hda_nid_t stac9205_adc_nids[2] = { |
| 524 | 0x12, 0x13 |
| 525 | }; |
| 526 | |
| 527 | static hda_nid_t stac9205_mux_nids[2] = { |
| 528 | 0x19, 0x1a |
| 529 | }; |
| 530 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 531 | static hda_nid_t stac9205_dmux_nids[1] = { |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 532 | 0x1d, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 533 | }; |
| 534 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 535 | static hda_nid_t stac9205_smux_nids[1] = { |
| 536 | 0x21, |
| 537 | }; |
| 538 | |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 539 | #define STAC9205_NUM_DMICS 2 |
| 540 | static hda_nid_t stac9205_dmic_nids[STAC9205_NUM_DMICS + 1] = { |
| 541 | 0x17, 0x18, 0 |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 542 | }; |
| 543 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 544 | #define STAC9205_NUM_CAPS 2 |
| 545 | static unsigned long stac9205_capvols[] = { |
| 546 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_INPUT), |
| 547 | HDA_COMPOSE_AMP_VAL(0x1c, 3, 0, HDA_INPUT), |
| 548 | }; |
| 549 | static unsigned long stac9205_capsws[] = { |
| 550 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
| 551 | HDA_COMPOSE_AMP_VAL(0x1e, 3, 0, HDA_OUTPUT), |
| 552 | }; |
| 553 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 554 | static hda_nid_t stac9200_pin_nids[8] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 555 | 0x08, 0x09, 0x0d, 0x0e, |
| 556 | 0x0f, 0x10, 0x11, 0x12, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 557 | }; |
| 558 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 559 | static hda_nid_t stac925x_pin_nids[8] = { |
| 560 | 0x07, 0x08, 0x0a, 0x0b, |
| 561 | 0x0c, 0x0d, 0x10, 0x11, |
| 562 | }; |
| 563 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 564 | static hda_nid_t stac922x_pin_nids[10] = { |
| 565 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 566 | 0x0f, 0x10, 0x11, 0x15, 0x1b, |
| 567 | }; |
| 568 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 569 | static hda_nid_t stac92hd73xx_pin_nids[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 570 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 571 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 572 | 0x14, 0x22, 0x23 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 573 | }; |
| 574 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 575 | static hda_nid_t stac92hd83xxx_pin_nids[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 576 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 577 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 578 | }; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 579 | |
| 580 | #define STAC92HD71BXX_NUM_PINS 13 |
| 581 | static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { |
| 582 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, |
| 583 | 0x00, 0x14, 0x18, 0x19, 0x1e, |
| 584 | 0x1f, 0x20, 0x27 |
| 585 | }; |
| 586 | static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 587 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 588 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 589 | 0x1f, 0x20, 0x27 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 590 | }; |
| 591 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 592 | static hda_nid_t stac927x_pin_nids[14] = { |
| 593 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 594 | 0x0f, 0x10, 0x11, 0x12, 0x13, |
| 595 | 0x14, 0x21, 0x22, 0x23, |
| 596 | }; |
| 597 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 598 | static hda_nid_t stac9205_pin_nids[12] = { |
| 599 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
| 600 | 0x0f, 0x14, 0x16, 0x17, 0x18, |
| 601 | 0x21, 0x22, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 602 | }; |
| 603 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 604 | #define stac92xx_amp_volume_info snd_hda_mixer_amp_volume_info |
| 605 | |
| 606 | static int stac92xx_amp_volume_get(struct snd_kcontrol *kcontrol, |
| 607 | struct snd_ctl_elem_value *ucontrol) |
| 608 | { |
| 609 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 610 | struct sigmatel_spec *spec = codec->spec; |
| 611 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 612 | |
| 613 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 614 | kcontrol->private_value |= nid; |
| 615 | |
| 616 | return snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); |
| 617 | } |
| 618 | |
| 619 | static int stac92xx_amp_volume_put(struct snd_kcontrol *kcontrol, |
| 620 | struct snd_ctl_elem_value *ucontrol) |
| 621 | { |
| 622 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 623 | struct sigmatel_spec *spec = codec->spec; |
| 624 | hda_nid_t nid = spec->amp_nids[spec->cur_amux]; |
| 625 | |
| 626 | kcontrol->private_value ^= get_amp_nid(kcontrol); |
| 627 | kcontrol->private_value |= nid; |
| 628 | |
| 629 | return snd_hda_mixer_amp_volume_put(kcontrol, ucontrol); |
| 630 | } |
| 631 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 632 | static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, |
| 633 | struct snd_ctl_elem_info *uinfo) |
| 634 | { |
| 635 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 636 | struct sigmatel_spec *spec = codec->spec; |
| 637 | return snd_hda_input_mux_info(spec->dinput_mux, uinfo); |
| 638 | } |
| 639 | |
| 640 | static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, |
| 641 | struct snd_ctl_elem_value *ucontrol) |
| 642 | { |
| 643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 644 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 645 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 646 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 647 | ucontrol->value.enumerated.item[0] = spec->cur_dmux[dmux_idx]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 648 | return 0; |
| 649 | } |
| 650 | |
| 651 | static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, |
| 652 | struct snd_ctl_elem_value *ucontrol) |
| 653 | { |
| 654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 655 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 656 | unsigned int dmux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 657 | |
| 658 | return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 659 | spec->dmux_nids[dmux_idx], &spec->cur_dmux[dmux_idx]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 660 | } |
| 661 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 662 | static int stac92xx_smux_enum_info(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_info *uinfo) |
| 664 | { |
| 665 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 666 | struct sigmatel_spec *spec = codec->spec; |
| 667 | return snd_hda_input_mux_info(spec->sinput_mux, uinfo); |
| 668 | } |
| 669 | |
| 670 | static int stac92xx_smux_enum_get(struct snd_kcontrol *kcontrol, |
| 671 | struct snd_ctl_elem_value *ucontrol) |
| 672 | { |
| 673 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 674 | struct sigmatel_spec *spec = codec->spec; |
| 675 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 676 | |
| 677 | ucontrol->value.enumerated.item[0] = spec->cur_smux[smux_idx]; |
| 678 | return 0; |
| 679 | } |
| 680 | |
| 681 | static int stac92xx_smux_enum_put(struct snd_kcontrol *kcontrol, |
| 682 | struct snd_ctl_elem_value *ucontrol) |
| 683 | { |
| 684 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 685 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 686 | struct hda_input_mux *smux = &spec->private_smux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 687 | unsigned int smux_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 688 | int err, val; |
| 689 | hda_nid_t nid; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 690 | |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 691 | err = snd_hda_input_mux_put(codec, spec->sinput_mux, ucontrol, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 692 | spec->smux_nids[smux_idx], &spec->cur_smux[smux_idx]); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 693 | if (err < 0) |
| 694 | return err; |
| 695 | |
| 696 | if (spec->spdif_mute) { |
| 697 | if (smux_idx == 0) |
| 698 | nid = spec->multiout.dig_out_nid; |
| 699 | else |
| 700 | nid = codec->slave_dig_outs[smux_idx - 1]; |
| 701 | if (spec->cur_smux[smux_idx] == smux->num_items - 1) |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 702 | val = HDA_AMP_MUTE; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 703 | else |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 704 | val = 0; |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 705 | /* un/mute SPDIF out */ |
Takashi Iwai | c9b46f9 | 2008-12-01 11:42:09 +0100 | [diff] [blame] | 706 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 707 | HDA_AMP_MUTE, val); |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 708 | } |
| 709 | return 0; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 710 | } |
| 711 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 712 | static unsigned int stac92xx_vref_set(struct hda_codec *codec, |
| 713 | hda_nid_t nid, unsigned int new_vref) |
| 714 | { |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 715 | int error; |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 716 | unsigned int pincfg; |
| 717 | pincfg = snd_hda_codec_read(codec, nid, 0, |
| 718 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 719 | |
| 720 | pincfg &= 0xff; |
| 721 | pincfg &= ~(AC_PINCTL_VREFEN | AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 722 | pincfg |= new_vref; |
| 723 | |
| 724 | if (new_vref == AC_PINCTL_VREF_HIZ) |
| 725 | pincfg |= AC_PINCTL_OUT_EN; |
| 726 | else |
| 727 | pincfg |= AC_PINCTL_IN_EN; |
| 728 | |
| 729 | error = snd_hda_codec_write_cache(codec, nid, 0, |
| 730 | AC_VERB_SET_PIN_WIDGET_CONTROL, pincfg); |
| 731 | if (error < 0) |
| 732 | return error; |
| 733 | else |
| 734 | return 1; |
| 735 | } |
| 736 | |
| 737 | static unsigned int stac92xx_vref_get(struct hda_codec *codec, hda_nid_t nid) |
| 738 | { |
| 739 | unsigned int vref; |
| 740 | vref = snd_hda_codec_read(codec, nid, 0, |
| 741 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 742 | vref &= AC_PINCTL_VREFEN; |
| 743 | return vref; |
| 744 | } |
| 745 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 746 | 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] | 747 | { |
| 748 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 749 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 750 | return snd_hda_input_mux_info(spec->input_mux, uinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 751 | } |
| 752 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 753 | 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] | 754 | { |
| 755 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 756 | struct sigmatel_spec *spec = codec->spec; |
| 757 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 758 | |
| 759 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 760 | return 0; |
| 761 | } |
| 762 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 763 | 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] | 764 | { |
| 765 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 766 | struct sigmatel_spec *spec = codec->spec; |
| 767 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 768 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 769 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 770 | spec->mux_nids[adc_idx], &spec->cur_mux[adc_idx]); |
| 771 | } |
| 772 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 773 | static int stac92xx_mono_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 774 | struct snd_ctl_elem_info *uinfo) |
| 775 | { |
| 776 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 777 | struct sigmatel_spec *spec = codec->spec; |
| 778 | return snd_hda_input_mux_info(spec->mono_mux, uinfo); |
| 779 | } |
| 780 | |
| 781 | static int stac92xx_mono_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 782 | struct snd_ctl_elem_value *ucontrol) |
| 783 | { |
| 784 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 785 | struct sigmatel_spec *spec = codec->spec; |
| 786 | |
| 787 | ucontrol->value.enumerated.item[0] = spec->cur_mmux; |
| 788 | return 0; |
| 789 | } |
| 790 | |
| 791 | static int stac92xx_mono_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 792 | struct snd_ctl_elem_value *ucontrol) |
| 793 | { |
| 794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 795 | struct sigmatel_spec *spec = codec->spec; |
| 796 | |
| 797 | return snd_hda_input_mux_put(codec, spec->mono_mux, ucontrol, |
| 798 | spec->mono_nid, &spec->cur_mmux); |
| 799 | } |
| 800 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 801 | static int stac92xx_amp_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 802 | struct snd_ctl_elem_info *uinfo) |
| 803 | { |
| 804 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 805 | struct sigmatel_spec *spec = codec->spec; |
| 806 | return snd_hda_input_mux_info(spec->amp_mux, uinfo); |
| 807 | } |
| 808 | |
| 809 | static int stac92xx_amp_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 810 | struct snd_ctl_elem_value *ucontrol) |
| 811 | { |
| 812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 813 | struct sigmatel_spec *spec = codec->spec; |
| 814 | |
| 815 | ucontrol->value.enumerated.item[0] = spec->cur_amux; |
| 816 | return 0; |
| 817 | } |
| 818 | |
| 819 | static int stac92xx_amp_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 820 | struct snd_ctl_elem_value *ucontrol) |
| 821 | { |
| 822 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 823 | struct sigmatel_spec *spec = codec->spec; |
| 824 | struct snd_kcontrol *ctl = |
| 825 | snd_hda_find_mixer_ctl(codec, "Amp Capture Volume"); |
| 826 | if (!ctl) |
| 827 | return -EINVAL; |
| 828 | |
| 829 | snd_ctl_notify(codec->bus->card, SNDRV_CTL_EVENT_MASK_VALUE | |
| 830 | SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); |
| 831 | |
| 832 | return snd_hda_input_mux_put(codec, spec->amp_mux, ucontrol, |
| 833 | 0, &spec->cur_amux); |
| 834 | } |
| 835 | |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 836 | #define stac92xx_aloopback_info snd_ctl_boolean_mono_info |
| 837 | |
| 838 | static int stac92xx_aloopback_get(struct snd_kcontrol *kcontrol, |
| 839 | struct snd_ctl_elem_value *ucontrol) |
| 840 | { |
| 841 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 842 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 843 | struct sigmatel_spec *spec = codec->spec; |
| 844 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 845 | ucontrol->value.integer.value[0] = !!(spec->aloopback & |
| 846 | (spec->aloopback_mask << idx)); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 847 | return 0; |
| 848 | } |
| 849 | |
| 850 | static int stac92xx_aloopback_put(struct snd_kcontrol *kcontrol, |
| 851 | struct snd_ctl_elem_value *ucontrol) |
| 852 | { |
| 853 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 854 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 855 | unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 856 | unsigned int dac_mode; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 857 | unsigned int val, idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 858 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 859 | idx_val = spec->aloopback_mask << idx; |
| 860 | if (ucontrol->value.integer.value[0]) |
| 861 | val = spec->aloopback | idx_val; |
| 862 | else |
| 863 | val = spec->aloopback & ~idx_val; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 864 | if (spec->aloopback == val) |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 865 | return 0; |
| 866 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 867 | spec->aloopback = val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 868 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 869 | /* Only return the bits defined by the shift value of the |
| 870 | * first two bytes of the mask |
| 871 | */ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 872 | dac_mode = snd_hda_codec_read(codec, codec->afg, 0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 873 | kcontrol->private_value & 0xFFFF, 0x0); |
| 874 | dac_mode >>= spec->aloopback_shift; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 875 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 876 | if (spec->aloopback & idx_val) { |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 877 | snd_hda_power_up(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 878 | dac_mode |= idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 879 | } else { |
| 880 | snd_hda_power_down(codec); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 881 | dac_mode &= ~idx_val; |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 882 | } |
| 883 | |
| 884 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
| 885 | kcontrol->private_value >> 16, dac_mode); |
| 886 | |
| 887 | return 1; |
| 888 | } |
| 889 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 890 | static struct hda_verb stac9200_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 891 | /* set dac0mux for dac converter */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 892 | { 0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 893 | {} |
| 894 | }; |
| 895 | |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 896 | static struct hda_verb stac9200_eapd_init[] = { |
| 897 | /* set dac0mux for dac converter */ |
| 898 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 899 | {0x08, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 900 | {} |
| 901 | }; |
| 902 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 903 | static struct hda_verb stac92hd73xx_6ch_core_init[] = { |
| 904 | /* set master volume and direct control */ |
| 905 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 906 | /* setup adcs to point to mixer */ |
| 907 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 908 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 909 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 910 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 911 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 912 | /* setup import muxs */ |
| 913 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 914 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 915 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 916 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 917 | {} |
| 918 | }; |
| 919 | |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 920 | static struct hda_verb dell_eq_core_init[] = { |
| 921 | /* set master volume to max value without distortion |
| 922 | * and direct control */ |
| 923 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 924 | /* setup adcs to point to mixer */ |
| 925 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 926 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 927 | /* setup import muxs */ |
| 928 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 929 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 930 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 931 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 932 | {} |
| 933 | }; |
| 934 | |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 935 | static struct hda_verb dell_m6_core_init[] = { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 936 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 52fe0f9 | 2008-02-29 12:08:20 +0100 | [diff] [blame] | 937 | /* setup adcs to point to mixer */ |
| 938 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 939 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 940 | /* setup import muxs */ |
| 941 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 942 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 943 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 944 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 945 | {} |
| 946 | }; |
| 947 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 948 | static struct hda_verb stac92hd73xx_8ch_core_init[] = { |
| 949 | /* set master volume and direct control */ |
| 950 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 951 | /* setup adcs to point to mixer */ |
| 952 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 953 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 954 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 955 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 956 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 957 | /* setup import muxs */ |
| 958 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 959 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 960 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 961 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 962 | {} |
| 963 | }; |
| 964 | |
| 965 | static struct hda_verb stac92hd73xx_10ch_core_init[] = { |
| 966 | /* set master volume and direct control */ |
| 967 | { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 968 | /* dac3 is connected to import3 mux */ |
| 969 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 970 | /* setup adcs to point to mixer */ |
| 971 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
| 972 | { 0x21, AC_VERB_SET_CONNECT_SEL, 0x0b}, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 973 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 974 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 975 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 976 | /* setup import muxs */ |
| 977 | { 0x28, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 978 | { 0x29, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 979 | { 0x2a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 980 | { 0x2b, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 981 | {} |
| 982 | }; |
| 983 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 984 | static struct hda_verb stac92hd83xxx_core_init[] = { |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 985 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 986 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1}, |
| 987 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 988 | |
| 989 | /* power state controls amps */ |
| 990 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 991 | {} |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 992 | }; |
| 993 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 994 | static struct hda_verb stac92hd71bxx_core_init[] = { |
| 995 | /* set master volume and direct control */ |
| 996 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 997 | {} |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 998 | }; |
| 999 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 1000 | #define HD_DISABLE_PORTF 1 |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1001 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 1002 | /* start of config #1 */ |
| 1003 | |
| 1004 | /* connect port 0f to audio mixer */ |
| 1005 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 1006 | /* start of config #2 */ |
| 1007 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1008 | /* set master volume and direct control */ |
| 1009 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 1010 | {} |
| 1011 | }; |
| 1012 | |
| 1013 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { |
| 1014 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ |
| 1015 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1016 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 1017 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1018 | {} |
| 1019 | }; |
| 1020 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1021 | static struct hda_verb stac925x_core_init[] = { |
| 1022 | /* set dac0mux for dac converter */ |
| 1023 | { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 1024 | /* mute the master volume */ |
| 1025 | { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1026 | {} |
| 1027 | }; |
| 1028 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1029 | static struct hda_verb stac922x_core_init[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1030 | /* set master volume and direct control */ |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1031 | { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1032 | {} |
| 1033 | }; |
| 1034 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1035 | static struct hda_verb d965_core_init[] = { |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1036 | /* set master volume and direct control */ |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 1037 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 1038 | /* unmute node 0x1b */ |
| 1039 | { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 1040 | /* select node 0x03 as DAC */ |
| 1041 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1042 | {} |
| 1043 | }; |
| 1044 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1045 | static struct hda_verb stac927x_core_init[] = { |
| 1046 | /* set master volume and direct control */ |
| 1047 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 1048 | /* enable analog pc beep path */ |
| 1049 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 1050 | {} |
| 1051 | }; |
| 1052 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1053 | static struct hda_verb stac9205_core_init[] = { |
| 1054 | /* set master volume and direct control */ |
| 1055 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1056 | /* enable analog pc beep path */ |
| 1057 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 1058 | {} |
| 1059 | }; |
| 1060 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 1061 | #define STAC_MONO_MUX \ |
| 1062 | { \ |
| 1063 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1064 | .name = "Mono Mux", \ |
| 1065 | .count = 1, \ |
| 1066 | .info = stac92xx_mono_mux_enum_info, \ |
| 1067 | .get = stac92xx_mono_mux_enum_get, \ |
| 1068 | .put = stac92xx_mono_mux_enum_put, \ |
| 1069 | } |
| 1070 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 1071 | #define STAC_AMP_MUX \ |
| 1072 | { \ |
| 1073 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1074 | .name = "Amp Selector Capture Switch", \ |
| 1075 | .count = 1, \ |
| 1076 | .info = stac92xx_amp_mux_enum_info, \ |
| 1077 | .get = stac92xx_amp_mux_enum_get, \ |
| 1078 | .put = stac92xx_amp_mux_enum_put, \ |
| 1079 | } |
| 1080 | |
| 1081 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ |
| 1082 | { \ |
| 1083 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1084 | .name = xname, \ |
| 1085 | .index = 0, \ |
| 1086 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
| 1087 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
| 1088 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
| 1089 | .info = stac92xx_amp_volume_info, \ |
| 1090 | .get = stac92xx_amp_volume_get, \ |
| 1091 | .put = stac92xx_amp_volume_put, \ |
| 1092 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ |
| 1093 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ |
| 1094 | } |
| 1095 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1096 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 1097 | { \ |
| 1098 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1099 | .name = "Analog Loopback", \ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1100 | .count = cnt, \ |
Maxim Levitsky | 5f10c4a | 2007-09-03 15:29:37 +0200 | [diff] [blame] | 1101 | .info = stac92xx_aloopback_info, \ |
| 1102 | .get = stac92xx_aloopback_get, \ |
| 1103 | .put = stac92xx_aloopback_put, \ |
| 1104 | .private_value = verb_read | (verb_write << 16), \ |
| 1105 | } |
| 1106 | |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 1107 | #define DC_BIAS(xname, idx, nid) \ |
| 1108 | { \ |
| 1109 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 1110 | .name = xname, \ |
| 1111 | .index = idx, \ |
| 1112 | .info = stac92xx_dc_bias_info, \ |
| 1113 | .get = stac92xx_dc_bias_get, \ |
| 1114 | .put = stac92xx_dc_bias_put, \ |
| 1115 | .private_value = nid, \ |
| 1116 | } |
| 1117 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1118 | static struct snd_kcontrol_new stac9200_mixer[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1119 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
| 1120 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1121 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
| 1122 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1123 | { } /* end */ |
| 1124 | }; |
| 1125 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1126 | #define DELL_M6_MIXER 6 |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1127 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 1128 | /* start of config #1 */ |
| 1129 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1130 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1131 | |
| 1132 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1133 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1134 | |
| 1135 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1136 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1137 | |
| 1138 | /* start of config #2 */ |
| 1139 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1140 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1141 | |
| 1142 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1143 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1144 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1145 | { } /* end */ |
| 1146 | }; |
| 1147 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1148 | static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
| 1149 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
| 1150 | {} |
| 1151 | }; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1152 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1153 | static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { |
| 1154 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
| 1155 | {} |
| 1156 | }; |
| 1157 | |
| 1158 | static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { |
| 1159 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), |
| 1160 | {} |
| 1161 | }; |
| 1162 | |
| 1163 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1164 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1165 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1166 | |
| 1167 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1168 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1169 | |
| 1170 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1171 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1172 | |
| 1173 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1174 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1175 | |
| 1176 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1177 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1178 | { } /* end */ |
| 1179 | }; |
| 1180 | |
| 1181 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1182 | HDA_CODEC_VOLUME("Front Mic Mixer Capture Volume", 0x1d, 0, HDA_INPUT), |
| 1183 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
| 1184 | |
| 1185 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), |
| 1186 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), |
| 1187 | |
| 1188 | HDA_CODEC_VOLUME("Line In Mixer Capture Volume", 0x1d, 0x2, HDA_INPUT), |
| 1189 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
| 1190 | |
| 1191 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
| 1192 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
| 1193 | |
| 1194 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), |
| 1195 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), |
| 1196 | { } /* end */ |
| 1197 | }; |
| 1198 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1199 | |
| 1200 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1201 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), |
| 1202 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1203 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1204 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1206 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1207 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT), |
| 1208 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1209 | |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1210 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT), |
| 1211 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1212 | |
| 1213 | /* |
Matthew Ranostay | 74b7ff4 | 2008-12-20 17:47:24 -0500 | [diff] [blame] | 1214 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT), |
| 1215 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT), |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1216 | */ |
| 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1220 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
Matthew Ranostay | 687cb98e | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1221 | HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x0, HDA_INPUT), |
| 1222 | HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x0, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1223 | |
Matthew Ranostay | 687cb98e | 2008-10-11 13:52:43 -0400 | [diff] [blame] | 1224 | HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x1, HDA_INPUT), |
| 1225 | HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x1, HDA_INPUT), |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1226 | |
| 1227 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT), |
| 1228 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT), |
| 1229 | |
| 1230 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT), |
| 1231 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1232 | { } /* end */ |
| 1233 | }; |
| 1234 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1235 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
| 1236 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
| 1237 | }; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 1238 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1239 | static struct snd_kcontrol_new stac925x_mixer[] = { |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 1240 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), |
| 1241 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 1242 | { } /* end */ |
| 1243 | }; |
| 1244 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1245 | static struct snd_kcontrol_new stac9205_loopback[] = { |
| 1246 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), |
| 1247 | {} |
| 1248 | }; |
| 1249 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1250 | static struct snd_kcontrol_new stac927x_loopback[] = { |
| 1251 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), |
| 1252 | {} |
| 1253 | }; |
| 1254 | |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1255 | static struct snd_kcontrol_new stac_dmux_mixer = { |
| 1256 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1257 | .name = "Digital Input Source", |
| 1258 | /* count set later */ |
| 1259 | .info = stac92xx_dmux_enum_info, |
| 1260 | .get = stac92xx_dmux_enum_get, |
| 1261 | .put = stac92xx_dmux_enum_put, |
| 1262 | }; |
| 1263 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1264 | static struct snd_kcontrol_new stac_smux_mixer = { |
| 1265 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Matthew Ranostay | e348797 | 2008-09-08 11:36:59 -0400 | [diff] [blame] | 1266 | .name = "IEC958 Playback Source", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1267 | /* count set later */ |
| 1268 | .info = stac92xx_smux_enum_info, |
| 1269 | .get = stac92xx_smux_enum_get, |
| 1270 | .put = stac92xx_smux_enum_put, |
| 1271 | }; |
| 1272 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1273 | static const char *slave_vols[] = { |
| 1274 | "Front Playback Volume", |
| 1275 | "Surround Playback Volume", |
| 1276 | "Center Playback Volume", |
| 1277 | "LFE Playback Volume", |
| 1278 | "Side Playback Volume", |
| 1279 | "Headphone Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1280 | "Speaker Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1281 | NULL |
| 1282 | }; |
| 1283 | |
| 1284 | static const char *slave_sws[] = { |
| 1285 | "Front Playback Switch", |
| 1286 | "Surround Playback Switch", |
| 1287 | "Center Playback Switch", |
| 1288 | "LFE Playback Switch", |
| 1289 | "Side Playback Switch", |
| 1290 | "Headphone Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1291 | "Speaker Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1292 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1293 | NULL |
| 1294 | }; |
| 1295 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1296 | static void stac92xx_free_kctls(struct hda_codec *codec); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1297 | 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] | 1298 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1299 | static int stac92xx_build_controls(struct hda_codec *codec) |
| 1300 | { |
| 1301 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1302 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 1303 | hda_nid_t nid; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1304 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1305 | int i; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1306 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 1307 | if (spec->mixer) { |
| 1308 | err = snd_hda_add_new_ctls(codec, spec->mixer); |
| 1309 | if (err < 0) |
| 1310 | return err; |
| 1311 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1312 | |
| 1313 | for (i = 0; i < spec->num_mixers; i++) { |
| 1314 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1315 | if (err < 0) |
| 1316 | return err; |
| 1317 | } |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 1318 | if (!spec->auto_mic && spec->num_dmuxes > 0) { |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1319 | stac_dmux_mixer.count = spec->num_dmuxes; |
Takashi Iwai | d13bd41 | 2008-07-30 15:01:45 +0200 | [diff] [blame] | 1320 | err = snd_hda_ctl_add(codec, |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 1321 | snd_ctl_new1(&stac_dmux_mixer, codec)); |
| 1322 | if (err < 0) |
| 1323 | return err; |
| 1324 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1325 | if (spec->num_smuxes > 0) { |
Matthew Ranostay | 00ef50c | 2008-09-27 18:13:47 -0400 | [diff] [blame] | 1326 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); |
| 1327 | struct hda_input_mux *smux = &spec->private_smux; |
| 1328 | /* check for mute support on SPDIF out */ |
| 1329 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 1330 | smux->items[smux->num_items].label = "Off"; |
| 1331 | smux->items[smux->num_items].index = 0; |
| 1332 | smux->num_items++; |
| 1333 | spec->spdif_mute = 1; |
| 1334 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1335 | stac_smux_mixer.count = spec->num_smuxes; |
Takashi Iwai | 4f2d23e | 2008-12-19 10:14:13 +0100 | [diff] [blame] | 1336 | err = snd_hda_ctl_add(codec, |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 1337 | snd_ctl_new1(&stac_smux_mixer, codec)); |
| 1338 | if (err < 0) |
| 1339 | return err; |
| 1340 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 1341 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1342 | if (spec->multiout.dig_out_nid) { |
| 1343 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
| 1344 | if (err < 0) |
| 1345 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1346 | err = snd_hda_create_spdif_share_sw(codec, |
| 1347 | &spec->multiout); |
| 1348 | if (err < 0) |
| 1349 | return err; |
| 1350 | spec->multiout.share_spdif = 1; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1351 | } |
Harvey Harrison | da74ae3 | 2008-10-21 20:28:04 -0700 | [diff] [blame] | 1352 | if (spec->dig_in_nid && !(spec->gpio_dir & 0x01)) { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1353 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1354 | if (err < 0) |
| 1355 | return err; |
| 1356 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1357 | |
| 1358 | /* if we have no master control, let's create it */ |
| 1359 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1360 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1361 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1362 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 1363 | /* correct volume offset */ |
| 1364 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1365 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1366 | vmaster_tlv, slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1367 | if (err < 0) |
| 1368 | return err; |
| 1369 | } |
| 1370 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1371 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1372 | NULL, slave_sws); |
| 1373 | if (err < 0) |
| 1374 | return err; |
| 1375 | } |
| 1376 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 1377 | if (spec->aloopback_ctl && |
| 1378 | snd_hda_get_bool_hint(codec, "loopback") == 1) { |
| 1379 | err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); |
| 1380 | if (err < 0) |
| 1381 | return err; |
| 1382 | } |
| 1383 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 1384 | stac92xx_free_kctls(codec); /* no longer needed */ |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 1385 | |
| 1386 | /* create jack input elements */ |
| 1387 | if (spec->hp_detect) { |
| 1388 | for (i = 0; i < cfg->hp_outs; i++) { |
| 1389 | int type = SND_JACK_HEADPHONE; |
| 1390 | nid = cfg->hp_pins[i]; |
| 1391 | /* jack detection */ |
| 1392 | if (cfg->hp_outs == i) |
| 1393 | type |= SND_JACK_LINEOUT; |
| 1394 | err = stac92xx_add_jack(codec, nid, type); |
| 1395 | if (err < 0) |
| 1396 | return err; |
| 1397 | } |
| 1398 | } |
| 1399 | for (i = 0; i < cfg->line_outs; i++) { |
| 1400 | err = stac92xx_add_jack(codec, cfg->line_out_pins[i], |
| 1401 | SND_JACK_LINEOUT); |
| 1402 | if (err < 0) |
| 1403 | return err; |
| 1404 | } |
| 1405 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 1406 | nid = cfg->input_pins[i]; |
| 1407 | if (nid) { |
| 1408 | err = stac92xx_add_jack(codec, nid, |
| 1409 | SND_JACK_MICROPHONE); |
| 1410 | if (err < 0) |
| 1411 | return err; |
| 1412 | } |
| 1413 | } |
| 1414 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1415 | return 0; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1416 | } |
| 1417 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1418 | static unsigned int ref9200_pin_configs[8] = { |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 1419 | 0x01c47010, 0x01447010, 0x0221401f, 0x01114010, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1420 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
| 1421 | }; |
| 1422 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1423 | static unsigned int gateway9200_m4_pin_configs[8] = { |
| 1424 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1425 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1426 | }; |
| 1427 | static unsigned int gateway9200_m4_2_pin_configs[8] = { |
| 1428 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, |
| 1429 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, |
| 1430 | }; |
| 1431 | |
| 1432 | /* |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1433 | STAC 9200 pin configs for |
| 1434 | 102801A8 |
| 1435 | 102801DE |
| 1436 | 102801E8 |
| 1437 | */ |
| 1438 | static unsigned int dell9200_d21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1439 | 0x400001f0, 0x400001f1, 0x02214030, 0x01014010, |
| 1440 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1441 | }; |
| 1442 | |
| 1443 | /* |
| 1444 | STAC 9200 pin configs for |
| 1445 | 102801C0 |
| 1446 | 102801C1 |
| 1447 | */ |
| 1448 | static unsigned int dell9200_d22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1449 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1450 | 0x01813020, 0x02a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1451 | }; |
| 1452 | |
| 1453 | /* |
| 1454 | STAC 9200 pin configs for |
| 1455 | 102801C4 (Dell Dimension E310) |
| 1456 | 102801C5 |
| 1457 | 102801C7 |
| 1458 | 102801D9 |
| 1459 | 102801DA |
| 1460 | 102801E3 |
| 1461 | */ |
| 1462 | static unsigned int dell9200_d23_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1463 | 0x400001f0, 0x400001f1, 0x0221401f, 0x01014010, |
| 1464 | 0x01813020, 0x01a19021, 0x90100140, 0x400001f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1465 | }; |
| 1466 | |
| 1467 | |
| 1468 | /* |
| 1469 | STAC 9200-32 pin configs for |
| 1470 | 102801B5 (Dell Inspiron 630m) |
| 1471 | 102801D8 (Dell Inspiron 640m) |
| 1472 | */ |
| 1473 | static unsigned int dell9200_m21_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1474 | 0x40c003fa, 0x03441340, 0x0321121f, 0x90170310, |
| 1475 | 0x408003fb, 0x03a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1476 | }; |
| 1477 | |
| 1478 | /* |
| 1479 | STAC 9200-32 pin configs for |
| 1480 | 102801C2 (Dell Latitude D620) |
| 1481 | 102801C8 |
| 1482 | 102801CC (Dell Latitude D820) |
| 1483 | 102801D4 |
| 1484 | 102801D6 |
| 1485 | */ |
| 1486 | static unsigned int dell9200_m22_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1487 | 0x40c003fa, 0x0144131f, 0x0321121f, 0x90170310, |
| 1488 | 0x90a70321, 0x03a11020, 0x401003fb, 0x40f000fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1489 | }; |
| 1490 | |
| 1491 | /* |
| 1492 | STAC 9200-32 pin configs for |
| 1493 | 102801CE (Dell XPS M1710) |
| 1494 | 102801CF (Dell Precision M90) |
| 1495 | */ |
| 1496 | static unsigned int dell9200_m23_pin_configs[8] = { |
| 1497 | 0x40c003fa, 0x01441340, 0x0421421f, 0x90170310, |
| 1498 | 0x408003fb, 0x04a1102e, 0x90170311, 0x403003fc, |
| 1499 | }; |
| 1500 | |
| 1501 | /* |
| 1502 | STAC 9200-32 pin configs for |
| 1503 | 102801C9 |
| 1504 | 102801CA |
| 1505 | 102801CB (Dell Latitude 120L) |
| 1506 | 102801D3 |
| 1507 | */ |
| 1508 | static unsigned int dell9200_m24_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1509 | 0x40c003fa, 0x404003fb, 0x0321121f, 0x90170310, |
| 1510 | 0x408003fc, 0x03a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1511 | }; |
| 1512 | |
| 1513 | /* |
| 1514 | STAC 9200-32 pin configs for |
| 1515 | 102801BD (Dell Inspiron E1505n) |
| 1516 | 102801EE |
| 1517 | 102801EF |
| 1518 | */ |
| 1519 | static unsigned int dell9200_m25_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1520 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1521 | 0x408003fb, 0x04a11020, 0x401003fc, 0x403003fd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1522 | }; |
| 1523 | |
| 1524 | /* |
| 1525 | STAC 9200-32 pin configs for |
| 1526 | 102801F5 (Dell Inspiron 1501) |
| 1527 | 102801F6 |
| 1528 | */ |
| 1529 | static unsigned int dell9200_m26_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1530 | 0x40c003fa, 0x404003fb, 0x0421121f, 0x90170310, |
| 1531 | 0x408003fc, 0x04a11020, 0x401003fd, 0x403003fe, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1532 | }; |
| 1533 | |
| 1534 | /* |
| 1535 | STAC 9200-32 |
| 1536 | 102801CD (Dell Inspiron E1705/9400) |
| 1537 | */ |
| 1538 | static unsigned int dell9200_m27_pin_configs[8] = { |
Takashi Iwai | af6c016 | 2007-09-05 23:46:03 +0200 | [diff] [blame] | 1539 | 0x40c003fa, 0x01441340, 0x0421121f, 0x90170310, |
| 1540 | 0x90170310, 0x04a11020, 0x90170310, 0x40f003fc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1541 | }; |
| 1542 | |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1543 | static unsigned int oqo9200_pin_configs[8] = { |
| 1544 | 0x40c000f0, 0x404000f1, 0x0221121f, 0x02211210, |
| 1545 | 0x90170111, 0x90a70120, 0x400000f2, 0x400000f3, |
| 1546 | }; |
| 1547 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1548 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1549 | static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { |
| 1550 | [STAC_REF] = ref9200_pin_configs, |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1551 | [STAC_9200_OQO] = oqo9200_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1552 | [STAC_9200_DELL_D21] = dell9200_d21_pin_configs, |
| 1553 | [STAC_9200_DELL_D22] = dell9200_d22_pin_configs, |
| 1554 | [STAC_9200_DELL_D23] = dell9200_d23_pin_configs, |
| 1555 | [STAC_9200_DELL_M21] = dell9200_m21_pin_configs, |
| 1556 | [STAC_9200_DELL_M22] = dell9200_m22_pin_configs, |
| 1557 | [STAC_9200_DELL_M23] = dell9200_m23_pin_configs, |
| 1558 | [STAC_9200_DELL_M24] = dell9200_m24_pin_configs, |
| 1559 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
| 1560 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
| 1561 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1562 | [STAC_9200_M4] = gateway9200_m4_pin_configs, |
| 1563 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1564 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1565 | }; |
| 1566 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1567 | static const char *stac9200_models[STAC_9200_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1568 | [STAC_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1569 | [STAC_REF] = "ref", |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1570 | [STAC_9200_OQO] = "oqo", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1571 | [STAC_9200_DELL_D21] = "dell-d21", |
| 1572 | [STAC_9200_DELL_D22] = "dell-d22", |
| 1573 | [STAC_9200_DELL_D23] = "dell-d23", |
| 1574 | [STAC_9200_DELL_M21] = "dell-m21", |
| 1575 | [STAC_9200_DELL_M22] = "dell-m22", |
| 1576 | [STAC_9200_DELL_M23] = "dell-m23", |
| 1577 | [STAC_9200_DELL_M24] = "dell-m24", |
| 1578 | [STAC_9200_DELL_M25] = "dell-m25", |
| 1579 | [STAC_9200_DELL_M26] = "dell-m26", |
| 1580 | [STAC_9200_DELL_M27] = "dell-m27", |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1581 | [STAC_9200_M4] = "gateway-m4", |
| 1582 | [STAC_9200_M4_2] = "gateway-m4-2", |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1583 | [STAC_9200_PANASONIC] = "panasonic", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1584 | }; |
| 1585 | |
| 1586 | static struct snd_pci_quirk stac9200_cfg_tbl[] = { |
| 1587 | /* SigmaTel reference board */ |
| 1588 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1589 | "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1590 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1591 | "DFI LanParty", STAC_REF), |
Matt Porter | e737707 | 2006-11-06 11:20:38 +0100 | [diff] [blame] | 1592 | /* Dell laptops have BIOS problem */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
| 1594 | "unknown Dell", STAC_9200_DELL_D21), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1595 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1596 | "Dell Inspiron 630m", STAC_9200_DELL_M21), |
| 1597 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bd, |
| 1598 | "Dell Inspiron E1505n", STAC_9200_DELL_M25), |
| 1599 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c0, |
| 1600 | "unknown Dell", STAC_9200_DELL_D22), |
| 1601 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c1, |
| 1602 | "unknown Dell", STAC_9200_DELL_D22), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1603 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1604 | "Dell Latitude D620", STAC_9200_DELL_M22), |
| 1605 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c5, |
| 1606 | "unknown Dell", STAC_9200_DELL_D23), |
| 1607 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c7, |
| 1608 | "unknown Dell", STAC_9200_DELL_D23), |
| 1609 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c8, |
| 1610 | "unknown Dell", STAC_9200_DELL_M22), |
| 1611 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c9, |
| 1612 | "unknown Dell", STAC_9200_DELL_M24), |
| 1613 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ca, |
| 1614 | "unknown Dell", STAC_9200_DELL_M24), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 1615 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1616 | "Dell Latitude 120L", STAC_9200_DELL_M24), |
Cory T. Tusar | 877b866 | 2007-01-30 17:30:55 +0100 | [diff] [blame] | 1617 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cc, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1618 | "Dell Latitude D820", STAC_9200_DELL_M22), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1619 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cd, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1620 | "Dell Inspiron E1705/9400", STAC_9200_DELL_M27), |
Mikael Nilsson | 46f02ca | 2007-02-13 12:46:16 +0100 | [diff] [blame] | 1621 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ce, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1622 | "Dell XPS M1710", STAC_9200_DELL_M23), |
Takashi Iwai | f0f9674 | 2007-02-14 00:59:17 +0100 | [diff] [blame] | 1623 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cf, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1624 | "Dell Precision M90", STAC_9200_DELL_M23), |
| 1625 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d3, |
| 1626 | "unknown Dell", STAC_9200_DELL_M22), |
| 1627 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d4, |
| 1628 | "unknown Dell", STAC_9200_DELL_M22), |
Daniel T Chen | 8286c53 | 2007-05-15 11:46:23 +0200 | [diff] [blame] | 1629 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d6, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1630 | "unknown Dell", STAC_9200_DELL_M22), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1631 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d8, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1632 | "Dell Inspiron 640m", STAC_9200_DELL_M21), |
| 1633 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d9, |
| 1634 | "unknown Dell", STAC_9200_DELL_D23), |
| 1635 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01da, |
| 1636 | "unknown Dell", STAC_9200_DELL_D23), |
| 1637 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01de, |
| 1638 | "unknown Dell", STAC_9200_DELL_D21), |
| 1639 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e3, |
| 1640 | "unknown Dell", STAC_9200_DELL_D23), |
| 1641 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01e8, |
| 1642 | "unknown Dell", STAC_9200_DELL_D21), |
| 1643 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ee, |
| 1644 | "unknown Dell", STAC_9200_DELL_M25), |
| 1645 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ef, |
| 1646 | "unknown Dell", STAC_9200_DELL_M25), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1647 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f5, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1648 | "Dell Inspiron 1501", STAC_9200_DELL_M26), |
| 1649 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f6, |
| 1650 | "unknown Dell", STAC_9200_DELL_M26), |
Tobin Davis | 49c605d | 2007-05-17 09:38:24 +0200 | [diff] [blame] | 1651 | /* Panasonic */ |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 1652 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 1653 | /* Gateway machines needs EAPD to be set on resume */ |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1654 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
| 1655 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
| 1656 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 1657 | /* OQO Mobile */ |
| 1658 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1659 | {} /* terminator */ |
| 1660 | }; |
| 1661 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1662 | static unsigned int ref925x_pin_configs[8] = { |
| 1663 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 1664 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1665 | }; |
| 1666 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1667 | static unsigned int stac925xM1_pin_configs[8] = { |
| 1668 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1669 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1670 | }; |
| 1671 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1672 | static unsigned int stac925xM1_2_pin_configs[8] = { |
| 1673 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1674 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1675 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1676 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1677 | static unsigned int stac925xM2_pin_configs[8] = { |
| 1678 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1679 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1680 | }; |
| 1681 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1682 | static unsigned int stac925xM2_2_pin_configs[8] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1683 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1684 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1685 | }; |
| 1686 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1687 | static unsigned int stac925xM3_pin_configs[8] = { |
| 1688 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1689 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, |
| 1690 | }; |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1691 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1692 | static unsigned int stac925xM5_pin_configs[8] = { |
| 1693 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1694 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
| 1695 | }; |
| 1696 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1697 | static unsigned int stac925xM6_pin_configs[8] = { |
| 1698 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
| 1699 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1700 | }; |
| 1701 | |
| 1702 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
| 1703 | [STAC_REF] = ref925x_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1704 | [STAC_M1] = stac925xM1_pin_configs, |
| 1705 | [STAC_M1_2] = stac925xM1_2_pin_configs, |
| 1706 | [STAC_M2] = stac925xM2_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1707 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1708 | [STAC_M3] = stac925xM3_pin_configs, |
| 1709 | [STAC_M5] = stac925xM5_pin_configs, |
| 1710 | [STAC_M6] = stac925xM6_pin_configs, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1711 | }; |
| 1712 | |
| 1713 | static const char *stac925x_models[STAC_925x_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1714 | [STAC_925x_AUTO] = "auto", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1715 | [STAC_REF] = "ref", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1716 | [STAC_M1] = "m1", |
| 1717 | [STAC_M1_2] = "m1-2", |
| 1718 | [STAC_M2] = "m2", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1719 | [STAC_M2_2] = "m2-2", |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1720 | [STAC_M3] = "m3", |
| 1721 | [STAC_M5] = "m5", |
| 1722 | [STAC_M6] = "m6", |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1723 | }; |
| 1724 | |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1725 | static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1726 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), |
| 1727 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), |
| 1728 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), |
| 1729 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1730 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1731 | /* Not sure about the brand name for those */ |
| 1732 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), |
| 1733 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), |
| 1734 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), |
| 1735 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1736 | {} /* terminator */ |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1737 | }; |
| 1738 | |
| 1739 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
| 1740 | /* SigmaTel reference board */ |
| 1741 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1742 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 1743 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 1744 | |
| 1745 | /* Default table for unknown ID */ |
| 1746 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
| 1747 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 1748 | {} /* terminator */ |
| 1749 | }; |
| 1750 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1751 | static unsigned int ref92hd73xx_pin_configs[13] = { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1752 | 0x02214030, 0x02a19040, 0x01a19020, 0x02214030, |
| 1753 | 0x0181302e, 0x01014010, 0x01014020, 0x01014030, |
| 1754 | 0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1755 | 0x01452050, |
| 1756 | }; |
| 1757 | |
| 1758 | static unsigned int dell_m6_pin_configs[13] = { |
| 1759 | 0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 1760 | 0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1761 | 0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, |
| 1762 | 0x4f0000f0, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1763 | }; |
| 1764 | |
| 1765 | static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1766 | [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1767 | [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, |
| 1768 | [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, |
| 1769 | [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1770 | [STAC_DELL_EQ] = dell_m6_pin_configs, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1771 | }; |
| 1772 | |
| 1773 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1774 | [STAC_92HD73XX_AUTO] = "auto", |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 1775 | [STAC_92HD73XX_NO_JD] = "no-jd", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1776 | [STAC_92HD73XX_REF] = "ref", |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1777 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
| 1778 | [STAC_DELL_M6_DMIC] = "dell-m6-dmic", |
| 1779 | [STAC_DELL_M6_BOTH] = "dell-m6", |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 1780 | [STAC_DELL_EQ] = "dell-eq", |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1781 | }; |
| 1782 | |
| 1783 | static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { |
| 1784 | /* SigmaTel reference board */ |
| 1785 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1786 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1787 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1788 | "DFI LanParty", STAC_92HD73XX_REF), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1789 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1790 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1791 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1792 | "unknown Dell", STAC_DELL_M6_DMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1793 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1794 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1795 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1796 | "unknown Dell", STAC_DELL_M6_BOTH), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1797 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1798 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1799 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1800 | "unknown Dell", STAC_DELL_M6_AMIC), |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1801 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1802 | "unknown Dell", STAC_DELL_M6_DMIC), |
| 1803 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, |
| 1804 | "unknown Dell", STAC_DELL_M6_DMIC), |
Takashi Iwai | b0fc5e0 | 2008-11-21 08:37:03 +0100 | [diff] [blame] | 1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 1806 | "Dell Studio 1537", STAC_DELL_M6_DMIC), |
Joerg Schirottke | fa620e9 | 2008-12-19 08:13:49 +0100 | [diff] [blame] | 1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, |
| 1808 | "Dell Studio 17", STAC_DELL_M6_DMIC), |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 1809 | {} /* terminator */ |
| 1810 | }; |
| 1811 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1812 | static unsigned int ref92hd83xxx_pin_configs[10] = { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1813 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
| 1814 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1815 | 0x01451160, 0x98560170, |
| 1816 | }; |
| 1817 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1818 | static unsigned int dell_s14_pin_configs[10] = { |
| 1819 | 0x02214030, 0x02211010, 0x02a19020, 0x01014050, |
| 1820 | 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160, |
| 1821 | 0x40f000f0, 0x40f000f0, |
| 1822 | }; |
| 1823 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1824 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
| 1825 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1826 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1827 | [STAC_DELL_S14] = dell_s14_pin_configs, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1828 | }; |
| 1829 | |
| 1830 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1831 | [STAC_92HD83XXX_AUTO] = "auto", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1832 | [STAC_92HD83XXX_REF] = "ref", |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 1833 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1834 | [STAC_DELL_S14] = "dell-s14", |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1835 | }; |
| 1836 | |
| 1837 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
| 1838 | /* SigmaTel reference board */ |
| 1839 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
Takashi Iwai | f9d088b | 2009-01-13 11:54:49 +0100 | [diff] [blame] | 1840 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1841 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1842 | "DFI LanParty", STAC_92HD83XXX_REF), |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 1843 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, |
| 1844 | "unknown Dell", STAC_DELL_S14), |
Herton Ronaldo Krzesinski | 574f3c4 | 2008-12-23 16:53:00 -0200 | [diff] [blame] | 1845 | {} /* terminator */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 1846 | }; |
| 1847 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1848 | static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1849 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 1850 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1851 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
| 1852 | 0x00000000 |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1853 | }; |
| 1854 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1855 | static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1856 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
Matthew Ranostay | 07bcb31 | 2008-03-20 12:10:57 +0100 | [diff] [blame] | 1857 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1858 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
| 1859 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1860 | }; |
| 1861 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1862 | static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1863 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1864 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1865 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1866 | 0x00000000 |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1867 | }; |
| 1868 | |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1869 | static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1870 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
| 1871 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 1872 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
| 1873 | 0x00000000 |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1874 | }; |
| 1875 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1876 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
| 1877 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1878 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
| 1879 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1880 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1881 | [STAC_HP_M4] = NULL, |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1882 | [STAC_HP_DV5] = NULL, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1883 | [STAC_HP_HDX] = NULL, |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1884 | [STAC_HP_DV4_1222NR] = NULL, |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1885 | }; |
| 1886 | |
| 1887 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 1888 | [STAC_92HD71BXX_AUTO] = "auto", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1889 | [STAC_92HD71BXX_REF] = "ref", |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1890 | [STAC_DELL_M4_1] = "dell-m4-1", |
| 1891 | [STAC_DELL_M4_2] = "dell-m4-2", |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1892 | [STAC_DELL_M4_3] = "dell-m4-3", |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 1893 | [STAC_HP_M4] = "hp-m4", |
Takashi Iwai | 1b0652e | 2009-01-14 08:27:35 +0100 | [diff] [blame] | 1894 | [STAC_HP_DV5] = "hp-dv5", |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1895 | [STAC_HP_HDX] = "hp-hdx", |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1896 | [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr", |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1897 | }; |
| 1898 | |
| 1899 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
| 1900 | /* SigmaTel reference board */ |
| 1901 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 1902 | "DFI LanParty", STAC_92HD71BXX_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 1903 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 1904 | "DFI LanParty", STAC_92HD71BXX_REF), |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 1905 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fb, |
| 1906 | "HP dv4-1222nr", STAC_HP_DV4_1222NR), |
Takashi Iwai | 58d8395 | 2009-03-13 17:04:34 +0100 | [diff] [blame] | 1907 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
| 1908 | "HP", STAC_HP_DV5), |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1909 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
| 1910 | "HP dv4-7", STAC_HP_DV5), |
| 1911 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, |
| 1912 | "HP dv4-7", STAC_HP_DV5), |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1913 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, |
| 1914 | "HP HDX", STAC_HP_HDX), /* HDX18 */ |
Matthew Ranostay | 9a9e235 | 2008-09-26 10:37:03 -0400 | [diff] [blame] | 1915 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
Takashi Iwai | 2ae466f | 2009-02-16 14:16:36 +0100 | [diff] [blame] | 1916 | "HP mini 1000", STAC_HP_M4), |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 1917 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 1918 | "HP HDX", STAC_HP_HDX), /* HDX16 */ |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 1919 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
| 1920 | "unknown Dell", STAC_DELL_M4_1), |
| 1921 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
| 1922 | "unknown Dell", STAC_DELL_M4_1), |
| 1923 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0250, |
| 1924 | "unknown Dell", STAC_DELL_M4_1), |
| 1925 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024f, |
| 1926 | "unknown Dell", STAC_DELL_M4_1), |
| 1927 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x024d, |
| 1928 | "unknown Dell", STAC_DELL_M4_1), |
| 1929 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0251, |
| 1930 | "unknown Dell", STAC_DELL_M4_1), |
| 1931 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0277, |
| 1932 | "unknown Dell", STAC_DELL_M4_1), |
| 1933 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0263, |
| 1934 | "unknown Dell", STAC_DELL_M4_2), |
| 1935 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0265, |
| 1936 | "unknown Dell", STAC_DELL_M4_2), |
| 1937 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0262, |
| 1938 | "unknown Dell", STAC_DELL_M4_2), |
| 1939 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, |
| 1940 | "unknown Dell", STAC_DELL_M4_2), |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 1941 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, |
| 1942 | "unknown Dell", STAC_DELL_M4_3), |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 1943 | {} /* terminator */ |
| 1944 | }; |
| 1945 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1946 | static unsigned int ref922x_pin_configs[10] = { |
| 1947 | 0x01014010, 0x01016011, 0x01012012, 0x0221401f, |
| 1948 | 0x01813122, 0x01011014, 0x01441030, 0x01c41030, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 1949 | 0x40000100, 0x40000100, |
| 1950 | }; |
| 1951 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1952 | /* |
| 1953 | STAC 922X pin configs for |
| 1954 | 102801A7 |
| 1955 | 102801AB |
| 1956 | 102801A9 |
| 1957 | 102801D1 |
| 1958 | 102801D2 |
| 1959 | */ |
| 1960 | static unsigned int dell_922x_d81_pin_configs[10] = { |
| 1961 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1962 | 0x02a19020, 0x01117011, 0x400001f0, 0x400001f1, |
| 1963 | 0x01813122, 0x400001f2, |
| 1964 | }; |
| 1965 | |
| 1966 | /* |
| 1967 | STAC 922X pin configs for |
| 1968 | 102801AC |
| 1969 | 102801D0 |
| 1970 | */ |
| 1971 | static unsigned int dell_922x_d82_pin_configs[10] = { |
| 1972 | 0x02214030, 0x01a19021, 0x01111012, 0x01114010, |
| 1973 | 0x02a19020, 0x01117011, 0x01451140, 0x400001f0, |
| 1974 | 0x01813122, 0x400001f1, |
| 1975 | }; |
| 1976 | |
| 1977 | /* |
| 1978 | STAC 922X pin configs for |
| 1979 | 102801BF |
| 1980 | */ |
| 1981 | static unsigned int dell_922x_m81_pin_configs[10] = { |
| 1982 | 0x0321101f, 0x01112024, 0x01111222, 0x91174220, |
| 1983 | 0x03a11050, 0x01116221, 0x90a70330, 0x01452340, |
| 1984 | 0x40C003f1, 0x405003f0, |
| 1985 | }; |
| 1986 | |
| 1987 | /* |
| 1988 | STAC 9221 A1 pin configs for |
| 1989 | 102801D7 (Dell XPS M1210) |
| 1990 | */ |
| 1991 | static unsigned int dell_922x_m82_pin_configs[10] = { |
Jiang Zhe | 7f9310c | 2007-11-12 12:43:37 +0100 | [diff] [blame] | 1992 | 0x02211211, 0x408103ff, 0x02a1123e, 0x90100310, |
| 1993 | 0x408003f1, 0x0221121f, 0x03451340, 0x40c003f2, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 1994 | 0x508003f3, 0x405003f4, |
| 1995 | }; |
| 1996 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1997 | static unsigned int d945gtp3_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 1998 | 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 1999 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2000 | 0x02a19120, 0x40000100, |
| 2001 | }; |
| 2002 | |
| 2003 | static unsigned int d945gtp5_pin_configs[10] = { |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 2004 | 0x0221401f, 0x01011012, 0x01813024, 0x01014010, |
| 2005 | 0x01a19021, 0x01016011, 0x01452130, 0x40000100, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2006 | 0x02a19320, 0x40000100, |
| 2007 | }; |
| 2008 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2009 | static unsigned int intel_mac_v1_pin_configs[10] = { |
| 2010 | 0x0121e21f, 0x400000ff, 0x9017e110, 0x400000fd, |
| 2011 | 0x400000fe, 0x0181e020, 0x1145e030, 0x11c5e240, |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2012 | 0x400000fc, 0x400000fb, |
| 2013 | }; |
| 2014 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2015 | static unsigned int intel_mac_v2_pin_configs[10] = { |
| 2016 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 2017 | 0x400000fe, 0x0181e020, 0x1145e230, 0x500000fa, |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 2018 | 0x400000fc, 0x400000fb, |
| 2019 | }; |
| 2020 | |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2021 | static unsigned int intel_mac_v3_pin_configs[10] = { |
| 2022 | 0x0121e21f, 0x90a7012e, 0x9017e110, 0x400000fd, |
| 2023 | 0x400000fe, 0x0181e020, 0x1145e230, 0x11c5e240, |
| 2024 | 0x400000fc, 0x400000fb, |
| 2025 | }; |
| 2026 | |
| 2027 | static unsigned int intel_mac_v4_pin_configs[10] = { |
| 2028 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 2029 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 2030 | 0x400000fc, 0x400000fb, |
| 2031 | }; |
| 2032 | |
| 2033 | static unsigned int intel_mac_v5_pin_configs[10] = { |
| 2034 | 0x0321e21f, 0x03a1e02e, 0x9017e110, 0x9017e11f, |
| 2035 | 0x400000fe, 0x0381e020, 0x1345e230, 0x13c5e240, |
| 2036 | 0x400000fc, 0x400000fb, |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 2037 | }; |
| 2038 | |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2039 | static unsigned int ecs202_pin_configs[10] = { |
| 2040 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, |
| 2041 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, |
| 2042 | 0x9037012e, 0x40e000f2, |
| 2043 | }; |
Takashi Iwai | 76c0882 | 2007-06-19 12:17:42 +0200 | [diff] [blame] | 2044 | |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2045 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2046 | [STAC_D945_REF] = ref922x_pin_configs, |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 2047 | [STAC_D945GTP3] = d945gtp3_pin_configs, |
| 2048 | [STAC_D945GTP5] = d945gtp5_pin_configs, |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2049 | [STAC_INTEL_MAC_V1] = intel_mac_v1_pin_configs, |
| 2050 | [STAC_INTEL_MAC_V2] = intel_mac_v2_pin_configs, |
| 2051 | [STAC_INTEL_MAC_V3] = intel_mac_v3_pin_configs, |
| 2052 | [STAC_INTEL_MAC_V4] = intel_mac_v4_pin_configs, |
| 2053 | [STAC_INTEL_MAC_V5] = intel_mac_v5_pin_configs, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2054 | [STAC_INTEL_MAC_AUTO] = intel_mac_v3_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2055 | /* for backward compatibility */ |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2056 | [STAC_MACMINI] = intel_mac_v3_pin_configs, |
| 2057 | [STAC_MACBOOK] = intel_mac_v5_pin_configs, |
| 2058 | [STAC_MACBOOK_PRO_V1] = intel_mac_v3_pin_configs, |
| 2059 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
| 2060 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
| 2061 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2062 | [STAC_ECS_202] = ecs202_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2063 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
| 2064 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
| 2065 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
| 2066 | [STAC_922X_DELL_M82] = dell_922x_m82_pin_configs, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2067 | }; |
| 2068 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2069 | static const char *stac922x_models[STAC_922X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2070 | [STAC_922X_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2071 | [STAC_D945_REF] = "ref", |
| 2072 | [STAC_D945GTP5] = "5stack", |
| 2073 | [STAC_D945GTP3] = "3stack", |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 2074 | [STAC_INTEL_MAC_V1] = "intel-mac-v1", |
| 2075 | [STAC_INTEL_MAC_V2] = "intel-mac-v2", |
| 2076 | [STAC_INTEL_MAC_V3] = "intel-mac-v3", |
| 2077 | [STAC_INTEL_MAC_V4] = "intel-mac-v4", |
| 2078 | [STAC_INTEL_MAC_V5] = "intel-mac-v5", |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2079 | [STAC_INTEL_MAC_AUTO] = "intel-mac-auto", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2080 | /* for backward compatibility */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2081 | [STAC_MACMINI] = "macmini", |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 2082 | [STAC_MACBOOK] = "macbook", |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 2083 | [STAC_MACBOOK_PRO_V1] = "macbook-pro-v1", |
| 2084 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 2085 | [STAC_IMAC_INTEL] = "imac-intel", |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 2086 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2087 | [STAC_ECS_202] = "ecs202", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2088 | [STAC_922X_DELL_D81] = "dell-d81", |
| 2089 | [STAC_922X_DELL_D82] = "dell-d82", |
| 2090 | [STAC_922X_DELL_M81] = "dell-m81", |
| 2091 | [STAC_922X_DELL_M82] = "dell-m82", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2092 | }; |
| 2093 | |
| 2094 | static struct snd_pci_quirk stac922x_cfg_tbl[] = { |
| 2095 | /* SigmaTel reference board */ |
| 2096 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2097 | "DFI LanParty", STAC_D945_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2098 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2099 | "DFI LanParty", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2100 | /* Intel 945G based systems */ |
| 2101 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
| 2102 | "Intel D945G", STAC_D945GTP3), |
| 2103 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, |
| 2104 | "Intel D945G", STAC_D945GTP3), |
| 2105 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, |
| 2106 | "Intel D945G", STAC_D945GTP3), |
| 2107 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, |
| 2108 | "Intel D945G", STAC_D945GTP3), |
| 2109 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, |
| 2110 | "Intel D945G", STAC_D945GTP3), |
| 2111 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, |
| 2112 | "Intel D945G", STAC_D945GTP3), |
| 2113 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, |
| 2114 | "Intel D945G", STAC_D945GTP3), |
| 2115 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, |
| 2116 | "Intel D945G", STAC_D945GTP3), |
| 2117 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, |
| 2118 | "Intel D945G", STAC_D945GTP3), |
| 2119 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, |
| 2120 | "Intel D945G", STAC_D945GTP3), |
| 2121 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, |
| 2122 | "Intel D945G", STAC_D945GTP3), |
| 2123 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, |
| 2124 | "Intel D945G", STAC_D945GTP3), |
| 2125 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, |
| 2126 | "Intel D945G", STAC_D945GTP3), |
| 2127 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, |
| 2128 | "Intel D945G", STAC_D945GTP3), |
| 2129 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, |
| 2130 | "Intel D945G", STAC_D945GTP3), |
| 2131 | /* Intel D945G 5-stack systems */ |
| 2132 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, |
| 2133 | "Intel D945G", STAC_D945GTP5), |
| 2134 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, |
| 2135 | "Intel D945G", STAC_D945GTP5), |
| 2136 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, |
| 2137 | "Intel D945G", STAC_D945GTP5), |
| 2138 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, |
| 2139 | "Intel D945G", STAC_D945GTP5), |
| 2140 | /* Intel 945P based systems */ |
| 2141 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, |
| 2142 | "Intel D945P", STAC_D945GTP3), |
| 2143 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, |
| 2144 | "Intel D945P", STAC_D945GTP3), |
| 2145 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, |
| 2146 | "Intel D945P", STAC_D945GTP3), |
| 2147 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, |
| 2148 | "Intel D945P", STAC_D945GTP3), |
| 2149 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, |
| 2150 | "Intel D945P", STAC_D945GTP3), |
| 2151 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
| 2152 | "Intel D945P", STAC_D945GTP5), |
Takashi Iwai | 8056d47 | 2009-01-23 09:09:43 +0100 | [diff] [blame] | 2153 | /* other intel */ |
| 2154 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, |
| 2155 | "Intel D945", STAC_D945_REF), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2156 | /* other systems */ |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2157 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2158 | SND_PCI_QUIRK(0x8384, 0x7680, |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 2159 | "Mac", STAC_INTEL_MAC_AUTO), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2160 | /* Dell systems */ |
| 2161 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a7, |
| 2162 | "unknown Dell", STAC_922X_DELL_D81), |
| 2163 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a9, |
| 2164 | "unknown Dell", STAC_922X_DELL_D81), |
| 2165 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ab, |
| 2166 | "unknown Dell", STAC_922X_DELL_D81), |
| 2167 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ac, |
| 2168 | "unknown Dell", STAC_922X_DELL_D82), |
| 2169 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01bf, |
| 2170 | "unknown Dell", STAC_922X_DELL_M81), |
| 2171 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d0, |
| 2172 | "unknown Dell", STAC_922X_DELL_D82), |
| 2173 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d1, |
| 2174 | "unknown Dell", STAC_922X_DELL_D81), |
| 2175 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d2, |
| 2176 | "unknown Dell", STAC_922X_DELL_D81), |
| 2177 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
| 2178 | "Dell XPS M1210", STAC_922X_DELL_M82), |
Mauro Carvalho Chehab | 8c65008 | 2008-08-04 10:39:59 -0300 | [diff] [blame] | 2179 | /* ECS/PC Chips boards */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2180 | SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, |
Herton Ronaldo Krzesinski | 8663ae5 | 2009-02-08 19:50:34 -0200 | [diff] [blame] | 2181 | "ECS/PC chips", STAC_ECS_202), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2182 | {} /* terminator */ |
| 2183 | }; |
| 2184 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2185 | static unsigned int ref927x_pin_configs[14] = { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2186 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2187 | 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, |
| 2188 | 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, |
| 2189 | 0x01c42190, 0x40000100, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2190 | }; |
| 2191 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2192 | static unsigned int d965_3st_pin_configs[14] = { |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2193 | 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, |
| 2194 | 0x01a19021, 0x01813024, 0x40000100, 0x40000100, |
| 2195 | 0x40000100, 0x40000100, 0x40000100, 0x40000100, |
| 2196 | 0x40000100, 0x40000100 |
| 2197 | }; |
| 2198 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2199 | static unsigned int d965_5st_pin_configs[14] = { |
| 2200 | 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, |
| 2201 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2202 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2203 | 0x40000100, 0x40000100 |
| 2204 | }; |
| 2205 | |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2206 | static unsigned int d965_5st_no_fp_pin_configs[14] = { |
| 2207 | 0x40000100, 0x40000100, 0x0181304e, 0x01014010, |
| 2208 | 0x01a19040, 0x01011012, 0x01016011, 0x40000100, |
| 2209 | 0x40000100, 0x40000100, 0x40000100, 0x01442070, |
| 2210 | 0x40000100, 0x40000100 |
| 2211 | }; |
| 2212 | |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2213 | static unsigned int dell_3st_pin_configs[14] = { |
| 2214 | 0x02211230, 0x02a11220, 0x01a19040, 0x01114210, |
| 2215 | 0x01111212, 0x01116211, 0x01813050, 0x01112214, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2216 | 0x403003fa, 0x90a60040, 0x90a60040, 0x404003fb, |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2217 | 0x40c003fc, 0x40000100 |
| 2218 | }; |
| 2219 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 2220 | static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2221 | [STAC_D965_REF_NO_JD] = ref927x_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2222 | [STAC_D965_REF] = ref927x_pin_configs, |
| 2223 | [STAC_D965_3ST] = d965_3st_pin_configs, |
| 2224 | [STAC_D965_5ST] = d965_5st_pin_configs, |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2225 | [STAC_D965_5ST_NO_FP] = d965_5st_no_fp_pin_configs, |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2226 | [STAC_DELL_3ST] = dell_3st_pin_configs, |
| 2227 | [STAC_DELL_BIOS] = NULL, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2228 | }; |
| 2229 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2230 | static const char *stac927x_models[STAC_927X_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2231 | [STAC_927X_AUTO] = "auto", |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 2232 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2233 | [STAC_D965_REF] = "ref", |
| 2234 | [STAC_D965_3ST] = "3stack", |
| 2235 | [STAC_D965_5ST] = "5stack", |
Takashi Iwai | 679d92e | 2009-05-24 19:00:08 +0200 | [diff] [blame] | 2236 | [STAC_D965_5ST_NO_FP] = "5stack-no-fp", |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2237 | [STAC_DELL_3ST] = "dell-3stack", |
| 2238 | [STAC_DELL_BIOS] = "dell-bios", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2239 | }; |
| 2240 | |
| 2241 | static struct snd_pci_quirk stac927x_cfg_tbl[] = { |
| 2242 | /* SigmaTel reference board */ |
| 2243 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2244 | "DFI LanParty", STAC_D965_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2245 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2246 | "DFI LanParty", STAC_D965_REF), |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 2247 | /* Intel 946 based systems */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2248 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
| 2249 | 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] | 2250 | /* 965 based 3 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2251 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, |
| 2252 | "Intel D965", STAC_D965_3ST), |
| 2253 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, |
| 2254 | "Intel D965", STAC_D965_3ST), |
Tobin Davis | 4ff076e | 2007-08-07 11:48:12 +0200 | [diff] [blame] | 2255 | /* Dell 3 stack systems */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2256 | 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] | 2257 | 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] | 2258 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ed, "Dell ", STAC_DELL_3ST), |
| 2259 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f4, "Dell ", STAC_DELL_3ST), |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2260 | /* Dell 3 stack systems with verb table in BIOS */ |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 2261 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
| 2262 | 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] | 2263 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
Takashi Iwai | 24918b6 | 2008-09-30 12:58:54 +0200 | [diff] [blame] | 2264 | 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] | 2265 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
| 2266 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
| 2267 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
| 2268 | 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] | 2269 | /* 965 based 5 stack systems */ |
Takashi Iwai | dea0a50 | 2009-02-09 17:14:52 +0100 | [diff] [blame] | 2270 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, |
| 2271 | "Intel D965", STAC_D965_5ST), |
| 2272 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
| 2273 | "Intel D965", STAC_D965_5ST), |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2274 | {} /* terminator */ |
| 2275 | }; |
| 2276 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2277 | static unsigned int ref9205_pin_configs[12] = { |
| 2278 | 0x40000100, 0x40000100, 0x01016011, 0x01014010, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2279 | 0x01813122, 0x01a19021, 0x01019020, 0x40000100, |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 2280 | 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2281 | }; |
| 2282 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2283 | /* |
| 2284 | STAC 9205 pin configs for |
| 2285 | 102801F1 |
| 2286 | 102801F2 |
| 2287 | 102801FC |
| 2288 | 102801FD |
| 2289 | 10280204 |
| 2290 | 1028021F |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2291 | 10280228 (Dell Vostro 1500) |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2292 | */ |
| 2293 | static unsigned int dell_9205_m42_pin_configs[12] = { |
| 2294 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
| 2295 | 0x400003FB, 0x400003FC, 0x400003FD, 0x40F000F9, |
| 2296 | 0x90A60330, 0x400003FF, 0x0144131F, 0x40C003FE, |
| 2297 | }; |
| 2298 | |
| 2299 | /* |
| 2300 | STAC 9205 pin configs for |
| 2301 | 102801F9 |
| 2302 | 102801FA |
| 2303 | 102801FE |
| 2304 | 102801FF (Dell Precision M4300) |
| 2305 | 10280206 |
| 2306 | 10280200 |
| 2307 | 10280201 |
| 2308 | */ |
| 2309 | static unsigned int dell_9205_m43_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2310 | 0x0321101f, 0x03a11020, 0x90a70330, 0x90170310, |
| 2311 | 0x400000fe, 0x400000ff, 0x400000fd, 0x40f000f9, |
| 2312 | 0x400000fa, 0x400000fc, 0x0144131f, 0x40c003f8, |
| 2313 | }; |
| 2314 | |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2315 | static unsigned int dell_9205_m44_pin_configs[12] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2316 | 0x0421101f, 0x04a11020, 0x400003fa, 0x90170310, |
| 2317 | 0x400003fb, 0x400003fc, 0x400003fd, 0x400003f9, |
| 2318 | 0x90a60330, 0x400003ff, 0x01441340, 0x40c003fe, |
| 2319 | }; |
| 2320 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2321 | static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2322 | [STAC_9205_REF] = ref9205_pin_configs, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2323 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
| 2324 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
| 2325 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2326 | [STAC_9205_EAPD] = NULL, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2327 | }; |
| 2328 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2329 | static const char *stac9205_models[STAC_9205_MODELS] = { |
Takashi Iwai | 1607b8e | 2009-02-26 16:50:43 +0100 | [diff] [blame] | 2330 | [STAC_9205_AUTO] = "auto", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2331 | [STAC_9205_REF] = "ref", |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2332 | [STAC_9205_DELL_M42] = "dell-m42", |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2333 | [STAC_9205_DELL_M43] = "dell-m43", |
| 2334 | [STAC_9205_DELL_M44] = "dell-m44", |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2335 | [STAC_9205_EAPD] = "eapd", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2336 | }; |
| 2337 | |
| 2338 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
| 2339 | /* SigmaTel reference board */ |
| 2340 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
| 2341 | "DFI LanParty", STAC_9205_REF), |
Herton Ronaldo Krzesinski | 02358fc | 2009-07-04 01:44:59 -0300 | [diff] [blame] | 2342 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, |
| 2343 | "SigmaTel", STAC_9205_REF), |
Matthew Ranostay | 577aa2c | 2009-01-22 22:55:44 -0500 | [diff] [blame] | 2344 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
| 2345 | "DFI LanParty", STAC_9205_REF), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2346 | /* Dell */ |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2347 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
| 2348 | "unknown Dell", STAC_9205_DELL_M42), |
| 2349 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
| 2350 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2351 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f8, |
Matthew Ranostay | b44ef2f | 2007-09-18 00:52:38 +0200 | [diff] [blame] | 2352 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2353 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f9, |
| 2354 | "Dell Precision", STAC_9205_DELL_M43), |
| 2355 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fa, |
| 2356 | "Dell Precision", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2357 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fc, |
| 2358 | "unknown Dell", STAC_9205_DELL_M42), |
| 2359 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fd, |
| 2360 | "unknown Dell", STAC_9205_DELL_M42), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2361 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01fe, |
| 2362 | "Dell Precision", STAC_9205_DELL_M43), |
| 2363 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01ff, |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2364 | "Dell Precision M4300", STAC_9205_DELL_M43), |
Takashi Iwai | dfe495d | 2007-08-23 19:04:28 +0200 | [diff] [blame] | 2365 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0204, |
| 2366 | "unknown Dell", STAC_9205_DELL_M42), |
Takashi Iwai | 4549915 | 2008-06-12 16:27:24 +0200 | [diff] [blame] | 2367 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0206, |
| 2368 | "Dell Precision", STAC_9205_DELL_M43), |
| 2369 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021b, |
| 2370 | "Dell Precision", STAC_9205_DELL_M43), |
| 2371 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021c, |
| 2372 | "Dell Precision", STAC_9205_DELL_M43), |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 2373 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x021f, |
| 2374 | "Dell Inspiron", STAC_9205_DELL_M44), |
Matthew Ranostay | 3fa2ef7 | 2008-01-11 11:39:06 +0100 | [diff] [blame] | 2375 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
| 2376 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2377 | /* Gateway */ |
Hao Song | 42b95f0 | 2009-07-20 15:01:16 +0800 | [diff] [blame] | 2378 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 2379 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 2380 | {} /* terminator */ |
| 2381 | }; |
| 2382 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2383 | static void stac92xx_set_config_regs(struct hda_codec *codec, |
| 2384 | unsigned int *pincfgs) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2385 | { |
| 2386 | int i; |
| 2387 | struct sigmatel_spec *spec = codec->spec; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2388 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2389 | if (!pincfgs) |
| 2390 | return; |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 2391 | |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 2392 | for (i = 0; i < spec->num_pins; i++) |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 2393 | if (spec->pin_nids[i] && pincfgs[i]) |
| 2394 | snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], |
| 2395 | pincfgs[i]); |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 2396 | } |
| 2397 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2398 | /* |
| 2399 | * Analog playback callbacks |
| 2400 | */ |
| 2401 | static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2402 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2403 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2404 | { |
| 2405 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2406 | if (spec->stream_delay) |
| 2407 | msleep(spec->stream_delay); |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2408 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2409 | hinfo); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2410 | } |
| 2411 | |
| 2412 | static int stac92xx_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2413 | struct hda_codec *codec, |
| 2414 | unsigned int stream_tag, |
| 2415 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2416 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2417 | { |
| 2418 | struct sigmatel_spec *spec = codec->spec; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2419 | 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] | 2420 | } |
| 2421 | |
| 2422 | static int stac92xx_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2423 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2424 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2425 | { |
| 2426 | struct sigmatel_spec *spec = codec->spec; |
| 2427 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2428 | } |
| 2429 | |
| 2430 | /* |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2431 | * Digital playback callbacks |
| 2432 | */ |
| 2433 | static int stac92xx_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2434 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2435 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2436 | { |
| 2437 | struct sigmatel_spec *spec = codec->spec; |
| 2438 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2439 | } |
| 2440 | |
| 2441 | static int stac92xx_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2442 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2443 | struct snd_pcm_substream *substream) |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2444 | { |
| 2445 | struct sigmatel_spec *spec = codec->spec; |
| 2446 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2447 | } |
| 2448 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2449 | static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2450 | struct hda_codec *codec, |
| 2451 | unsigned int stream_tag, |
| 2452 | unsigned int format, |
| 2453 | struct snd_pcm_substream *substream) |
| 2454 | { |
| 2455 | struct sigmatel_spec *spec = codec->spec; |
| 2456 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2457 | stream_tag, format, substream); |
| 2458 | } |
| 2459 | |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2460 | static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2461 | struct hda_codec *codec, |
| 2462 | struct snd_pcm_substream *substream) |
| 2463 | { |
| 2464 | struct sigmatel_spec *spec = codec->spec; |
| 2465 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); |
| 2466 | } |
| 2467 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2468 | |
| 2469 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2470 | * Analog capture callbacks |
| 2471 | */ |
| 2472 | static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2473 | struct hda_codec *codec, |
| 2474 | unsigned int stream_tag, |
| 2475 | unsigned int format, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2476 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2477 | { |
| 2478 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2479 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2480 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2481 | if (spec->powerdown_adcs) { |
| 2482 | msleep(40); |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2483 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2484 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); |
| 2485 | } |
| 2486 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2487 | return 0; |
| 2488 | } |
| 2489 | |
| 2490 | static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2491 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2492 | struct snd_pcm_substream *substream) |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2493 | { |
| 2494 | struct sigmatel_spec *spec = codec->spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2495 | hda_nid_t nid = spec->adc_nids[substream->number]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2496 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2497 | snd_hda_codec_cleanup_stream(codec, nid); |
| 2498 | if (spec->powerdown_adcs) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 2499 | snd_hda_codec_write(codec, nid, 0, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 2500 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2501 | return 0; |
| 2502 | } |
| 2503 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2504 | static struct hda_pcm_stream stac92xx_pcm_digital_playback = { |
| 2505 | .substreams = 1, |
| 2506 | .channels_min = 2, |
| 2507 | .channels_max = 2, |
| 2508 | /* NID is set in stac92xx_build_pcms */ |
| 2509 | .ops = { |
| 2510 | .open = stac92xx_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2511 | .close = stac92xx_dig_playback_pcm_close, |
Takashi Iwai | 9411e21 | 2009-02-13 11:32:28 +0100 | [diff] [blame] | 2512 | .prepare = stac92xx_dig_playback_pcm_prepare, |
| 2513 | .cleanup = stac92xx_dig_playback_pcm_cleanup |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2514 | }, |
| 2515 | }; |
| 2516 | |
| 2517 | static struct hda_pcm_stream stac92xx_pcm_digital_capture = { |
| 2518 | .substreams = 1, |
| 2519 | .channels_min = 2, |
| 2520 | .channels_max = 2, |
| 2521 | /* NID is set in stac92xx_build_pcms */ |
| 2522 | }; |
| 2523 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2524 | static struct hda_pcm_stream stac92xx_pcm_analog_playback = { |
| 2525 | .substreams = 1, |
| 2526 | .channels_min = 2, |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2527 | .channels_max = 8, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2528 | .nid = 0x02, /* NID to query formats and rates */ |
| 2529 | .ops = { |
| 2530 | .open = stac92xx_playback_pcm_open, |
| 2531 | .prepare = stac92xx_playback_pcm_prepare, |
| 2532 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2533 | }, |
| 2534 | }; |
| 2535 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2536 | static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { |
| 2537 | .substreams = 1, |
| 2538 | .channels_min = 2, |
| 2539 | .channels_max = 2, |
| 2540 | .nid = 0x06, /* NID to query formats and rates */ |
| 2541 | .ops = { |
| 2542 | .open = stac92xx_playback_pcm_open, |
| 2543 | .prepare = stac92xx_playback_pcm_prepare, |
| 2544 | .cleanup = stac92xx_playback_pcm_cleanup |
| 2545 | }, |
| 2546 | }; |
| 2547 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2548 | static struct hda_pcm_stream stac92xx_pcm_analog_capture = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2549 | .channels_min = 2, |
| 2550 | .channels_max = 2, |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2551 | /* NID + .substreams is set in stac92xx_build_pcms */ |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2552 | .ops = { |
| 2553 | .prepare = stac92xx_capture_pcm_prepare, |
| 2554 | .cleanup = stac92xx_capture_pcm_cleanup |
| 2555 | }, |
| 2556 | }; |
| 2557 | |
| 2558 | static int stac92xx_build_pcms(struct hda_codec *codec) |
| 2559 | { |
| 2560 | struct sigmatel_spec *spec = codec->spec; |
| 2561 | struct hda_pcm *info = spec->pcm_rec; |
| 2562 | |
| 2563 | codec->num_pcms = 1; |
| 2564 | codec->pcm_info = info; |
| 2565 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2566 | info->name = "STAC92xx Analog"; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2567 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; |
Takashi Iwai | 00a602d | 2009-01-23 11:55:42 +0100 | [diff] [blame] | 2568 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2569 | spec->multiout.dac_nids[0]; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2570 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2571 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 2572 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 2573 | |
| 2574 | if (spec->alt_switch) { |
| 2575 | codec->num_pcms++; |
| 2576 | info++; |
| 2577 | info->name = "STAC92xx Analog Alt"; |
| 2578 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; |
| 2579 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2580 | |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2581 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
| 2582 | codec->num_pcms++; |
| 2583 | info++; |
| 2584 | info->name = "STAC92xx Digital"; |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 2585 | info->pcm_type = spec->autocfg.dig_out_type[0]; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 2586 | if (spec->multiout.dig_out_nid) { |
| 2587 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
| 2588 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2589 | } |
| 2590 | if (spec->dig_in_nid) { |
| 2591 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_digital_capture; |
| 2592 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2593 | } |
| 2594 | } |
| 2595 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 2596 | return 0; |
| 2597 | } |
| 2598 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2599 | static unsigned int stac92xx_get_default_vref(struct hda_codec *codec, |
| 2600 | hda_nid_t nid) |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2601 | { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2602 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2603 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 2604 | if (pincap & AC_PINCAP_VREF_100) |
| 2605 | return AC_PINCTL_VREF_100; |
| 2606 | if (pincap & AC_PINCAP_VREF_80) |
| 2607 | return AC_PINCTL_VREF_80; |
| 2608 | if (pincap & AC_PINCAP_VREF_50) |
| 2609 | return AC_PINCTL_VREF_50; |
| 2610 | if (pincap & AC_PINCAP_VREF_GRD) |
| 2611 | return AC_PINCTL_VREF_GRD; |
| 2612 | return 0; |
| 2613 | } |
| 2614 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2615 | static void stac92xx_auto_set_pinctl(struct hda_codec *codec, hda_nid_t nid, int pin_type) |
| 2616 | |
| 2617 | { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2618 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2619 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2620 | } |
| 2621 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2622 | #define stac92xx_hp_switch_info snd_ctl_boolean_mono_info |
| 2623 | |
| 2624 | static int stac92xx_hp_switch_get(struct snd_kcontrol *kcontrol, |
| 2625 | struct snd_ctl_elem_value *ucontrol) |
| 2626 | { |
| 2627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2628 | struct sigmatel_spec *spec = codec->spec; |
| 2629 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2630 | ucontrol->value.integer.value[0] = !!spec->hp_switch; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2631 | return 0; |
| 2632 | } |
| 2633 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2634 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 2635 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2636 | static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, |
| 2637 | struct snd_ctl_elem_value *ucontrol) |
| 2638 | { |
| 2639 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2640 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 2641 | int nid = kcontrol->private_value; |
| 2642 | |
| 2643 | spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2644 | |
| 2645 | /* check to be sure that the ports are upto date with |
| 2646 | * switch changes |
| 2647 | */ |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2648 | stac_issue_unsol_event(codec, nid); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2649 | |
| 2650 | return 1; |
| 2651 | } |
| 2652 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2653 | static int stac92xx_dc_bias_info(struct snd_kcontrol *kcontrol, |
| 2654 | struct snd_ctl_elem_info *uinfo) |
| 2655 | { |
| 2656 | int i; |
| 2657 | static char *texts[] = { |
| 2658 | "Mic In", "Line In", "Line Out" |
| 2659 | }; |
| 2660 | |
| 2661 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2662 | struct sigmatel_spec *spec = codec->spec; |
| 2663 | hda_nid_t nid = kcontrol->private_value; |
| 2664 | |
| 2665 | if (nid == spec->mic_switch || nid == spec->line_switch) |
| 2666 | i = 3; |
| 2667 | else |
| 2668 | i = 2; |
| 2669 | |
| 2670 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2671 | uinfo->value.enumerated.items = i; |
| 2672 | uinfo->count = 1; |
| 2673 | if (uinfo->value.enumerated.item >= i) |
| 2674 | uinfo->value.enumerated.item = i-1; |
| 2675 | strcpy(uinfo->value.enumerated.name, |
| 2676 | texts[uinfo->value.enumerated.item]); |
| 2677 | |
| 2678 | return 0; |
| 2679 | } |
| 2680 | |
| 2681 | static int stac92xx_dc_bias_get(struct snd_kcontrol *kcontrol, |
| 2682 | struct snd_ctl_elem_value *ucontrol) |
| 2683 | { |
| 2684 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2685 | hda_nid_t nid = kcontrol->private_value; |
| 2686 | unsigned int vref = stac92xx_vref_get(codec, nid); |
| 2687 | |
| 2688 | if (vref == stac92xx_get_default_vref(codec, nid)) |
| 2689 | ucontrol->value.enumerated.item[0] = 0; |
| 2690 | else if (vref == AC_PINCTL_VREF_GRD) |
| 2691 | ucontrol->value.enumerated.item[0] = 1; |
| 2692 | else if (vref == AC_PINCTL_VREF_HIZ) |
| 2693 | ucontrol->value.enumerated.item[0] = 2; |
| 2694 | |
| 2695 | return 0; |
| 2696 | } |
| 2697 | |
| 2698 | static int stac92xx_dc_bias_put(struct snd_kcontrol *kcontrol, |
| 2699 | struct snd_ctl_elem_value *ucontrol) |
| 2700 | { |
| 2701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2702 | unsigned int new_vref = 0; |
Takashi Iwai | b862151 | 2009-06-22 08:00:10 +0200 | [diff] [blame] | 2703 | int error; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2704 | hda_nid_t nid = kcontrol->private_value; |
| 2705 | |
| 2706 | if (ucontrol->value.enumerated.item[0] == 0) |
| 2707 | new_vref = stac92xx_get_default_vref(codec, nid); |
| 2708 | else if (ucontrol->value.enumerated.item[0] == 1) |
| 2709 | new_vref = AC_PINCTL_VREF_GRD; |
| 2710 | else if (ucontrol->value.enumerated.item[0] == 2) |
| 2711 | new_vref = AC_PINCTL_VREF_HIZ; |
| 2712 | else |
| 2713 | return 0; |
| 2714 | |
| 2715 | if (new_vref != stac92xx_vref_get(codec, nid)) { |
| 2716 | error = stac92xx_vref_set(codec, nid, new_vref); |
| 2717 | return error; |
| 2718 | } |
| 2719 | |
| 2720 | return 0; |
| 2721 | } |
| 2722 | |
| 2723 | static int stac92xx_io_switch_info(struct snd_kcontrol *kcontrol, |
| 2724 | struct snd_ctl_elem_info *uinfo) |
| 2725 | { |
| 2726 | static char *texts[2]; |
| 2727 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2728 | struct sigmatel_spec *spec = codec->spec; |
| 2729 | |
| 2730 | if (kcontrol->private_value == spec->line_switch) |
| 2731 | texts[0] = "Line In"; |
| 2732 | else |
| 2733 | texts[0] = "Mic In"; |
| 2734 | texts[1] = "Line Out"; |
| 2735 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2736 | uinfo->value.enumerated.items = 2; |
| 2737 | uinfo->count = 1; |
| 2738 | |
| 2739 | if (uinfo->value.enumerated.item >= 2) |
| 2740 | uinfo->value.enumerated.item = 1; |
| 2741 | strcpy(uinfo->value.enumerated.name, |
| 2742 | texts[uinfo->value.enumerated.item]); |
| 2743 | |
| 2744 | return 0; |
| 2745 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2746 | |
| 2747 | static int stac92xx_io_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2748 | { |
| 2749 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2750 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2751 | hda_nid_t nid = kcontrol->private_value; |
| 2752 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2753 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2754 | ucontrol->value.enumerated.item[0] = spec->io_switch[io_idx]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2755 | return 0; |
| 2756 | } |
| 2757 | |
| 2758 | static int stac92xx_io_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
| 2759 | { |
| 2760 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2761 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2762 | hda_nid_t nid = kcontrol->private_value; |
| 2763 | int io_idx = (nid == spec->mic_switch) ? 1 : 0; |
| 2764 | unsigned short val = !!ucontrol->value.enumerated.item[0]; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2765 | |
| 2766 | spec->io_switch[io_idx] = val; |
| 2767 | |
| 2768 | if (val) |
| 2769 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2770 | else { |
| 2771 | unsigned int pinctl = AC_PINCTL_IN_EN; |
| 2772 | if (io_idx) /* set VREF for mic */ |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2773 | pinctl |= stac92xx_get_default_vref(codec, nid); |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 2774 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
| 2775 | } |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2776 | |
| 2777 | /* check the auto-mute again: we need to mute/unmute the speaker |
| 2778 | * appropriately according to the pin direction |
| 2779 | */ |
| 2780 | if (spec->hp_detect) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 2781 | stac_issue_unsol_event(codec, nid); |
Jiang Zhe | 40c1d30 | 2007-11-12 13:05:16 +0100 | [diff] [blame] | 2782 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2783 | return 1; |
| 2784 | } |
| 2785 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2786 | #define stac92xx_clfe_switch_info snd_ctl_boolean_mono_info |
| 2787 | |
| 2788 | static int stac92xx_clfe_switch_get(struct snd_kcontrol *kcontrol, |
| 2789 | struct snd_ctl_elem_value *ucontrol) |
| 2790 | { |
| 2791 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2792 | struct sigmatel_spec *spec = codec->spec; |
| 2793 | |
| 2794 | ucontrol->value.integer.value[0] = spec->clfe_swap; |
| 2795 | return 0; |
| 2796 | } |
| 2797 | |
| 2798 | static int stac92xx_clfe_switch_put(struct snd_kcontrol *kcontrol, |
| 2799 | struct snd_ctl_elem_value *ucontrol) |
| 2800 | { |
| 2801 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2802 | struct sigmatel_spec *spec = codec->spec; |
| 2803 | hda_nid_t nid = kcontrol->private_value & 0xff; |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2804 | unsigned int val = !!ucontrol->value.integer.value[0]; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2805 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2806 | if (spec->clfe_swap == val) |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2807 | return 0; |
| 2808 | |
Takashi Iwai | 68ea7b2 | 2007-11-15 15:54:38 +0100 | [diff] [blame] | 2809 | spec->clfe_swap = val; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2810 | |
| 2811 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 2812 | spec->clfe_swap ? 0x4 : 0x0); |
| 2813 | |
| 2814 | return 1; |
| 2815 | } |
| 2816 | |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2817 | #define STAC_CODEC_HP_SWITCH(xname) \ |
| 2818 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2819 | .name = xname, \ |
| 2820 | .index = 0, \ |
| 2821 | .info = stac92xx_hp_switch_info, \ |
| 2822 | .get = stac92xx_hp_switch_get, \ |
| 2823 | .put = stac92xx_hp_switch_put, \ |
| 2824 | } |
| 2825 | |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2826 | #define STAC_CODEC_IO_SWITCH(xname, xpval) \ |
| 2827 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2828 | .name = xname, \ |
| 2829 | .index = 0, \ |
| 2830 | .info = stac92xx_io_switch_info, \ |
| 2831 | .get = stac92xx_io_switch_get, \ |
| 2832 | .put = stac92xx_io_switch_put, \ |
| 2833 | .private_value = xpval, \ |
| 2834 | } |
| 2835 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2836 | #define STAC_CODEC_CLFE_SWITCH(xname, xpval) \ |
| 2837 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2838 | .name = xname, \ |
| 2839 | .index = 0, \ |
| 2840 | .info = stac92xx_clfe_switch_info, \ |
| 2841 | .get = stac92xx_clfe_switch_get, \ |
| 2842 | .put = stac92xx_clfe_switch_put, \ |
| 2843 | .private_value = xpval, \ |
| 2844 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2845 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2846 | enum { |
| 2847 | STAC_CTL_WIDGET_VOL, |
| 2848 | STAC_CTL_WIDGET_MUTE, |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2849 | STAC_CTL_WIDGET_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2850 | STAC_CTL_WIDGET_AMP_MUX, |
| 2851 | STAC_CTL_WIDGET_AMP_VOL, |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2852 | STAC_CTL_WIDGET_HP_SWITCH, |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2853 | STAC_CTL_WIDGET_IO_SWITCH, |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2854 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 2855 | STAC_CTL_WIDGET_DC_BIAS |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2856 | }; |
| 2857 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2858 | static struct snd_kcontrol_new stac92xx_control_templates[] = { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2859 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 2860 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 2861 | STAC_MONO_MUX, |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 2862 | STAC_AMP_MUX, |
| 2863 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 2864 | STAC_CODEC_HP_SWITCH(NULL), |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2865 | STAC_CODEC_IO_SWITCH(NULL, 0), |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 2866 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
Nickolas Lloyd | 2fc9989 | 2009-05-15 15:33:30 +0200 | [diff] [blame] | 2867 | DC_BIAS(NULL, 0, 0), |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2868 | }; |
| 2869 | |
| 2870 | /* add dynamic controls */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2871 | static struct snd_kcontrol_new * |
| 2872 | stac_control_new(struct sigmatel_spec *spec, |
| 2873 | struct snd_kcontrol_new *ktemp, |
| 2874 | const char *name) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2875 | { |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2876 | struct snd_kcontrol_new *knew; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2877 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 2878 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
| 2879 | knew = snd_array_new(&spec->kctls); |
| 2880 | if (!knew) |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2881 | return NULL; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2882 | *knew = *ktemp; |
Takashi Iwai | 82fe0c5 | 2005-06-30 10:54:33 +0200 | [diff] [blame] | 2883 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2884 | if (!knew->name) { |
| 2885 | /* roolback */ |
| 2886 | memset(knew, 0, sizeof(*knew)); |
| 2887 | spec->kctls.alloced--; |
| 2888 | return NULL; |
| 2889 | } |
| 2890 | return knew; |
| 2891 | } |
| 2892 | |
| 2893 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, |
| 2894 | struct snd_kcontrol_new *ktemp, |
| 2895 | int idx, const char *name, |
| 2896 | unsigned long val) |
| 2897 | { |
| 2898 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); |
| 2899 | if (!knew) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2900 | return -ENOMEM; |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2901 | knew->index = idx; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2902 | knew->private_value = val; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 2903 | return 0; |
| 2904 | } |
| 2905 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2906 | static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, |
| 2907 | int type, int idx, const char *name, |
| 2908 | unsigned long val) |
| 2909 | { |
| 2910 | return stac92xx_add_control_temp(spec, |
| 2911 | &stac92xx_control_templates[type], |
| 2912 | idx, name, val); |
| 2913 | } |
| 2914 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2915 | |
| 2916 | /* add dynamic controls */ |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 2917 | static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, |
| 2918 | const char *name, unsigned long val) |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 2919 | { |
| 2920 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
| 2921 | } |
| 2922 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2923 | static struct snd_kcontrol_new stac_input_src_temp = { |
| 2924 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2925 | .name = "Input Source", |
| 2926 | .info = stac92xx_mux_enum_info, |
| 2927 | .get = stac92xx_mux_enum_get, |
| 2928 | .put = stac92xx_mux_enum_put, |
| 2929 | }; |
| 2930 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 2931 | static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec, |
| 2932 | hda_nid_t nid, int idx) |
| 2933 | { |
| 2934 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
| 2935 | int control = 0; |
| 2936 | struct sigmatel_spec *spec = codec->spec; |
| 2937 | char name[22]; |
| 2938 | |
| 2939 | if (!((get_defcfg_connect(def_conf)) & AC_JACK_PORT_FIXED)) { |
| 2940 | if (stac92xx_get_default_vref(codec, nid) == AC_PINCTL_VREF_GRD |
| 2941 | && nid == spec->line_switch) |
| 2942 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2943 | else if (snd_hda_query_pin_caps(codec, nid) |
| 2944 | & (AC_PINCAP_VREF_GRD << AC_PINCAP_VREF_SHIFT)) |
| 2945 | control = STAC_CTL_WIDGET_DC_BIAS; |
| 2946 | else if (nid == spec->mic_switch) |
| 2947 | control = STAC_CTL_WIDGET_IO_SWITCH; |
| 2948 | } |
| 2949 | |
| 2950 | if (control) { |
| 2951 | strcpy(name, auto_pin_cfg_labels[idx]); |
| 2952 | return stac92xx_add_control(codec->spec, control, |
| 2953 | strcat(name, " Jack Mode"), nid); |
| 2954 | } |
| 2955 | |
| 2956 | return 0; |
| 2957 | } |
| 2958 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2959 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) |
| 2960 | { |
| 2961 | struct snd_kcontrol_new *knew; |
| 2962 | struct hda_input_mux *imux = &spec->private_imux; |
| 2963 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 2964 | if (spec->auto_mic) |
| 2965 | return 0; /* no need for input source */ |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 2966 | if (!spec->num_adcs || imux->num_items <= 1) |
| 2967 | return 0; /* no need for input source control */ |
| 2968 | knew = stac_control_new(spec, &stac_input_src_temp, |
| 2969 | stac_input_src_temp.name); |
| 2970 | if (!knew) |
| 2971 | return -ENOMEM; |
| 2972 | knew->count = spec->num_adcs; |
| 2973 | return 0; |
| 2974 | } |
| 2975 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2976 | /* check whether the line-input can be used as line-out */ |
| 2977 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2978 | { |
| 2979 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2980 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2981 | hda_nid_t nid; |
| 2982 | unsigned int pincap; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 2983 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2984 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 2985 | return 0; |
| 2986 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 2987 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2988 | if (pincap & AC_PINCAP_OUT) |
| 2989 | return nid; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 2990 | return 0; |
| 2991 | } |
| 2992 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 2993 | /* check whether the mic-input can be used as line-out */ |
| 2994 | static hda_nid_t check_mic_out_switch(struct hda_codec *codec) |
| 2995 | { |
| 2996 | struct sigmatel_spec *spec = codec->spec; |
| 2997 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 2998 | unsigned int def_conf, pincap; |
| 2999 | unsigned int mic_pin; |
| 3000 | |
| 3001 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
| 3002 | return 0; |
| 3003 | mic_pin = AUTO_PIN_MIC; |
| 3004 | for (;;) { |
| 3005 | hda_nid_t nid = cfg->input_pins[mic_pin]; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 3006 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3007 | /* some laptops have an internal analog microphone |
| 3008 | * which can't be used as a output */ |
| 3009 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
Takashi Iwai | 1327a32 | 2009-03-23 13:07:47 +0100 | [diff] [blame] | 3010 | pincap = snd_hda_query_pin_caps(codec, nid); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3011 | if (pincap & AC_PINCAP_OUT) |
| 3012 | return nid; |
| 3013 | } |
| 3014 | if (mic_pin == AUTO_PIN_MIC) |
| 3015 | mic_pin = AUTO_PIN_FRONT_MIC; |
| 3016 | else |
| 3017 | break; |
| 3018 | } |
| 3019 | return 0; |
| 3020 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3021 | |
| 3022 | static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3023 | { |
| 3024 | int i; |
| 3025 | |
| 3026 | for (i = 0; i < spec->multiout.num_dacs; i++) { |
| 3027 | if (spec->multiout.dac_nids[i] == nid) |
| 3028 | return 1; |
| 3029 | } |
| 3030 | |
| 3031 | return 0; |
| 3032 | } |
| 3033 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3034 | static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3035 | { |
| 3036 | int i; |
| 3037 | if (is_in_dac_nids(spec, nid)) |
| 3038 | return 1; |
| 3039 | for (i = 0; i < spec->autocfg.hp_outs; i++) |
| 3040 | if (spec->hp_dacs[i] == nid) |
| 3041 | return 1; |
| 3042 | for (i = 0; i < spec->autocfg.speaker_outs; i++) |
| 3043 | if (spec->speaker_dacs[i] == nid) |
| 3044 | return 1; |
| 3045 | return 0; |
| 3046 | } |
| 3047 | |
| 3048 | static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) |
| 3049 | { |
| 3050 | struct sigmatel_spec *spec = codec->spec; |
| 3051 | int j, conn_len; |
| 3052 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
| 3053 | unsigned int wcaps, wtype; |
| 3054 | |
| 3055 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 3056 | HDA_MAX_CONNECTIONS); |
| 3057 | for (j = 0; j < conn_len; j++) { |
Takashi Iwai | 14bafe3 | 2009-03-23 16:35:39 +0100 | [diff] [blame] | 3058 | wcaps = get_wcaps(codec, conn[j]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 3059 | wtype = get_wcaps_type(wcaps); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3060 | /* we check only analog outputs */ |
| 3061 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
| 3062 | continue; |
| 3063 | /* if this route has a free DAC, assign it */ |
| 3064 | if (!check_all_dac_nids(spec, conn[j])) { |
| 3065 | if (conn_len > 1) { |
| 3066 | /* select this DAC in the pin's input mux */ |
| 3067 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3068 | AC_VERB_SET_CONNECT_SEL, j); |
| 3069 | } |
| 3070 | return conn[j]; |
| 3071 | } |
| 3072 | } |
Takashi Iwai | ee58a7c | 2009-03-06 12:00:24 +0100 | [diff] [blame] | 3073 | /* if all DACs are already assigned, connect to the primary DAC */ |
| 3074 | if (conn_len > 1) { |
| 3075 | for (j = 0; j < conn_len; j++) { |
| 3076 | if (conn[j] == spec->multiout.dac_nids[0]) { |
| 3077 | snd_hda_codec_write_cache(codec, nid, 0, |
| 3078 | AC_VERB_SET_CONNECT_SEL, j); |
| 3079 | break; |
| 3080 | } |
| 3081 | } |
| 3082 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3083 | return 0; |
| 3084 | } |
| 3085 | |
| 3086 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3087 | static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); |
| 3088 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3089 | /* |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3090 | * Fill in the dac_nids table from the parsed pin configuration |
| 3091 | * This function only works when every pin in line_out_pins[] |
| 3092 | * contains atleast one DAC in its connection list. Some 92xx |
| 3093 | * codecs are not connected directly to a DAC, such as the 9200 |
| 3094 | * and 9202/925x. For those, dac_nids[] must be hard-coded. |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3095 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3096 | static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3097 | { |
| 3098 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3099 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3100 | int i; |
| 3101 | hda_nid_t nid, dac; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3102 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3103 | for (i = 0; i < cfg->line_outs; i++) { |
| 3104 | nid = cfg->line_out_pins[i]; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3105 | dac = get_unassigned_dac(codec, nid); |
| 3106 | if (!dac) { |
Takashi Iwai | df80295 | 2007-07-02 19:18:00 +0200 | [diff] [blame] | 3107 | if (spec->multiout.num_dacs > 0) { |
| 3108 | /* we have already working output pins, |
| 3109 | * so let's drop the broken ones again |
| 3110 | */ |
| 3111 | cfg->line_outs = spec->multiout.num_dacs; |
| 3112 | break; |
| 3113 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3114 | /* error out, no available DAC found */ |
| 3115 | snd_printk(KERN_ERR |
| 3116 | "%s: No available DAC for pin 0x%x\n", |
| 3117 | __func__, nid); |
| 3118 | return -ENODEV; |
| 3119 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3120 | add_spec_dacs(spec, dac); |
| 3121 | } |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3122 | |
Takashi Iwai | 139e071 | 2009-03-06 12:10:41 +0100 | [diff] [blame] | 3123 | for (i = 0; i < cfg->hp_outs; i++) { |
| 3124 | nid = cfg->hp_pins[i]; |
| 3125 | dac = get_unassigned_dac(codec, nid); |
| 3126 | if (dac) { |
| 3127 | if (!spec->multiout.hp_nid) |
| 3128 | spec->multiout.hp_nid = dac; |
| 3129 | else |
| 3130 | add_spec_extra_dacs(spec, dac); |
| 3131 | } |
| 3132 | spec->hp_dacs[i] = dac; |
| 3133 | } |
| 3134 | |
| 3135 | for (i = 0; i < cfg->speaker_outs; i++) { |
| 3136 | nid = cfg->speaker_pins[i]; |
| 3137 | dac = get_unassigned_dac(codec, nid); |
| 3138 | if (dac) |
| 3139 | add_spec_extra_dacs(spec, dac); |
| 3140 | spec->speaker_dacs[i] = dac; |
| 3141 | } |
| 3142 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3143 | /* add line-in as output */ |
| 3144 | nid = check_line_out_switch(codec); |
| 3145 | if (nid) { |
| 3146 | dac = get_unassigned_dac(codec, nid); |
| 3147 | if (dac) { |
| 3148 | snd_printdd("STAC: Add line-in 0x%x as output %d\n", |
| 3149 | nid, cfg->line_outs); |
| 3150 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3151 | cfg->line_outs++; |
| 3152 | spec->line_switch = nid; |
| 3153 | add_spec_dacs(spec, dac); |
| 3154 | } |
| 3155 | } |
| 3156 | /* add mic as output */ |
| 3157 | nid = check_mic_out_switch(codec); |
| 3158 | if (nid) { |
| 3159 | dac = get_unassigned_dac(codec, nid); |
| 3160 | if (dac) { |
| 3161 | snd_printdd("STAC: Add mic-in 0x%x as output %d\n", |
| 3162 | nid, cfg->line_outs); |
| 3163 | cfg->line_out_pins[cfg->line_outs] = nid; |
| 3164 | cfg->line_outs++; |
| 3165 | spec->mic_switch = nid; |
| 3166 | add_spec_dacs(spec, dac); |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3167 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3168 | } |
| 3169 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3170 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3171 | spec->multiout.num_dacs, |
| 3172 | spec->multiout.dac_nids[0], |
| 3173 | spec->multiout.dac_nids[1], |
| 3174 | spec->multiout.dac_nids[2], |
| 3175 | spec->multiout.dac_nids[3], |
| 3176 | spec->multiout.dac_nids[4]); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3177 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3178 | return 0; |
| 3179 | } |
| 3180 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3181 | /* create volume control/switch for the given prefx type */ |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3182 | static int create_controls_idx(struct hda_codec *codec, const char *pfx, |
| 3183 | int idx, hda_nid_t nid, int chs) |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3184 | { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3185 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3186 | char name[32]; |
| 3187 | int err; |
| 3188 | |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3189 | if (!spec->check_volume_offset) { |
| 3190 | unsigned int caps, step, nums, db_scale; |
| 3191 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3192 | step = (caps & AC_AMPCAP_STEP_SIZE) >> |
| 3193 | AC_AMPCAP_STEP_SIZE_SHIFT; |
| 3194 | step = (step + 1) * 25; /* in .01dB unit */ |
| 3195 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> |
| 3196 | AC_AMPCAP_NUM_STEPS_SHIFT; |
| 3197 | db_scale = nums * step; |
| 3198 | /* if dB scale is over -64dB, and finer enough, |
| 3199 | * let's reduce it to half |
| 3200 | */ |
| 3201 | if (db_scale > 6400 && nums >= 0x1f) |
| 3202 | spec->volume_offset = nums / 2; |
| 3203 | spec->check_volume_offset = 1; |
| 3204 | } |
| 3205 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3206 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3207 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3208 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
| 3209 | spec->volume_offset)); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3210 | if (err < 0) |
| 3211 | return err; |
| 3212 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3213 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3214 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
| 3215 | if (err < 0) |
| 3216 | return err; |
| 3217 | return 0; |
| 3218 | } |
| 3219 | |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3220 | #define create_controls(codec, pfx, nid, chs) \ |
| 3221 | create_controls_idx(codec, pfx, 0, nid, chs) |
| 3222 | |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3223 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
| 3224 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3225 | if (spec->multiout.num_dacs > 4) { |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3226 | printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); |
| 3227 | return 1; |
| 3228 | } else { |
| 3229 | spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; |
| 3230 | spec->multiout.num_dacs++; |
| 3231 | } |
| 3232 | return 0; |
| 3233 | } |
| 3234 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3235 | 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] | 3236 | { |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3237 | int i; |
| 3238 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { |
| 3239 | if (!spec->multiout.extra_out_nid[i]) { |
| 3240 | spec->multiout.extra_out_nid[i] = nid; |
| 3241 | return 0; |
| 3242 | } |
| 3243 | } |
| 3244 | printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); |
| 3245 | return 1; |
Matthew Ranostay | ae0afd8 | 2008-02-22 17:55:05 +0100 | [diff] [blame] | 3246 | } |
| 3247 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3248 | /* Create output controls |
| 3249 | * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) |
| 3250 | */ |
| 3251 | static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, |
| 3252 | const hda_nid_t *pins, |
| 3253 | const hda_nid_t *dac_nids, |
| 3254 | int type) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3255 | { |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3256 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3257 | static const char *chname[4] = { |
| 3258 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3259 | }; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3260 | hda_nid_t nid; |
Takashi Iwai | 9158923 | 2008-12-19 15:59:40 +0100 | [diff] [blame] | 3261 | int i, err; |
| 3262 | unsigned int wid_caps; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3263 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3264 | for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { |
Takashi Iwai | ffd0e56 | 2009-04-16 12:20:24 +0200 | [diff] [blame] | 3265 | if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { |
| 3266 | wid_caps = get_wcaps(codec, pins[i]); |
| 3267 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 3268 | spec->hp_detect = 1; |
| 3269 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3270 | nid = dac_nids[i]; |
| 3271 | if (!nid) |
| 3272 | continue; |
| 3273 | if (type != AUTO_PIN_HP_OUT && i == 2) { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3274 | /* Center/LFE */ |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3275 | err = create_controls(codec, "Center", nid, 1); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3276 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3277 | return err; |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 3278 | err = create_controls(codec, "LFE", nid, 2); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3279 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3280 | return err; |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3281 | |
| 3282 | wid_caps = get_wcaps(codec, nid); |
| 3283 | |
| 3284 | if (wid_caps & AC_WCAP_LR_SWAP) { |
| 3285 | err = stac92xx_add_control(spec, |
| 3286 | STAC_CTL_WIDGET_CLFE_SWITCH, |
| 3287 | "Swap Center/LFE Playback Switch", nid); |
| 3288 | |
| 3289 | if (err < 0) |
| 3290 | return err; |
| 3291 | } |
| 3292 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3293 | } else { |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3294 | const char *name; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3295 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3296 | switch (type) { |
| 3297 | case AUTO_PIN_HP_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3298 | name = "Headphone"; |
| 3299 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3300 | break; |
| 3301 | case AUTO_PIN_SPEAKER_OUT: |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3302 | name = "Speaker"; |
| 3303 | idx = i; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3304 | break; |
| 3305 | default: |
| 3306 | name = chname[i]; |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3307 | idx = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3308 | break; |
Takashi Iwai | 7662453 | 2008-12-19 10:09:47 +0100 | [diff] [blame] | 3309 | } |
Takashi Iwai | 668b965 | 2009-03-06 10:13:24 +0100 | [diff] [blame] | 3310 | err = create_controls_idx(codec, name, idx, nid, 3); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3311 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3312 | return err; |
| 3313 | } |
| 3314 | } |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3315 | return 0; |
| 3316 | } |
| 3317 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3318 | static int stac92xx_add_capvol_ctls(struct hda_codec *codec, unsigned long vol, |
| 3319 | unsigned long sw, int idx) |
| 3320 | { |
| 3321 | int err; |
| 3322 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_VOL, idx, |
| 3323 | "Captuer Volume", vol); |
| 3324 | if (err < 0) |
| 3325 | return err; |
| 3326 | err = stac92xx_add_control_idx(codec->spec, STAC_CTL_WIDGET_MUTE, idx, |
| 3327 | "Captuer Switch", sw); |
| 3328 | if (err < 0) |
| 3329 | return err; |
| 3330 | return 0; |
| 3331 | } |
| 3332 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3333 | /* add playback controls from the parsed DAC table */ |
| 3334 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, |
| 3335 | const struct auto_pin_cfg *cfg) |
| 3336 | { |
| 3337 | struct sigmatel_spec *spec = codec->spec; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3338 | hda_nid_t nid; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3339 | int err; |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3340 | int idx; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3341 | |
| 3342 | err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, |
| 3343 | spec->multiout.dac_nids, |
| 3344 | cfg->line_out_type); |
| 3345 | if (err < 0) |
| 3346 | return err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3347 | |
Takashi Iwai | a9cb5c9 | 2008-11-24 07:51:11 +0100 | [diff] [blame] | 3348 | 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] | 3349 | err = stac92xx_add_control(spec, |
| 3350 | STAC_CTL_WIDGET_HP_SWITCH, |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 3351 | "Headphone as Line Out Switch", |
| 3352 | cfg->hp_pins[cfg->hp_outs - 1]); |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 3353 | if (err < 0) |
| 3354 | return err; |
| 3355 | } |
| 3356 | |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 3357 | for (idx = AUTO_PIN_MIC; idx <= AUTO_PIN_FRONT_LINE; idx++) { |
| 3358 | nid = cfg->input_pins[idx]; |
| 3359 | if (nid) { |
| 3360 | err = stac92xx_add_jack_mode_control(codec, nid, idx); |
| 3361 | if (err < 0) |
| 3362 | return err; |
| 3363 | } |
Matthew Ranostay | b5895dc | 2008-01-25 15:24:50 +0100 | [diff] [blame] | 3364 | } |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3365 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3366 | return 0; |
| 3367 | } |
| 3368 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3369 | /* add playback controls for Speaker and HP outputs */ |
| 3370 | static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, |
| 3371 | struct auto_pin_cfg *cfg) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3372 | { |
| 3373 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3374 | int err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3375 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3376 | err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, |
| 3377 | spec->hp_dacs, AUTO_PIN_HP_OUT); |
| 3378 | if (err < 0) |
| 3379 | return err; |
| 3380 | |
| 3381 | err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, |
| 3382 | spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); |
| 3383 | if (err < 0) |
| 3384 | return err; |
| 3385 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3386 | return 0; |
| 3387 | } |
| 3388 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3389 | /* labels for mono mux outputs */ |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3390 | static const char *stac92xx_mono_labels[4] = { |
| 3391 | "DAC0", "DAC1", "Mixer", "DAC2" |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3392 | }; |
| 3393 | |
| 3394 | /* create mono mux for mono out on capable codecs */ |
| 3395 | static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) |
| 3396 | { |
| 3397 | struct sigmatel_spec *spec = codec->spec; |
| 3398 | struct hda_input_mux *mono_mux = &spec->private_mono_mux; |
| 3399 | int i, num_cons; |
| 3400 | hda_nid_t con_lst[ARRAY_SIZE(stac92xx_mono_labels)]; |
| 3401 | |
| 3402 | num_cons = snd_hda_get_connections(codec, |
| 3403 | spec->mono_nid, |
| 3404 | con_lst, |
| 3405 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3406 | if (num_cons <= 0 || num_cons > ARRAY_SIZE(stac92xx_mono_labels)) |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3407 | return -EINVAL; |
| 3408 | |
| 3409 | for (i = 0; i < num_cons; i++) { |
| 3410 | mono_mux->items[mono_mux->num_items].label = |
| 3411 | stac92xx_mono_labels[i]; |
| 3412 | mono_mux->items[mono_mux->num_items].index = i; |
| 3413 | mono_mux->num_items++; |
| 3414 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3415 | |
| 3416 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_MONO_MUX, |
| 3417 | "Mono Mux", spec->mono_nid); |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3418 | } |
| 3419 | |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3420 | /* labels for amp mux outputs */ |
| 3421 | static const char *stac92xx_amp_labels[3] = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 3422 | "Front Microphone", "Microphone", "Line In", |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3423 | }; |
| 3424 | |
| 3425 | /* create amp out controls mux on capable codecs */ |
| 3426 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) |
| 3427 | { |
| 3428 | struct sigmatel_spec *spec = codec->spec; |
| 3429 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; |
| 3430 | int i, err; |
| 3431 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3432 | for (i = 0; i < spec->num_amps; i++) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3433 | amp_mux->items[amp_mux->num_items].label = |
| 3434 | stac92xx_amp_labels[i]; |
| 3435 | amp_mux->items[amp_mux->num_items].index = i; |
| 3436 | amp_mux->num_items++; |
| 3437 | } |
| 3438 | |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3439 | if (spec->num_amps > 1) { |
| 3440 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, |
| 3441 | "Amp Selector Capture Switch", 0); |
| 3442 | if (err < 0) |
| 3443 | return err; |
| 3444 | } |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3445 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, |
| 3446 | "Amp Capture Volume", |
| 3447 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); |
| 3448 | } |
| 3449 | |
| 3450 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3451 | /* create PC beep volume controls */ |
| 3452 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, |
| 3453 | hda_nid_t nid) |
| 3454 | { |
| 3455 | struct sigmatel_spec *spec = codec->spec; |
| 3456 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3457 | int err; |
| 3458 | |
| 3459 | /* check for mute support for the the amp */ |
| 3460 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { |
| 3461 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3462 | "PC Beep Playback Switch", |
| 3463 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3464 | if (err < 0) |
| 3465 | return err; |
| 3466 | } |
| 3467 | |
| 3468 | /* check to see if there is volume support for the amp */ |
| 3469 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3470 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, |
| 3471 | "PC Beep Playback Volume", |
| 3472 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); |
| 3473 | if (err < 0) |
| 3474 | return err; |
| 3475 | } |
| 3476 | return 0; |
| 3477 | } |
| 3478 | |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3479 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3480 | #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info |
| 3481 | |
| 3482 | static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, |
| 3483 | struct snd_ctl_elem_value *ucontrol) |
| 3484 | { |
| 3485 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3486 | ucontrol->value.integer.value[0] = codec->beep->enabled; |
| 3487 | return 0; |
| 3488 | } |
| 3489 | |
| 3490 | static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, |
| 3491 | struct snd_ctl_elem_value *ucontrol) |
| 3492 | { |
| 3493 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3494 | int enabled = !!ucontrol->value.integer.value[0]; |
| 3495 | if (codec->beep->enabled != enabled) { |
| 3496 | codec->beep->enabled = enabled; |
| 3497 | return 1; |
| 3498 | } |
| 3499 | return 0; |
| 3500 | } |
| 3501 | |
| 3502 | static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { |
| 3503 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3504 | .info = stac92xx_dig_beep_switch_info, |
| 3505 | .get = stac92xx_dig_beep_switch_get, |
| 3506 | .put = stac92xx_dig_beep_switch_put, |
| 3507 | }; |
| 3508 | |
| 3509 | static int stac92xx_beep_switch_ctl(struct hda_codec *codec) |
| 3510 | { |
| 3511 | return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, |
| 3512 | 0, "PC Beep Playback Switch", 0); |
| 3513 | } |
| 3514 | #endif |
| 3515 | |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3516 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) |
| 3517 | { |
| 3518 | struct sigmatel_spec *spec = codec->spec; |
| 3519 | int wcaps, nid, i, err = 0; |
| 3520 | |
| 3521 | for (i = 0; i < spec->num_muxes; i++) { |
| 3522 | nid = spec->mux_nids[i]; |
| 3523 | wcaps = get_wcaps(codec, nid); |
| 3524 | |
| 3525 | if (wcaps & AC_WCAP_OUT_AMP) { |
| 3526 | err = stac92xx_add_control_idx(spec, |
| 3527 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", |
| 3528 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3529 | if (err < 0) |
| 3530 | return err; |
| 3531 | } |
| 3532 | } |
| 3533 | return 0; |
| 3534 | }; |
| 3535 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3536 | static const char *stac92xx_spdif_labels[3] = { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3537 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3538 | }; |
| 3539 | |
| 3540 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) |
| 3541 | { |
| 3542 | struct sigmatel_spec *spec = codec->spec; |
| 3543 | struct hda_input_mux *spdif_mux = &spec->private_smux; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3544 | const char **labels = spec->spdif_labels; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3545 | int i, num_cons; |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3546 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3547 | |
| 3548 | num_cons = snd_hda_get_connections(codec, |
| 3549 | spec->smux_nids[0], |
| 3550 | con_lst, |
| 3551 | HDA_MAX_NUM_INPUTS); |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3552 | if (num_cons <= 0) |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3553 | return -EINVAL; |
| 3554 | |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3555 | if (!labels) |
| 3556 | labels = stac92xx_spdif_labels; |
| 3557 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3558 | for (i = 0; i < num_cons; i++) { |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 3559 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3560 | spdif_mux->items[spdif_mux->num_items].index = i; |
| 3561 | spdif_mux->num_items++; |
| 3562 | } |
| 3563 | |
| 3564 | return 0; |
| 3565 | } |
| 3566 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3567 | /* labels for dmic mux inputs */ |
Adrian Bunk | ddc2cec | 2006-11-20 12:03:44 +0100 | [diff] [blame] | 3568 | static const char *stac92xx_dmic_labels[5] = { |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3569 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
| 3570 | "Digital Mic 3", "Digital Mic 4" |
| 3571 | }; |
| 3572 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 3573 | static int get_connection_index(struct hda_codec *codec, hda_nid_t mux, |
| 3574 | hda_nid_t nid) |
| 3575 | { |
| 3576 | hda_nid_t conn[HDA_MAX_NUM_INPUTS]; |
| 3577 | int i, nums; |
| 3578 | |
| 3579 | nums = snd_hda_get_connections(codec, mux, conn, ARRAY_SIZE(conn)); |
| 3580 | for (i = 0; i < nums; i++) |
| 3581 | if (conn[i] == nid) |
| 3582 | return i; |
| 3583 | return -1; |
| 3584 | } |
| 3585 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3586 | /* create playback/capture controls for input pins on dmic capable codecs */ |
| 3587 | static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, |
| 3588 | const struct auto_pin_cfg *cfg) |
| 3589 | { |
| 3590 | struct sigmatel_spec *spec = codec->spec; |
| 3591 | struct hda_input_mux *dimux = &spec->private_dimux; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 3592 | int err, i; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3593 | char name[32]; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3594 | |
| 3595 | dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; |
| 3596 | dimux->items[dimux->num_items].index = 0; |
| 3597 | dimux->num_items++; |
| 3598 | |
| 3599 | for (i = 0; i < spec->num_dmics; i++) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3600 | hda_nid_t nid; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3601 | int index; |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3602 | unsigned int wcaps; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3603 | unsigned int def_conf; |
| 3604 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 3605 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3606 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
| 3607 | continue; |
| 3608 | |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3609 | nid = spec->dmic_nids[i]; |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 3610 | index = get_connection_index(codec, spec->dmux_nids[0], nid); |
| 3611 | if (index < 0) |
| 3612 | continue; |
| 3613 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3614 | wcaps = get_wcaps(codec, nid) & |
| 3615 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3616 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3617 | if (wcaps) { |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3618 | sprintf(name, "%s Capture Volume", |
| 3619 | stac92xx_dmic_labels[dimux->num_items]); |
| 3620 | |
| 3621 | err = stac92xx_add_control(spec, |
| 3622 | STAC_CTL_WIDGET_VOL, |
| 3623 | name, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3624 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3625 | (wcaps & AC_WCAP_OUT_AMP) ? |
| 3626 | HDA_OUTPUT : HDA_INPUT)); |
Matthew Ranostay | 0678acc | 2008-01-08 12:10:50 +0100 | [diff] [blame] | 3627 | if (err < 0) |
| 3628 | return err; |
| 3629 | } |
| 3630 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3631 | dimux->items[dimux->num_items].label = |
| 3632 | stac92xx_dmic_labels[dimux->num_items]; |
| 3633 | dimux->items[dimux->num_items].index = index; |
| 3634 | dimux->num_items++; |
| 3635 | } |
| 3636 | |
| 3637 | return 0; |
| 3638 | } |
| 3639 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 3640 | static int check_mic_pin(struct hda_codec *codec, hda_nid_t nid, |
| 3641 | hda_nid_t *fixed, hda_nid_t *ext) |
| 3642 | { |
| 3643 | unsigned int cfg; |
| 3644 | |
| 3645 | if (!nid) |
| 3646 | return 0; |
| 3647 | cfg = snd_hda_codec_get_pincfg(codec, nid); |
| 3648 | switch (get_defcfg_connect(cfg)) { |
| 3649 | case AC_JACK_PORT_FIXED: |
| 3650 | if (*fixed) |
| 3651 | return 1; /* already occupied */ |
| 3652 | *fixed = nid; |
| 3653 | break; |
| 3654 | case AC_JACK_PORT_COMPLEX: |
| 3655 | if (*ext) |
| 3656 | return 1; /* already occupied */ |
| 3657 | *ext = nid; |
| 3658 | break; |
| 3659 | } |
| 3660 | return 0; |
| 3661 | } |
| 3662 | |
| 3663 | static int set_mic_route(struct hda_codec *codec, |
| 3664 | struct sigmatel_mic_route *mic, |
| 3665 | hda_nid_t pin) |
| 3666 | { |
| 3667 | struct sigmatel_spec *spec = codec->spec; |
| 3668 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3669 | int i; |
| 3670 | |
| 3671 | mic->pin = pin; |
| 3672 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) |
| 3673 | if (pin == cfg->input_pins[i]) |
| 3674 | break; |
| 3675 | if (i <= AUTO_PIN_FRONT_MIC) { |
| 3676 | /* analog pin */ |
| 3677 | mic->dmux_idx = 0; |
| 3678 | i = get_connection_index(codec, spec->mux_nids[0], pin); |
| 3679 | if (i < 0) |
| 3680 | return -1; |
| 3681 | mic->mux_idx = i; |
| 3682 | } else { |
| 3683 | /* digital pin */ |
| 3684 | mic->mux_idx = 0; |
| 3685 | i = get_connection_index(codec, spec->dmux_nids[0], pin); |
| 3686 | if (i < 0) |
| 3687 | return -1; |
| 3688 | mic->dmux_idx = i; |
| 3689 | } |
| 3690 | return 0; |
| 3691 | } |
| 3692 | |
| 3693 | /* return non-zero if the device is for automatic mic switch */ |
| 3694 | static int stac_check_auto_mic(struct hda_codec *codec) |
| 3695 | { |
| 3696 | struct sigmatel_spec *spec = codec->spec; |
| 3697 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 3698 | hda_nid_t fixed, ext; |
| 3699 | int i; |
| 3700 | |
| 3701 | for (i = AUTO_PIN_LINE; i < AUTO_PIN_LAST; i++) { |
| 3702 | if (cfg->input_pins[i]) |
| 3703 | return 0; /* must be exclusively mics */ |
| 3704 | } |
| 3705 | fixed = ext = 0; |
| 3706 | for (i = AUTO_PIN_MIC; i <= AUTO_PIN_FRONT_MIC; i++) |
| 3707 | if (check_mic_pin(codec, cfg->input_pins[i], &fixed, &ext)) |
| 3708 | return 0; |
| 3709 | for (i = 0; i < spec->num_dmics; i++) |
| 3710 | if (check_mic_pin(codec, spec->dmic_nids[i], &fixed, &ext)) |
| 3711 | return 0; |
| 3712 | if (!fixed || !ext) |
| 3713 | return 0; |
| 3714 | if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) |
| 3715 | return 0; /* no unsol support */ |
| 3716 | if (set_mic_route(codec, &spec->ext_mic, ext) || |
| 3717 | set_mic_route(codec, &spec->int_mic, fixed)) |
| 3718 | return 0; /* something is wrong */ |
| 3719 | return 1; |
| 3720 | } |
| 3721 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3722 | /* create playback/capture controls for input pins */ |
| 3723 | static int stac92xx_auto_create_analog_input_ctls(struct hda_codec *codec, const struct auto_pin_cfg *cfg) |
| 3724 | { |
| 3725 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3726 | struct hda_input_mux *imux = &spec->private_imux; |
| 3727 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; |
| 3728 | int i, j, k; |
| 3729 | |
| 3730 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3731 | int index; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3732 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3733 | if (!cfg->input_pins[i]) |
| 3734 | continue; |
| 3735 | index = -1; |
| 3736 | for (j = 0; j < spec->num_muxes; j++) { |
| 3737 | int num_cons; |
| 3738 | num_cons = snd_hda_get_connections(codec, |
| 3739 | spec->mux_nids[j], |
| 3740 | con_lst, |
| 3741 | HDA_MAX_NUM_INPUTS); |
| 3742 | for (k = 0; k < num_cons; k++) |
| 3743 | if (con_lst[k] == cfg->input_pins[i]) { |
| 3744 | index = k; |
| 3745 | goto found; |
| 3746 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3747 | } |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 3748 | continue; |
| 3749 | found: |
| 3750 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 3751 | imux->items[imux->num_items].index = index; |
| 3752 | imux->num_items++; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3753 | } |
| 3754 | |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 3755 | if (imux->num_items) { |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3756 | /* |
| 3757 | * Set the current input for the muxes. |
| 3758 | * The STAC9221 has two input muxes with identical source |
| 3759 | * NID lists. Hopefully this won't get confused. |
| 3760 | */ |
| 3761 | for (i = 0; i < spec->num_muxes; i++) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 3762 | snd_hda_codec_write_cache(codec, spec->mux_nids[i], 0, |
| 3763 | AC_VERB_SET_CONNECT_SEL, |
| 3764 | imux->items[0].index); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 3765 | } |
| 3766 | } |
| 3767 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3768 | return 0; |
| 3769 | } |
| 3770 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3771 | static void stac92xx_auto_init_multi_out(struct hda_codec *codec) |
| 3772 | { |
| 3773 | struct sigmatel_spec *spec = codec->spec; |
| 3774 | int i; |
| 3775 | |
| 3776 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3777 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
| 3778 | stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); |
| 3779 | } |
| 3780 | } |
| 3781 | |
| 3782 | static void stac92xx_auto_init_hp_out(struct hda_codec *codec) |
| 3783 | { |
| 3784 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3785 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3786 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3787 | for (i = 0; i < spec->autocfg.hp_outs; i++) { |
| 3788 | hda_nid_t pin; |
| 3789 | pin = spec->autocfg.hp_pins[i]; |
| 3790 | if (pin) /* connect to front */ |
| 3791 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); |
| 3792 | } |
| 3793 | for (i = 0; i < spec->autocfg.speaker_outs; i++) { |
| 3794 | hda_nid_t pin; |
| 3795 | pin = spec->autocfg.speaker_pins[i]; |
| 3796 | if (pin) /* connect to front */ |
| 3797 | stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); |
| 3798 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3799 | } |
| 3800 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3801 | 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] | 3802 | { |
| 3803 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3804 | int hp_swap = 0; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3805 | int i, err; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3806 | |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3807 | if ((err = snd_hda_parse_pin_def_config(codec, |
| 3808 | &spec->autocfg, |
| 3809 | spec->dmic_nids)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3810 | return err; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3811 | if (! spec->autocfg.line_outs) |
Matt Porter | 869264c | 2006-01-25 19:20:50 +0100 | [diff] [blame] | 3812 | return 0; /* can't find valid pin config */ |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3813 | |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3814 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
| 3815 | * be set up as multi-channel outputs. |
| 3816 | */ |
| 3817 | if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && |
| 3818 | spec->autocfg.hp_outs > 1) { |
| 3819 | /* Copy hp_outs to line_outs, backup line_outs in |
| 3820 | * speaker_outs so that the following routines can handle |
| 3821 | * HP pins as primary outputs. |
| 3822 | */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3823 | snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3824 | memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, |
| 3825 | sizeof(spec->autocfg.line_out_pins)); |
| 3826 | spec->autocfg.speaker_outs = spec->autocfg.line_outs; |
| 3827 | memcpy(spec->autocfg.line_out_pins, spec->autocfg.hp_pins, |
| 3828 | sizeof(spec->autocfg.hp_pins)); |
| 3829 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3830 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3831 | spec->autocfg.hp_outs = 0; |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3832 | hp_swap = 1; |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3833 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3834 | if (spec->autocfg.mono_out_pin) { |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3835 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
| 3836 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3837 | u32 caps = query_amp_caps(codec, |
| 3838 | spec->autocfg.mono_out_pin, dir); |
| 3839 | hda_nid_t conn_list[1]; |
| 3840 | |
| 3841 | /* get the mixer node and then the mono mux if it exists */ |
| 3842 | if (snd_hda_get_connections(codec, |
| 3843 | spec->autocfg.mono_out_pin, conn_list, 1) && |
| 3844 | snd_hda_get_connections(codec, conn_list[0], |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 3845 | conn_list, 1) > 0) { |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3846 | |
| 3847 | int wcaps = get_wcaps(codec, conn_list[0]); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 3848 | int wid_type = get_wcaps_type(wcaps); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3849 | /* LR swap check, some stac925x have a mux that |
| 3850 | * changes the DACs output path instead of the |
| 3851 | * mono-mux path. |
| 3852 | */ |
| 3853 | if (wid_type == AC_WID_AUD_SEL && |
| 3854 | !(wcaps & AC_WCAP_LR_SWAP)) |
| 3855 | spec->mono_nid = conn_list[0]; |
| 3856 | } |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3857 | if (dir) { |
| 3858 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
| 3859 | |
| 3860 | /* most mono outs have a least a mute/unmute switch */ |
| 3861 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
| 3862 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
| 3863 | "Mono Playback Switch", |
| 3864 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3865 | if (err < 0) |
| 3866 | return err; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3867 | /* check for volume support for the amp */ |
| 3868 | if ((caps & AC_AMPCAP_NUM_STEPS) |
| 3869 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { |
| 3870 | err = stac92xx_add_control(spec, |
| 3871 | STAC_CTL_WIDGET_VOL, |
| 3872 | "Mono Playback Volume", |
| 3873 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); |
| 3874 | if (err < 0) |
| 3875 | return err; |
| 3876 | } |
Matthew Ranostay | 09a9995 | 2008-01-24 11:49:21 +0100 | [diff] [blame] | 3877 | } |
| 3878 | |
| 3879 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
| 3880 | AC_PINCTL_OUT_EN); |
| 3881 | } |
Jiang Zhe | bcecd9b | 2007-11-12 12:57:03 +0100 | [diff] [blame] | 3882 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3883 | if (!spec->multiout.num_dacs) { |
| 3884 | err = stac92xx_auto_fill_dac_nids(codec); |
| 3885 | if (err < 0) |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 3886 | return err; |
Takashi Iwai | c9280d6 | 2009-01-15 17:31:00 +0100 | [diff] [blame] | 3887 | err = stac92xx_auto_create_multi_out_ctls(codec, |
| 3888 | &spec->autocfg); |
| 3889 | if (err < 0) |
| 3890 | return err; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 3891 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3892 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3893 | /* setup analog beep controls */ |
| 3894 | if (spec->anabeep_nid > 0) { |
| 3895 | err = stac92xx_auto_create_beep_ctls(codec, |
| 3896 | spec->anabeep_nid); |
| 3897 | if (err < 0) |
| 3898 | return err; |
| 3899 | } |
| 3900 | |
| 3901 | /* setup digital beep controls and input device */ |
| 3902 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 3903 | if (spec->digbeep_nid > 0) { |
| 3904 | hda_nid_t nid = spec->digbeep_nid; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3905 | unsigned int caps; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3906 | |
| 3907 | err = stac92xx_auto_create_beep_ctls(codec, nid); |
| 3908 | if (err < 0) |
| 3909 | return err; |
| 3910 | err = snd_hda_attach_beep_device(codec, nid); |
| 3911 | if (err < 0) |
| 3912 | return err; |
Takashi Iwai | fa79796 | 2009-05-19 12:50:04 +0200 | [diff] [blame] | 3913 | /* IDT/STAC codecs have linear beep tone parameter */ |
| 3914 | codec->beep->linear_tone = 1; |
Takashi Iwai | 4d4e9bb | 2008-11-12 16:45:04 +0100 | [diff] [blame] | 3915 | /* if no beep switch is available, make its own one */ |
| 3916 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
| 3917 | if (codec->beep && |
| 3918 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { |
| 3919 | err = stac92xx_beep_switch_ctl(codec); |
| 3920 | if (err < 0) |
| 3921 | return err; |
| 3922 | } |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 3923 | } |
| 3924 | #endif |
| 3925 | |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3926 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3927 | if (err < 0) |
| 3928 | return err; |
| 3929 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3930 | /* All output parsing done, now restore the swapped hp pins */ |
| 3931 | if (hp_swap) { |
| 3932 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
| 3933 | sizeof(spec->autocfg.hp_pins)); |
| 3934 | spec->autocfg.hp_outs = spec->autocfg.line_outs; |
| 3935 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
| 3936 | spec->autocfg.line_outs = 0; |
| 3937 | } |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3938 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 3939 | if (stac_check_auto_mic(codec)) { |
| 3940 | spec->auto_mic = 1; |
| 3941 | /* only one capture for auto-mic */ |
| 3942 | spec->num_adcs = 1; |
| 3943 | spec->num_caps = 1; |
| 3944 | spec->num_muxes = 1; |
| 3945 | } |
| 3946 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 3947 | for (i = 0; i < spec->num_caps; i++) { |
| 3948 | err = stac92xx_add_capvol_ctls(codec, spec->capvols[i], |
| 3949 | spec->capsws[i], i); |
| 3950 | if (err < 0) |
| 3951 | return err; |
| 3952 | } |
| 3953 | |
Takashi Iwai | dc04d1b | 2009-03-06 10:00:05 +0100 | [diff] [blame] | 3954 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); |
Maxim Levitsky | 0fb87bb | 2007-09-03 15:29:04 +0200 | [diff] [blame] | 3955 | if (err < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3956 | return err; |
| 3957 | |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 3958 | if (spec->mono_nid > 0) { |
| 3959 | err = stac92xx_auto_create_mono_output_ctls(codec); |
| 3960 | if (err < 0) |
| 3961 | return err; |
| 3962 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3963 | if (spec->num_amps > 0) { |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 3964 | err = stac92xx_auto_create_amp_output_ctls(codec); |
| 3965 | if (err < 0) |
| 3966 | return err; |
| 3967 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 3968 | if (spec->num_dmics > 0 && !spec->dinput_mux) |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3969 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
| 3970 | &spec->autocfg)) < 0) |
| 3971 | return err; |
Matthew Ranostay | 4682eee | 2008-08-15 07:43:24 +0200 | [diff] [blame] | 3972 | if (spec->num_muxes > 0) { |
| 3973 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 3974 | if (err < 0) |
| 3975 | return err; |
| 3976 | } |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 3977 | if (spec->num_smuxes > 0) { |
| 3978 | err = stac92xx_auto_create_spdif_mux_ctls(codec); |
| 3979 | if (err < 0) |
| 3980 | return err; |
| 3981 | } |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 3982 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 3983 | err = stac92xx_add_input_source(spec); |
| 3984 | if (err < 0) |
| 3985 | return err; |
| 3986 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3987 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
Matt Porter | 403d194 | 2005-11-29 15:00:51 +0100 | [diff] [blame] | 3988 | if (spec->multiout.max_channels > 2) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3989 | spec->surr_switch = 1; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3990 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 3991 | if (spec->autocfg.dig_outs) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3992 | spec->multiout.dig_out_nid = dig_out; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 3993 | if (dig_in && spec->autocfg.dig_in_pin) |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 3994 | spec->dig_in_nid = dig_in; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3995 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 3996 | if (spec->kctls.list) |
| 3997 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 3998 | |
| 3999 | spec->input_mux = &spec->private_imux; |
Matthew Ranostay | f8ccbf6 | 2008-12-20 17:36:28 -0500 | [diff] [blame] | 4000 | if (!spec->dinput_mux) |
| 4001 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 4002 | spec->sinput_mux = &spec->private_smux; |
Matthew Ranostay | b22b482 | 2008-01-22 12:32:30 +0100 | [diff] [blame] | 4003 | spec->mono_mux = &spec->private_mono_mux; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 4004 | spec->amp_mux = &spec->private_amp_mux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4005 | return 1; |
| 4006 | } |
| 4007 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4008 | /* add playback controls for HP output */ |
| 4009 | static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, |
| 4010 | struct auto_pin_cfg *cfg) |
| 4011 | { |
| 4012 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4013 | hda_nid_t pin = cfg->hp_pins[0]; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4014 | unsigned int wid_caps; |
| 4015 | |
| 4016 | if (! pin) |
| 4017 | return 0; |
| 4018 | |
| 4019 | wid_caps = get_wcaps(codec, pin); |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4020 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4021 | spec->hp_detect = 1; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4022 | |
| 4023 | return 0; |
| 4024 | } |
| 4025 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4026 | /* add playback controls for LFE output */ |
| 4027 | static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, |
| 4028 | struct auto_pin_cfg *cfg) |
| 4029 | { |
| 4030 | struct sigmatel_spec *spec = codec->spec; |
| 4031 | int err; |
| 4032 | hda_nid_t lfe_pin = 0x0; |
| 4033 | int i; |
| 4034 | |
| 4035 | /* |
| 4036 | * search speaker outs and line outs for a mono speaker pin |
| 4037 | * with an amp. If one is found, add LFE controls |
| 4038 | * for it. |
| 4039 | */ |
| 4040 | for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { |
| 4041 | hda_nid_t pin = spec->autocfg.speaker_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4042 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4043 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4044 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4045 | /* found a mono speaker with an amp, must be lfe */ |
| 4046 | lfe_pin = pin; |
| 4047 | } |
| 4048 | |
| 4049 | /* if speaker_outs is 0, then speakers may be in line_outs */ |
| 4050 | if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { |
| 4051 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
| 4052 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4053 | unsigned int defcfg; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4054 | defcfg = snd_hda_codec_get_pincfg(codec, pin); |
Harvey Harrison | 8b55178 | 2008-02-29 11:56:48 +0100 | [diff] [blame] | 4055 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
Takashi Iwai | 64ed0df | 2008-02-29 11:57:53 +0100 | [diff] [blame] | 4056 | unsigned int wcaps = get_wcaps(codec, pin); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4057 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
| 4058 | if (wcaps == AC_WCAP_OUT_AMP) |
| 4059 | /* found a mono speaker with an amp, |
| 4060 | must be lfe */ |
| 4061 | lfe_pin = pin; |
| 4062 | } |
| 4063 | } |
| 4064 | } |
| 4065 | |
| 4066 | if (lfe_pin) { |
Takashi Iwai | 7c7767e | 2009-01-20 15:28:38 +0100 | [diff] [blame] | 4067 | err = create_controls(codec, "LFE", lfe_pin, 1); |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4068 | if (err < 0) |
| 4069 | return err; |
| 4070 | } |
| 4071 | |
| 4072 | return 0; |
| 4073 | } |
| 4074 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4075 | static int stac9200_parse_auto_config(struct hda_codec *codec) |
| 4076 | { |
| 4077 | struct sigmatel_spec *spec = codec->spec; |
| 4078 | int err; |
| 4079 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4080 | if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4081 | return err; |
| 4082 | |
| 4083 | if ((err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg)) < 0) |
| 4084 | return err; |
| 4085 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4086 | if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) |
| 4087 | return err; |
| 4088 | |
Richard Fish | 160ea0d | 2006-09-06 13:58:25 +0200 | [diff] [blame] | 4089 | if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) |
| 4090 | return err; |
| 4091 | |
Takashi Iwai | 355a0ec | 2008-11-11 16:46:19 +0100 | [diff] [blame] | 4092 | if (spec->num_muxes > 0) { |
| 4093 | err = stac92xx_auto_create_mux_input_ctls(codec); |
| 4094 | if (err < 0) |
| 4095 | return err; |
| 4096 | } |
| 4097 | |
Takashi Iwai | e3c7596 | 2009-01-23 11:57:22 +0100 | [diff] [blame] | 4098 | err = stac92xx_add_input_source(spec); |
| 4099 | if (err < 0) |
| 4100 | return err; |
| 4101 | |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4102 | if (spec->autocfg.dig_outs) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4103 | spec->multiout.dig_out_nid = 0x05; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4104 | if (spec->autocfg.dig_in_pin) |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4105 | spec->dig_in_nid = 0x04; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4106 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4107 | if (spec->kctls.list) |
| 4108 | spec->mixers[spec->num_mixers++] = spec->kctls.list; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4109 | |
| 4110 | spec->input_mux = &spec->private_imux; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4111 | spec->dinput_mux = &spec->private_dimux; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4112 | |
| 4113 | return 1; |
| 4114 | } |
| 4115 | |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4116 | /* |
| 4117 | * Early 2006 Intel Macintoshes with STAC9220X5 codecs seem to have a |
| 4118 | * funky external mute control using GPIO pins. |
| 4119 | */ |
| 4120 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4121 | static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4122 | unsigned int dir_mask, unsigned int data) |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4123 | { |
| 4124 | unsigned int gpiostate, gpiomask, gpiodir; |
| 4125 | |
| 4126 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 4127 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4128 | gpiostate = (gpiostate & ~dir_mask) | (data & dir_mask); |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4129 | |
| 4130 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 4131 | AC_VERB_GET_GPIO_MASK, 0); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4132 | gpiomask |= mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4133 | |
| 4134 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 4135 | AC_VERB_GET_GPIO_DIRECTION, 0); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4136 | gpiodir |= dir_mask; |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4137 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4138 | /* Configure GPIOx as CMOS */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4139 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e7, 0); |
| 4140 | |
| 4141 | snd_hda_codec_write(codec, codec->afg, 0, |
| 4142 | AC_VERB_SET_GPIO_MASK, gpiomask); |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4143 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4144 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4145 | |
| 4146 | msleep(1); |
| 4147 | |
Takashi Iwai | 76e1ddf | 2008-01-15 11:39:08 +0100 | [diff] [blame] | 4148 | snd_hda_codec_read(codec, codec->afg, 0, |
| 4149 | AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4150 | } |
| 4151 | |
Takashi Iwai | 8c8145b | 2009-06-22 17:00:38 +0200 | [diff] [blame] | 4152 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4153 | static void stac92xx_free_jack_priv(struct snd_jack *jack) |
| 4154 | { |
| 4155 | struct sigmatel_jack *jacks = jack->private_data; |
| 4156 | jacks->nid = 0; |
| 4157 | jacks->jack = NULL; |
| 4158 | } |
| 4159 | #endif |
| 4160 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4161 | static int stac92xx_add_jack(struct hda_codec *codec, |
| 4162 | hda_nid_t nid, int type) |
| 4163 | { |
Takashi Iwai | 8c8145b | 2009-06-22 17:00:38 +0200 | [diff] [blame] | 4164 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4165 | struct sigmatel_spec *spec = codec->spec; |
| 4166 | struct sigmatel_jack *jack; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4167 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4168 | int connectivity = get_defcfg_connect(def_conf); |
| 4169 | char name[32]; |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4170 | int err; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4171 | |
| 4172 | if (connectivity && connectivity != AC_JACK_PORT_FIXED) |
| 4173 | return 0; |
| 4174 | |
| 4175 | snd_array_init(&spec->jacks, sizeof(*jack), 32); |
| 4176 | jack = snd_array_new(&spec->jacks); |
| 4177 | if (!jack) |
| 4178 | return -ENOMEM; |
| 4179 | jack->nid = nid; |
| 4180 | jack->type = type; |
| 4181 | |
Takashi Iwai | 86de741 | 2009-07-22 16:02:46 +0200 | [diff] [blame] | 4182 | snprintf(name, sizeof(name), "%s at %s %s Jack", |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4183 | snd_hda_get_jack_type(def_conf), |
| 4184 | snd_hda_get_jack_connectivity(def_conf), |
| 4185 | snd_hda_get_jack_location(def_conf)); |
| 4186 | |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4187 | err = snd_jack_new(codec->bus->card, name, type, &jack->jack); |
| 4188 | if (err < 0) { |
| 4189 | jack->nid = 0; |
| 4190 | return err; |
| 4191 | } |
| 4192 | jack->jack->private_data = jack; |
| 4193 | jack->jack->private_free = stac92xx_free_jack_priv; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4194 | #endif |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4195 | return 0; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4196 | } |
| 4197 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4198 | static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, |
| 4199 | unsigned char type, int data) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4200 | { |
| 4201 | struct sigmatel_event *event; |
| 4202 | |
| 4203 | snd_array_init(&spec->events, sizeof(*event), 32); |
| 4204 | event = snd_array_new(&spec->events); |
| 4205 | if (!event) |
| 4206 | return -ENOMEM; |
| 4207 | event->nid = nid; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4208 | event->type = type; |
| 4209 | event->tag = spec->events.used; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4210 | event->data = data; |
| 4211 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4212 | return event->tag; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4213 | } |
| 4214 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4215 | static struct sigmatel_event *stac_get_event(struct hda_codec *codec, |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4216 | hda_nid_t nid) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4217 | { |
| 4218 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4219 | struct sigmatel_event *event = spec->events.list; |
| 4220 | int i; |
| 4221 | |
| 4222 | for (i = 0; i < spec->events.used; i++, event++) { |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4223 | if (event->nid == nid) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4224 | return event; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4225 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4226 | return NULL; |
| 4227 | } |
| 4228 | |
| 4229 | static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, |
| 4230 | unsigned char tag) |
| 4231 | { |
| 4232 | struct sigmatel_spec *spec = codec->spec; |
| 4233 | struct sigmatel_event *event = spec->events.list; |
| 4234 | int i; |
| 4235 | |
| 4236 | for (i = 0; i < spec->events.used; i++, event++) { |
| 4237 | if (event->tag == tag) |
| 4238 | return event; |
| 4239 | } |
| 4240 | return NULL; |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4241 | } |
| 4242 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4243 | /* check if given nid is a valid pin and no other events are assigned |
| 4244 | * to it. If OK, assign the event, set the unsol flag, and returns 1. |
| 4245 | * Otherwise, returns zero. |
| 4246 | */ |
| 4247 | static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, |
| 4248 | unsigned int type) |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4249 | { |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4250 | struct sigmatel_event *event; |
| 4251 | int tag; |
| 4252 | |
| 4253 | if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4254 | return 0; |
| 4255 | event = stac_get_event(codec, nid); |
| 4256 | if (event) { |
| 4257 | if (event->type != type) |
| 4258 | return 0; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4259 | tag = event->tag; |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4260 | } else { |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4261 | tag = stac_add_event(codec->spec, nid, type, 0); |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4262 | if (tag < 0) |
| 4263 | return 0; |
| 4264 | } |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4265 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4266 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 4267 | AC_USRSP_EN | tag); |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4268 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4269 | } |
| 4270 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4271 | static int is_nid_hp_pin(struct auto_pin_cfg *cfg, hda_nid_t nid) |
| 4272 | { |
| 4273 | int i; |
| 4274 | for (i = 0; i < cfg->hp_outs; i++) |
| 4275 | if (cfg->hp_pins[i] == nid) |
| 4276 | return 1; /* nid is a HP-Out */ |
| 4277 | |
| 4278 | return 0; /* nid is not a HP-Out */ |
| 4279 | }; |
| 4280 | |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4281 | static void stac92xx_power_down(struct hda_codec *codec) |
| 4282 | { |
| 4283 | struct sigmatel_spec *spec = codec->spec; |
| 4284 | |
| 4285 | /* power down inactive DACs */ |
| 4286 | hda_nid_t *dac; |
| 4287 | for (dac = spec->dac_list; *dac; dac++) |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4288 | if (!check_all_dac_nids(spec, *dac)) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4289 | snd_hda_codec_write(codec, *dac, 0, |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 4290 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
| 4291 | } |
| 4292 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4293 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4294 | int enable); |
| 4295 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4296 | /* override some hints from the hwdep entry */ |
| 4297 | static void stac_store_hints(struct hda_codec *codec) |
| 4298 | { |
| 4299 | struct sigmatel_spec *spec = codec->spec; |
| 4300 | const char *p; |
| 4301 | int val; |
| 4302 | |
| 4303 | val = snd_hda_get_bool_hint(codec, "hp_detect"); |
| 4304 | if (val >= 0) |
| 4305 | spec->hp_detect = val; |
| 4306 | p = snd_hda_get_hint(codec, "gpio_mask"); |
| 4307 | if (p) { |
| 4308 | spec->gpio_mask = simple_strtoul(p, NULL, 0); |
| 4309 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = |
| 4310 | spec->gpio_mask; |
| 4311 | } |
| 4312 | p = snd_hda_get_hint(codec, "gpio_dir"); |
| 4313 | if (p) |
| 4314 | spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4315 | p = snd_hda_get_hint(codec, "gpio_data"); |
| 4316 | if (p) |
| 4317 | spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4318 | p = snd_hda_get_hint(codec, "eapd_mask"); |
| 4319 | if (p) |
| 4320 | spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; |
| 4321 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); |
| 4322 | if (val >= 0) |
| 4323 | spec->eapd_switch = val; |
| 4324 | } |
| 4325 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4326 | static int stac92xx_init(struct hda_codec *codec) |
| 4327 | { |
| 4328 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4329 | struct auto_pin_cfg *cfg = &spec->autocfg; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4330 | unsigned int gpio; |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4331 | int i; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4332 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4333 | snd_hda_sequence_write(codec, spec->init); |
| 4334 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4335 | /* power down adcs initially */ |
| 4336 | if (spec->powerdown_adcs) |
| 4337 | for (i = 0; i < spec->num_adcs; i++) |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 4338 | snd_hda_codec_write(codec, |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 4339 | spec->adc_nids[i], 0, |
| 4340 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4341 | |
Takashi Iwai | 6565e4f | 2009-03-02 14:38:35 +0100 | [diff] [blame] | 4342 | /* override some hints */ |
| 4343 | stac_store_hints(codec); |
| 4344 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4345 | /* set up GPIO */ |
| 4346 | gpio = spec->gpio_data; |
| 4347 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
| 4348 | * otherwise, unsol event will turn it on/off dynamically |
| 4349 | */ |
| 4350 | if (!spec->eapd_switch) |
| 4351 | gpio |= spec->eapd_mask; |
| 4352 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); |
| 4353 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4354 | /* set up pins */ |
| 4355 | if (spec->hp_detect) { |
Takashi Iwai | 505cb34 | 2006-03-27 12:51:52 +0200 | [diff] [blame] | 4356 | /* Enable unsolicited responses on the HP widget */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4357 | for (i = 0; i < cfg->hp_outs; i++) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4358 | hda_nid_t nid = cfg->hp_pins[i]; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4359 | enable_pin_detect(codec, nid, STAC_HP_EVENT); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4360 | } |
Takashi Iwai | 0a07aca | 2007-03-13 10:40:23 +0100 | [diff] [blame] | 4361 | /* force to enable the first line-out; the others are set up |
| 4362 | * in unsol_event |
| 4363 | */ |
| 4364 | stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4365 | AC_PINCTL_OUT_EN); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4366 | /* fake event to set up pins */ |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4367 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4368 | } else { |
| 4369 | stac92xx_auto_init_multi_out(codec); |
| 4370 | stac92xx_auto_init_hp_out(codec); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4371 | for (i = 0; i < cfg->hp_outs; i++) |
| 4372 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4373 | } |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 4374 | if (spec->auto_mic) { |
| 4375 | if (enable_pin_detect(codec, spec->ext_mic.pin, STAC_MIC_EVENT)) |
| 4376 | stac_issue_unsol_event(codec, spec->ext_mic.pin); |
| 4377 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4378 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4379 | hda_nid_t nid = cfg->input_pins[i]; |
| 4380 | if (nid) { |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4381 | unsigned int pinctl, conf; |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4382 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
| 4383 | /* for mic pins, force to initialize */ |
Nickolas Lloyd | 7c922de | 2009-06-01 11:12:29 +0200 | [diff] [blame] | 4384 | pinctl = stac92xx_get_default_vref(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4385 | pinctl |= AC_PINCTL_IN_EN; |
| 4386 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4387 | } else { |
| 4388 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4389 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4390 | /* if PINCTL already set then skip */ |
Takashi Iwai | 5dd17cb9 | 2009-05-07 16:22:53 +0200 | [diff] [blame] | 4391 | /* Also, if both INPUT and OUTPUT are set, |
| 4392 | * it must be a BIOS bug; need to override, too |
| 4393 | */ |
| 4394 | if (!(pinctl & AC_PINCTL_IN_EN) || |
| 4395 | (pinctl & AC_PINCTL_OUT_EN)) { |
| 4396 | pinctl &= ~AC_PINCTL_OUT_EN; |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4397 | pinctl |= AC_PINCTL_IN_EN; |
| 4398 | stac92xx_auto_set_pinctl(codec, nid, |
| 4399 | pinctl); |
| 4400 | } |
Takashi Iwai | 4f1e6bc | 2008-11-11 16:47:24 +0100 | [diff] [blame] | 4401 | } |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4402 | conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4403 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4404 | if (enable_pin_detect(codec, nid, |
| 4405 | STAC_INSERT_EVENT)) |
| 4406 | stac_issue_unsol_event(codec, nid); |
Takashi Iwai | 12dde4c | 2008-12-05 13:09:27 +0100 | [diff] [blame] | 4407 | } |
Takashi Iwai | c960a03 | 2006-03-23 17:06:28 +0100 | [diff] [blame] | 4408 | } |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4409 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4410 | for (i = 0; i < spec->num_dmics; i++) |
| 4411 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
| 4412 | AC_PINCTL_IN_EN); |
Takashi Iwai | 0852d7a | 2009-02-11 11:35:15 +0100 | [diff] [blame] | 4413 | if (cfg->dig_out_pins[0]) |
| 4414 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4415 | AC_PINCTL_OUT_EN); |
| 4416 | if (cfg->dig_in_pin) |
| 4417 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
| 4418 | AC_PINCTL_IN_EN); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4419 | for (i = 0; i < spec->num_pwrs; i++) { |
| 4420 | hda_nid_t nid = spec->pwr_nids[i]; |
| 4421 | int pinctl, def_conf; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4422 | |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4423 | /* power on when no jack detection is available */ |
| 4424 | if (!spec->hp_detect) { |
| 4425 | stac_toggle_power_map(codec, nid, 1); |
| 4426 | continue; |
| 4427 | } |
| 4428 | |
| 4429 | if (is_nid_hp_pin(cfg, nid)) |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4430 | continue; /* already has an unsol event */ |
Sam Revitch | 62fe78e | 2006-05-10 15:09:17 +0200 | [diff] [blame] | 4431 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4432 | pinctl = snd_hda_codec_read(codec, nid, 0, |
| 4433 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4434 | /* outputs are only ports capable of power management |
| 4435 | * any attempts on powering down a input port cause the |
| 4436 | * referenced VREF to act quirky. |
| 4437 | */ |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4438 | if (pinctl & AC_PINCTL_IN_EN) { |
| 4439 | stac_toggle_power_map(codec, nid, 1); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4440 | continue; |
Takashi Iwai | eb63212 | 2008-12-19 16:39:48 +0100 | [diff] [blame] | 4441 | } |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4442 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4443 | def_conf = get_defcfg_connect(def_conf); |
| 4444 | /* skip any ports that don't have jacks since presence |
| 4445 | * detection is useless */ |
| 4446 | if (def_conf != AC_JACK_PORT_COMPLEX) { |
| 4447 | if (def_conf != AC_JACK_PORT_NONE) |
| 4448 | stac_toggle_power_map(codec, nid, 1); |
| 4449 | continue; |
| 4450 | } |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4451 | if (enable_pin_detect(codec, nid, STAC_PWR_EVENT)) |
| 4452 | stac_issue_unsol_event(codec, nid); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4453 | } |
| 4454 | if (spec->dac_list) |
| 4455 | stac92xx_power_down(codec); |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4456 | return 0; |
| 4457 | } |
| 4458 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4459 | static void stac92xx_free_jacks(struct hda_codec *codec) |
| 4460 | { |
Takashi Iwai | 8c8145b | 2009-06-22 17:00:38 +0200 | [diff] [blame] | 4461 | #ifdef CONFIG_SND_HDA_INPUT_JACK |
Takashi Iwai | b94d353 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4462 | /* free jack instances manually when clearing/reconfiguring */ |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4463 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | b94d353 | 2008-11-21 09:08:06 +0100 | [diff] [blame] | 4464 | if (!codec->bus->shutdown && spec->jacks.list) { |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4465 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4466 | int i; |
Takashi Iwai | 95c0909 | 2009-04-14 16:15:29 +0200 | [diff] [blame] | 4467 | for (i = 0; i < spec->jacks.used; i++, jacks++) { |
| 4468 | if (jacks->jack) |
| 4469 | snd_device_free(codec->bus->card, jacks->jack); |
| 4470 | } |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4471 | } |
| 4472 | snd_array_free(&spec->jacks); |
Takashi Iwai | e4973e1 | 2008-11-18 09:32:42 +0100 | [diff] [blame] | 4473 | #endif |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4474 | } |
| 4475 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 4476 | static void stac92xx_free_kctls(struct hda_codec *codec) |
| 4477 | { |
| 4478 | struct sigmatel_spec *spec = codec->spec; |
| 4479 | |
| 4480 | if (spec->kctls.list) { |
| 4481 | struct snd_kcontrol_new *kctl = spec->kctls.list; |
| 4482 | int i; |
| 4483 | for (i = 0; i < spec->kctls.used; i++) |
| 4484 | kfree(kctl[i].name); |
| 4485 | } |
| 4486 | snd_array_free(&spec->kctls); |
| 4487 | } |
| 4488 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4489 | static void stac92xx_free(struct hda_codec *codec) |
| 4490 | { |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4491 | struct sigmatel_spec *spec = codec->spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4492 | |
| 4493 | if (! spec) |
| 4494 | return; |
| 4495 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4496 | stac92xx_free_jacks(codec); |
| 4497 | snd_array_free(&spec->events); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4498 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4499 | kfree(spec); |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 4500 | snd_hda_detach_beep_device(codec); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4501 | } |
| 4502 | |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4503 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4504 | unsigned int flag) |
| 4505 | { |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4506 | unsigned int old_ctl, pin_ctl; |
| 4507 | |
| 4508 | pin_ctl = snd_hda_codec_read(codec, nid, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4509 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4510 | |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4511 | if (pin_ctl & AC_PINCTL_IN_EN) { |
| 4512 | /* |
| 4513 | * we need to check the current set-up direction of |
| 4514 | * shared input pins since they can be switched via |
| 4515 | * "xxx as Output" mixer switch |
| 4516 | */ |
| 4517 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4518 | if (nid == spec->line_switch || nid == spec->mic_switch) |
Takashi Iwai | f9acba4 | 2007-05-29 18:01:06 +0200 | [diff] [blame] | 4519 | return; |
| 4520 | } |
| 4521 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4522 | old_ctl = pin_ctl; |
Steve Longerbeam | 7b04389 | 2007-05-03 20:50:03 +0200 | [diff] [blame] | 4523 | /* if setting pin direction bits, clear the current |
| 4524 | direction bits first */ |
| 4525 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
| 4526 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
| 4527 | |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4528 | pin_ctl |= flag; |
| 4529 | if (old_ctl != pin_ctl) |
| 4530 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4531 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4532 | pin_ctl); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4533 | } |
| 4534 | |
| 4535 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
| 4536 | unsigned int flag) |
| 4537 | { |
| 4538 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
| 4539 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
Takashi Iwai | 8ce8419 | 2009-01-22 16:59:20 +0100 | [diff] [blame] | 4540 | if (pin_ctl & flag) |
| 4541 | snd_hda_codec_write_cache(codec, nid, 0, |
| 4542 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4543 | pin_ctl & ~flag); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4544 | } |
| 4545 | |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4546 | 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] | 4547 | { |
| 4548 | if (!nid) |
| 4549 | return 0; |
| 4550 | 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] | 4551 | & (1 << 31)) |
| 4552 | return 1; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4553 | return 0; |
| 4554 | } |
| 4555 | |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4556 | /* return non-zero if the hp-pin of the given array index isn't |
| 4557 | * a jack-detection target |
| 4558 | */ |
| 4559 | static int no_hp_sensing(struct sigmatel_spec *spec, int i) |
| 4560 | { |
| 4561 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4562 | |
| 4563 | /* ignore sensing of shared line and mic jacks */ |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4564 | if (cfg->hp_pins[i] == spec->line_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4565 | return 1; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 4566 | if (cfg->hp_pins[i] == spec->mic_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4567 | return 1; |
| 4568 | /* ignore if the pin is set as line-out */ |
| 4569 | if (cfg->hp_pins[i] == spec->hp_switch) |
| 4570 | return 1; |
| 4571 | return 0; |
| 4572 | } |
| 4573 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4574 | static void stac92xx_hp_detect(struct hda_codec *codec) |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4575 | { |
| 4576 | struct sigmatel_spec *spec = codec->spec; |
| 4577 | struct auto_pin_cfg *cfg = &spec->autocfg; |
| 4578 | int i, presence; |
| 4579 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4580 | presence = 0; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 4581 | if (spec->gpio_mute) |
| 4582 | presence = !(snd_hda_codec_read(codec, codec->afg, 0, |
| 4583 | AC_VERB_GET_GPIO_DATA, 0) & spec->gpio_mute); |
| 4584 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4585 | for (i = 0; i < cfg->hp_outs; i++) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4586 | if (presence) |
| 4587 | break; |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4588 | if (no_hp_sensing(spec, i)) |
| 4589 | continue; |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4590 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
| 4591 | if (presence) { |
| 4592 | unsigned int pinctl; |
| 4593 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, |
| 4594 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 4595 | if (pinctl & AC_PINCTL_IN_EN) |
| 4596 | presence = 0; /* mic- or line-input */ |
| 4597 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4598 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4599 | |
| 4600 | if (presence) { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4601 | /* disable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4602 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4603 | stac92xx_reset_pinctl(codec, spec->hp_switch, |
| 4604 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4605 | for (i = 0; i < cfg->line_outs; i++) |
| 4606 | stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], |
| 4607 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4608 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4609 | stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], |
| 4610 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4611 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4612 | stac_gpio_set(codec, spec->gpio_mask, |
| 4613 | spec->gpio_dir, spec->gpio_data & |
| 4614 | ~spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4615 | } else { |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4616 | /* enable lineouts */ |
Matthew Ranostay | 7c2ba97 | 2008-04-16 13:13:59 +0200 | [diff] [blame] | 4617 | if (spec->hp_switch) |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4618 | stac92xx_set_pinctl(codec, spec->hp_switch, |
| 4619 | AC_PINCTL_OUT_EN); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4620 | for (i = 0; i < cfg->line_outs; i++) |
| 4621 | stac92xx_set_pinctl(codec, cfg->line_out_pins[i], |
| 4622 | AC_PINCTL_OUT_EN); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4623 | for (i = 0; i < cfg->speaker_outs; i++) |
| 4624 | stac92xx_set_pinctl(codec, cfg->speaker_pins[i], |
| 4625 | AC_PINCTL_OUT_EN); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 4626 | if (spec->eapd_mask && spec->eapd_switch) |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 4627 | stac_gpio_set(codec, spec->gpio_mask, |
| 4628 | spec->gpio_dir, spec->gpio_data | |
| 4629 | spec->eapd_mask); |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4630 | } |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4631 | /* toggle hp outs */ |
| 4632 | for (i = 0; i < cfg->hp_outs; i++) { |
| 4633 | unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; |
| 4634 | if (no_hp_sensing(spec, i)) |
| 4635 | continue; |
| 4636 | if (presence) |
| 4637 | stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4638 | #if 0 /* FIXME */ |
| 4639 | /* Resetting the pinctl like below may lead to (a sort of) regressions |
| 4640 | * on some devices since they use the HP pin actually for line/speaker |
| 4641 | * outs although the default pin config shows a different pin (that is |
| 4642 | * wrong and useless). |
| 4643 | * |
| 4644 | * So, it's basically a problem of default pin configs, likely a BIOS issue. |
| 4645 | * But, disabling the code below just works around it, and I'm too tired of |
| 4646 | * bug reports with such devices... |
| 4647 | */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4648 | else |
| 4649 | stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); |
Takashi Iwai | 8317e0b | 2009-01-14 07:56:51 +0100 | [diff] [blame] | 4650 | #endif /* FIXME */ |
Takashi Iwai | d7a8943 | 2008-11-12 09:48:04 +0100 | [diff] [blame] | 4651 | } |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4652 | } |
| 4653 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4654 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
| 4655 | int enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4656 | { |
| 4657 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4658 | unsigned int idx, val; |
| 4659 | |
| 4660 | for (idx = 0; idx < spec->num_pwrs; idx++) { |
| 4661 | if (spec->pwr_nids[idx] == nid) |
| 4662 | break; |
| 4663 | } |
| 4664 | if (idx >= spec->num_pwrs) |
| 4665 | return; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 4666 | |
| 4667 | /* several codecs have two power down bits */ |
| 4668 | if (spec->pwr_mapping) |
| 4669 | idx = spec->pwr_mapping[idx]; |
| 4670 | else |
| 4671 | idx = 1 << idx; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4672 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4673 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; |
| 4674 | if (enable) |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4675 | val &= ~idx; |
| 4676 | else |
| 4677 | val |= idx; |
| 4678 | |
| 4679 | /* power down unused output ports */ |
| 4680 | snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4681 | } |
| 4682 | |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4683 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
| 4684 | { |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4685 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
Takashi Iwai | f73d358 | 2008-11-25 08:21:51 +0100 | [diff] [blame] | 4686 | } |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4687 | |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4688 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) |
| 4689 | { |
| 4690 | struct sigmatel_spec *spec = codec->spec; |
| 4691 | struct sigmatel_jack *jacks = spec->jacks.list; |
| 4692 | |
| 4693 | if (jacks) { |
| 4694 | int i; |
| 4695 | for (i = 0; i < spec->jacks.used; i++) { |
| 4696 | if (jacks->nid == nid) { |
| 4697 | unsigned int pin_ctl = |
| 4698 | snd_hda_codec_read(codec, nid, |
| 4699 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 4700 | 0x00); |
| 4701 | int type = jacks->type; |
| 4702 | if (type == (SND_JACK_LINEOUT |
| 4703 | | SND_JACK_HEADPHONE)) |
| 4704 | type = (pin_ctl & AC_PINCTL_HP_EN) |
| 4705 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; |
| 4706 | snd_jack_report(jacks->jack, |
Takashi Iwai | e6e3ea2 | 2008-12-05 12:54:56 +0100 | [diff] [blame] | 4707 | get_pin_presence(codec, nid) |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4708 | ? type : 0); |
| 4709 | } |
| 4710 | jacks++; |
| 4711 | } |
| 4712 | } |
| 4713 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4714 | |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 4715 | static void stac92xx_mic_detect(struct hda_codec *codec) |
| 4716 | { |
| 4717 | struct sigmatel_spec *spec = codec->spec; |
| 4718 | struct sigmatel_mic_route *mic; |
| 4719 | |
| 4720 | if (get_pin_presence(codec, spec->ext_mic.pin)) |
| 4721 | mic = &spec->ext_mic; |
| 4722 | else |
| 4723 | mic = &spec->int_mic; |
| 4724 | if (mic->dmux_idx) |
| 4725 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, |
| 4726 | AC_VERB_SET_CONNECT_SEL, |
| 4727 | mic->dmux_idx); |
| 4728 | else |
| 4729 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, |
| 4730 | AC_VERB_SET_CONNECT_SEL, |
| 4731 | mic->mux_idx); |
| 4732 | } |
| 4733 | |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4734 | static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4735 | { |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4736 | struct sigmatel_event *event = stac_get_event(codec, nid); |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4737 | if (!event) |
| 4738 | return; |
| 4739 | codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); |
| 4740 | } |
| 4741 | |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4742 | static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4743 | { |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4744 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4745 | struct sigmatel_event *event; |
| 4746 | int tag, data; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4747 | |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4748 | tag = (res >> 26) & 0x7f; |
| 4749 | event = stac_get_event_from_tag(codec, tag); |
| 4750 | if (!event) |
| 4751 | return; |
| 4752 | |
| 4753 | switch (event->type) { |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4754 | case STAC_HP_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4755 | stac92xx_hp_detect(codec); |
Takashi Iwai | 3d21d3f | 2009-07-29 14:32:56 +0200 | [diff] [blame^] | 4756 | break; |
| 4757 | case STAC_MIC_EVENT: |
| 4758 | stac92xx_mic_detect(codec); |
| 4759 | break; |
| 4760 | } |
| 4761 | |
| 4762 | switch (event->type) { |
| 4763 | case STAC_HP_EVENT: |
| 4764 | case STAC_MIC_EVENT: |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 4765 | case STAC_INSERT_EVENT: |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4766 | case STAC_PWR_EVENT: |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4767 | if (spec->num_pwrs > 0) |
| 4768 | stac92xx_pin_sense(codec, event->nid); |
| 4769 | stac92xx_report_jack(codec, event->nid); |
Matthew Ranostay | fd60cc8 | 2009-04-06 09:30:46 -0400 | [diff] [blame] | 4770 | |
| 4771 | switch (codec->subsystem_id) { |
| 4772 | case 0x103c308f: |
| 4773 | if (event->nid == 0xb) { |
| 4774 | int pin = AC_PINCTL_IN_EN; |
| 4775 | |
| 4776 | if (get_pin_presence(codec, 0xa) |
| 4777 | && get_pin_presence(codec, 0xb)) |
| 4778 | pin |= AC_PINCTL_VREF_80; |
| 4779 | if (!get_pin_presence(codec, 0xb)) |
| 4780 | pin |= AC_PINCTL_VREF_80; |
| 4781 | |
| 4782 | /* toggle VREF state based on mic + hp pin |
| 4783 | * status |
| 4784 | */ |
| 4785 | stac92xx_auto_set_pinctl(codec, 0x0a, pin); |
| 4786 | } |
| 4787 | } |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4788 | break; |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4789 | case STAC_VREF_EVENT: |
| 4790 | data = snd_hda_codec_read(codec, codec->afg, 0, |
| 4791 | AC_VERB_GET_GPIO_DATA, 0); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4792 | /* toggle VREF state based on GPIOx status */ |
| 4793 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 4794 | !!(data & (1 << event->data))); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 4795 | break; |
Takashi Iwai | 314634b | 2006-09-21 11:56:18 +0200 | [diff] [blame] | 4796 | } |
| 4797 | } |
| 4798 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 4799 | #ifdef CONFIG_PROC_FS |
| 4800 | static void stac92hd_proc_hook(struct snd_info_buffer *buffer, |
| 4801 | struct hda_codec *codec, hda_nid_t nid) |
| 4802 | { |
| 4803 | if (nid == codec->afg) |
| 4804 | snd_iprintf(buffer, "Power-Map: 0x%02x\n", |
| 4805 | snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); |
| 4806 | } |
| 4807 | |
| 4808 | static void analog_loop_proc_hook(struct snd_info_buffer *buffer, |
| 4809 | struct hda_codec *codec, |
| 4810 | unsigned int verb) |
| 4811 | { |
| 4812 | snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", |
| 4813 | snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); |
| 4814 | } |
| 4815 | |
| 4816 | /* stac92hd71bxx, stac92hd73xx */ |
| 4817 | static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, |
| 4818 | struct hda_codec *codec, hda_nid_t nid) |
| 4819 | { |
| 4820 | stac92hd_proc_hook(buffer, codec, nid); |
| 4821 | if (nid == codec->afg) |
| 4822 | analog_loop_proc_hook(buffer, codec, 0xfa0); |
| 4823 | } |
| 4824 | |
| 4825 | static void stac9205_proc_hook(struct snd_info_buffer *buffer, |
| 4826 | struct hda_codec *codec, hda_nid_t nid) |
| 4827 | { |
| 4828 | if (nid == codec->afg) |
| 4829 | analog_loop_proc_hook(buffer, codec, 0xfe0); |
| 4830 | } |
| 4831 | |
| 4832 | static void stac927x_proc_hook(struct snd_info_buffer *buffer, |
| 4833 | struct hda_codec *codec, hda_nid_t nid) |
| 4834 | { |
| 4835 | if (nid == codec->afg) |
| 4836 | analog_loop_proc_hook(buffer, codec, 0xfeb); |
| 4837 | } |
| 4838 | #else |
| 4839 | #define stac92hd_proc_hook NULL |
| 4840 | #define stac92hd7x_proc_hook NULL |
| 4841 | #define stac9205_proc_hook NULL |
| 4842 | #define stac927x_proc_hook NULL |
| 4843 | #endif |
| 4844 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4845 | #ifdef SND_HDA_NEEDS_RESUME |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4846 | static int stac92xx_resume(struct hda_codec *codec) |
| 4847 | { |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4848 | struct sigmatel_spec *spec = codec->spec; |
| 4849 | |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4850 | stac92xx_init(codec); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4851 | snd_hda_codec_resume_amp(codec); |
| 4852 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 2c88587 | 2008-11-18 09:36:55 +0100 | [diff] [blame] | 4853 | /* fake event to set up pins again to override cached values */ |
Takashi Iwai | dc81bed | 2007-09-03 09:36:36 +0200 | [diff] [blame] | 4854 | if (spec->hp_detect) |
Takashi Iwai | 62558ce | 2009-07-29 14:23:09 +0200 | [diff] [blame] | 4855 | stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]); |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4856 | return 0; |
| 4857 | } |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4858 | |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4859 | /* |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 4860 | * using power check for controlling mute led of HP notebooks |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4861 | * check for mute state only on Speakers (nid = 0x10) |
| 4862 | * |
| 4863 | * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise |
| 4864 | * the LED is NOT working properly ! |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 4865 | * |
| 4866 | * Changed name to reflect that it now works for any designated |
| 4867 | * model, not just HP HDX. |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4868 | */ |
| 4869 | |
| 4870 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 4871 | static int stac92xx_hp_check_power_status(struct hda_codec *codec, |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4872 | hda_nid_t nid) |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4873 | { |
| 4874 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4875 | |
| 4876 | if (nid == 0x10) { |
| 4877 | if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4878 | HDA_AMP_MUTE) |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 4879 | spec->gpio_data &= ~spec->gpio_led; /* orange */ |
Takashi Iwai | ba84bfc | 2009-05-30 08:59:03 +0200 | [diff] [blame] | 4880 | else |
| 4881 | spec->gpio_data |= spec->gpio_led; /* white */ |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 4882 | |
| 4883 | stac_gpio_set(codec, spec->gpio_mask, |
| 4884 | spec->gpio_dir, |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 4885 | spec->gpio_data); |
| 4886 | } |
| 4887 | |
| 4888 | return 0; |
| 4889 | } |
| 4890 | #endif |
| 4891 | |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4892 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
| 4893 | { |
| 4894 | struct sigmatel_spec *spec = codec->spec; |
Takashi Iwai | 05ff7e1 | 2009-07-22 12:39:24 +0200 | [diff] [blame] | 4895 | int i; |
| 4896 | hda_nid_t nid; |
| 4897 | |
| 4898 | /* reset each pin before powering down DAC/ADC to avoid click noise */ |
| 4899 | nid = codec->start_nid; |
| 4900 | for (i = 0; i < codec->num_nodes; i++, nid++) { |
| 4901 | unsigned int wcaps = get_wcaps(codec, nid); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 4902 | unsigned int wid_type = get_wcaps_type(wcaps); |
Takashi Iwai | 05ff7e1 | 2009-07-22 12:39:24 +0200 | [diff] [blame] | 4903 | if (wid_type == AC_WID_PIN) |
| 4904 | snd_hda_codec_read(codec, nid, 0, |
| 4905 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); |
| 4906 | } |
| 4907 | |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4908 | if (spec->eapd_mask) |
| 4909 | stac_gpio_set(codec, spec->gpio_mask, |
| 4910 | spec->gpio_dir, spec->gpio_data & |
| 4911 | ~spec->eapd_mask); |
| 4912 | return 0; |
| 4913 | } |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4914 | #endif |
| 4915 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4916 | static struct hda_codec_ops stac92xx_patch_ops = { |
| 4917 | .build_controls = stac92xx_build_controls, |
| 4918 | .build_pcms = stac92xx_build_pcms, |
| 4919 | .init = stac92xx_init, |
| 4920 | .free = stac92xx_free, |
Matt | 4e55096 | 2005-07-04 17:51:39 +0200 | [diff] [blame] | 4921 | .unsol_event = stac92xx_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4922 | #ifdef SND_HDA_NEEDS_RESUME |
Matthew Ranostay | c6798d2 | 2008-11-18 20:54:17 -0500 | [diff] [blame] | 4923 | .suspend = stac92xx_suspend, |
Matt | ff6fdc3 | 2005-06-27 15:06:52 +0200 | [diff] [blame] | 4924 | .resume = stac92xx_resume, |
| 4925 | #endif |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4926 | }; |
| 4927 | |
| 4928 | static int patch_stac9200(struct hda_codec *codec) |
| 4929 | { |
| 4930 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4931 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4932 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 4933 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4934 | if (spec == NULL) |
| 4935 | return -ENOMEM; |
| 4936 | |
| 4937 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 4938 | spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 4939 | spec->pin_nids = stac9200_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4940 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
| 4941 | stac9200_models, |
| 4942 | stac9200_cfg_tbl); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4943 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 4944 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 4945 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 4946 | else |
| 4947 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 4948 | stac9200_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4949 | |
| 4950 | spec->multiout.max_channels = 2; |
| 4951 | spec->multiout.num_dacs = 1; |
| 4952 | spec->multiout.dac_nids = stac9200_dac_nids; |
| 4953 | spec->adc_nids = stac9200_adc_nids; |
| 4954 | spec->mux_nids = stac9200_mux_nids; |
Matt | dabbed6 | 2005-06-14 10:19:34 +0200 | [diff] [blame] | 4955 | spec->num_muxes = 1; |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 4956 | spec->num_dmics = 0; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 4957 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 4958 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4959 | |
Mauro Carvalho Chehab | 58eec42 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 4960 | if (spec->board_config == STAC_9200_M4 || |
| 4961 | spec->board_config == STAC_9200_M4_2 || |
Tobin Davis | bf27778 | 2008-02-03 20:31:47 +0100 | [diff] [blame] | 4962 | spec->board_config == STAC_9200_OQO) |
Takashi Iwai | 1194b5b | 2007-10-10 10:04:26 +0200 | [diff] [blame] | 4963 | spec->init = stac9200_eapd_init; |
| 4964 | else |
| 4965 | spec->init = stac9200_core_init; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4966 | spec->mixer = stac9200_mixer; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4967 | |
Takashi Iwai | 117f257 | 2008-03-18 09:53:23 +0100 | [diff] [blame] | 4968 | if (spec->board_config == STAC_9200_PANASONIC) { |
| 4969 | spec->gpio_mask = spec->gpio_dir = 0x09; |
| 4970 | spec->gpio_data = 0x00; |
| 4971 | } |
| 4972 | |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 4973 | err = stac9200_parse_auto_config(codec); |
| 4974 | if (err < 0) { |
| 4975 | stac92xx_free(codec); |
| 4976 | return err; |
| 4977 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4978 | |
Takashi Iwai | 2acc9dc | 2009-01-09 16:57:14 +0100 | [diff] [blame] | 4979 | /* CF-74 has no headphone detection, and the driver should *NOT* |
| 4980 | * do detection and HP/speaker toggle because the hardware does it. |
| 4981 | */ |
| 4982 | if (spec->board_config == STAC_9200_PANASONIC) |
| 4983 | spec->hp_detect = 0; |
| 4984 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 4985 | codec->patch_ops = stac92xx_patch_ops; |
| 4986 | |
| 4987 | return 0; |
| 4988 | } |
| 4989 | |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 4990 | static int patch_stac925x(struct hda_codec *codec) |
| 4991 | { |
| 4992 | struct sigmatel_spec *spec; |
| 4993 | int err; |
| 4994 | |
| 4995 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 4996 | if (spec == NULL) |
| 4997 | return -ENOMEM; |
| 4998 | |
| 4999 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5000 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5001 | spec->pin_nids = stac925x_pin_nids; |
Mauro Carvalho Chehab | 9cb36c2 | 2008-08-11 10:18:39 +0200 | [diff] [blame] | 5002 | |
| 5003 | /* Check first for codec ID */ |
| 5004 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, |
| 5005 | STAC_925x_MODELS, |
| 5006 | stac925x_models, |
| 5007 | stac925x_codec_id_cfg_tbl); |
| 5008 | |
| 5009 | /* Now checks for PCI ID, if codec ID is not found */ |
| 5010 | if (spec->board_config < 0) |
| 5011 | spec->board_config = snd_hda_check_board_config(codec, |
| 5012 | STAC_925x_MODELS, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5013 | stac925x_models, |
| 5014 | stac925x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5015 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5016 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5017 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5018 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5019 | else |
| 5020 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5021 | stac925x_brd_tbl[spec->board_config]); |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5022 | |
| 5023 | spec->multiout.max_channels = 2; |
| 5024 | spec->multiout.num_dacs = 1; |
| 5025 | spec->multiout.dac_nids = stac925x_dac_nids; |
| 5026 | spec->adc_nids = stac925x_adc_nids; |
| 5027 | spec->mux_nids = stac925x_mux_nids; |
| 5028 | spec->num_muxes = 1; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5029 | spec->num_adcs = 1; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5030 | spec->num_pwrs = 0; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5031 | switch (codec->vendor_id) { |
| 5032 | case 0x83847632: /* STAC9202 */ |
| 5033 | case 0x83847633: /* STAC9202D */ |
| 5034 | case 0x83847636: /* STAC9251 */ |
| 5035 | case 0x83847637: /* STAC9251D */ |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5036 | spec->num_dmics = STAC925X_NUM_DMICS; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5037 | spec->dmic_nids = stac925x_dmic_nids; |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5038 | spec->num_dmuxes = ARRAY_SIZE(stac925x_dmux_nids); |
| 5039 | spec->dmux_nids = stac925x_dmux_nids; |
Tobin Davis | 2c11f95 | 2007-05-17 09:36:34 +0200 | [diff] [blame] | 5040 | break; |
| 5041 | default: |
| 5042 | spec->num_dmics = 0; |
| 5043 | break; |
| 5044 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5045 | |
| 5046 | spec->init = stac925x_core_init; |
| 5047 | spec->mixer = stac925x_mixer; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5048 | spec->num_caps = 1; |
| 5049 | spec->capvols = stac925x_capvols; |
| 5050 | spec->capsws = stac925x_capsws; |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5051 | |
| 5052 | err = stac92xx_parse_auto_config(codec, 0x8, 0x7); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5053 | if (!err) { |
| 5054 | if (spec->board_config < 0) { |
| 5055 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5056 | "available, default to model=ref\n"); |
| 5057 | spec->board_config = STAC_925x_REF; |
| 5058 | goto again; |
| 5059 | } |
| 5060 | err = -EINVAL; |
| 5061 | } |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 5062 | if (err < 0) { |
| 5063 | stac92xx_free(codec); |
| 5064 | return err; |
| 5065 | } |
| 5066 | |
| 5067 | codec->patch_ops = stac92xx_patch_ops; |
| 5068 | |
| 5069 | return 0; |
| 5070 | } |
| 5071 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5072 | static struct hda_input_mux stac92hd73xx_dmux = { |
| 5073 | .num_items = 4, |
| 5074 | .items = { |
| 5075 | { "Analog Inputs", 0x0b }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5076 | { "Digital Mic 1", 0x09 }, |
| 5077 | { "Digital Mic 2", 0x0a }, |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5078 | { "CD", 0x08 }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5079 | } |
| 5080 | }; |
| 5081 | |
| 5082 | static int patch_stac92hd73xx(struct hda_codec *codec) |
| 5083 | { |
| 5084 | struct sigmatel_spec *spec; |
| 5085 | hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; |
| 5086 | int err = 0; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5087 | int num_dacs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5088 | |
| 5089 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5090 | if (spec == NULL) |
| 5091 | return -ENOMEM; |
| 5092 | |
| 5093 | codec->spec = spec; |
Matthew Ranostay | e99d32b | 2008-09-09 10:46:38 +0200 | [diff] [blame] | 5094 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5095 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
| 5096 | spec->pin_nids = stac92hd73xx_pin_nids; |
| 5097 | spec->board_config = snd_hda_check_board_config(codec, |
| 5098 | STAC_92HD73XX_MODELS, |
| 5099 | stac92hd73xx_models, |
| 5100 | stac92hd73xx_cfg_tbl); |
| 5101 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5102 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5103 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5104 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5105 | else |
| 5106 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5107 | stac92hd73xx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5108 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5109 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5110 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
| 5111 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5112 | if (num_dacs < 3 || num_dacs > 5) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5113 | printk(KERN_WARNING "hda_codec: Could not determine " |
| 5114 | "number of channels defaulting to DAC count\n"); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5115 | num_dacs = STAC92HD73_DAC_COUNT; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5116 | } |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5117 | switch (num_dacs) { |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5118 | case 0x3: /* 6 Channel */ |
| 5119 | spec->mixer = stac92hd73xx_6ch_mixer; |
| 5120 | spec->init = stac92hd73xx_6ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5121 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5122 | break; |
| 5123 | case 0x4: /* 8 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5124 | spec->mixer = stac92hd73xx_8ch_mixer; |
| 5125 | spec->init = stac92hd73xx_8ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5126 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5127 | break; |
| 5128 | case 0x5: /* 10 Channel */ |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5129 | spec->mixer = stac92hd73xx_10ch_mixer; |
| 5130 | spec->init = stac92hd73xx_10ch_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5131 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; |
| 5132 | break; |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5133 | } |
| 5134 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5135 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5136 | spec->aloopback_mask = 0x01; |
| 5137 | spec->aloopback_shift = 8; |
| 5138 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5139 | spec->digbeep_nid = 0x1c; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5140 | spec->mux_nids = stac92hd73xx_mux_nids; |
| 5141 | spec->adc_nids = stac92hd73xx_adc_nids; |
| 5142 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
| 5143 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5144 | spec->smux_nids = stac92hd73xx_smux_nids; |
Matthew Ranostay | 8938503 | 2008-09-11 09:49:39 -0400 | [diff] [blame] | 5145 | spec->amp_nids = stac92hd73xx_amp_nids; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5146 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5147 | |
| 5148 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
| 5149 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5150 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5151 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
| 5152 | sizeof(stac92hd73xx_dmux)); |
| 5153 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5154 | spec->num_caps = STAC92HD73XX_NUM_CAPS; |
| 5155 | spec->capvols = stac92hd73xx_capvols; |
| 5156 | spec->capsws = stac92hd73xx_capsws; |
| 5157 | |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5158 | switch (spec->board_config) { |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5159 | case STAC_DELL_EQ: |
Matthew Ranostay | d654a66 | 2008-03-14 08:46:51 +0100 | [diff] [blame] | 5160 | spec->init = dell_eq_core_init; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5161 | /* fallthru */ |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5162 | case STAC_DELL_M6_AMIC: |
| 5163 | case STAC_DELL_M6_DMIC: |
| 5164 | case STAC_DELL_M6_BOTH: |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5165 | spec->num_smuxes = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5166 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; |
| 5167 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5168 | spec->eapd_switch = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5169 | spec->num_amps = 1; |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5170 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5171 | if (spec->board_config != STAC_DELL_EQ) |
Matthew Ranostay | 6b3ab21 | 2008-11-03 08:12:43 -0500 | [diff] [blame] | 5172 | spec->init = dell_m6_core_init; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5173 | switch (spec->board_config) { |
| 5174 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5175 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5176 | spec->num_dmics = 0; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5177 | spec->private_dimux.num_items = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5178 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5179 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5180 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5181 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5182 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5183 | break; |
Takashi Iwai | 661cd8f | 2008-11-25 15:18:29 +0100 | [diff] [blame] | 5184 | case STAC_DELL_M6_BOTH: /* Both */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5185 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
| 5186 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5187 | spec->num_dmics = 1; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5188 | spec->private_dimux.num_items = 2; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5189 | break; |
| 5190 | } |
| 5191 | break; |
| 5192 | default: |
| 5193 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5194 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5195 | spec->eapd_switch = 1; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5196 | } |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5197 | if (spec->board_config > STAC_92HD73XX_REF) { |
| 5198 | /* GPIO0 High = Enable EAPD */ |
| 5199 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
| 5200 | spec->gpio_data = 0x01; |
| 5201 | } |
Matthew Ranostay | 2a9c781 | 2008-09-13 16:45:39 -0400 | [diff] [blame] | 5202 | spec->dinput_mux = &spec->private_dimux; |
Matthew Ranostay | a766264 | 2008-02-21 07:51:14 +0100 | [diff] [blame] | 5203 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5204 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
| 5205 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
| 5206 | |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5207 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5208 | |
| 5209 | if (!err) { |
| 5210 | if (spec->board_config < 0) { |
| 5211 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5212 | "available, default to model=ref\n"); |
| 5213 | spec->board_config = STAC_92HD73XX_REF; |
| 5214 | goto again; |
| 5215 | } |
| 5216 | err = -EINVAL; |
| 5217 | } |
| 5218 | |
| 5219 | if (err < 0) { |
| 5220 | stac92xx_free(codec); |
| 5221 | return err; |
| 5222 | } |
| 5223 | |
Takashi Iwai | 9e43f0d | 2008-12-17 14:51:01 +0100 | [diff] [blame] | 5224 | if (spec->board_config == STAC_92HD73XX_NO_JD) |
| 5225 | spec->hp_detect = 0; |
| 5226 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5227 | codec->patch_ops = stac92xx_patch_ops; |
| 5228 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5229 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5230 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5231 | return 0; |
| 5232 | } |
| 5233 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5234 | static struct hda_input_mux stac92hd83xxx_dmux = { |
| 5235 | .num_items = 3, |
| 5236 | .items = { |
| 5237 | { "Analog Inputs", 0x03 }, |
| 5238 | { "Digital Mic 1", 0x04 }, |
| 5239 | { "Digital Mic 2", 0x05 }, |
| 5240 | } |
| 5241 | }; |
| 5242 | |
| 5243 | static int patch_stac92hd83xxx(struct hda_codec *codec) |
| 5244 | { |
| 5245 | struct sigmatel_spec *spec; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 5246 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5247 | int err; |
Matthew Ranostay | 65557f3 | 2009-01-20 16:50:25 -0500 | [diff] [blame] | 5248 | int num_dacs; |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 5249 | hda_nid_t nid; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5250 | |
| 5251 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5252 | if (spec == NULL) |
| 5253 | return -ENOMEM; |
| 5254 | |
| 5255 | codec->spec = spec; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5256 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5257 | spec->mono_nid = 0x19; |
| 5258 | spec->digbeep_nid = 0x21; |
| 5259 | spec->dmic_nids = stac92hd83xxx_dmic_nids; |
| 5260 | spec->dmux_nids = stac92hd83xxx_dmux_nids; |
| 5261 | spec->adc_nids = stac92hd83xxx_adc_nids; |
| 5262 | spec->pwr_nids = stac92hd83xxx_pwr_nids; |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 5263 | spec->amp_nids = stac92hd83xxx_amp_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5264 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; |
| 5265 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5266 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5267 | |
| 5268 | spec->init = stac92hd83xxx_core_init; |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5269 | spec->mixer = stac92hd83xxx_mixer; |
| 5270 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
| 5271 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); |
| 5272 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); |
Matthew Ranostay | c15c506 | 2009-01-13 13:30:07 -0500 | [diff] [blame] | 5273 | spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5274 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; |
| 5275 | spec->dinput_mux = &stac92hd83xxx_dmux; |
| 5276 | spec->pin_nids = stac92hd83xxx_pin_nids; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5277 | spec->num_caps = STAC92HD83XXX_NUM_CAPS; |
| 5278 | spec->capvols = stac92hd83xxx_capvols; |
| 5279 | spec->capsws = stac92hd83xxx_capsws; |
| 5280 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5281 | spec->board_config = snd_hda_check_board_config(codec, |
| 5282 | STAC_92HD83XXX_MODELS, |
| 5283 | stac92hd83xxx_models, |
| 5284 | stac92hd83xxx_cfg_tbl); |
| 5285 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5286 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5287 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5288 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5289 | else |
| 5290 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5291 | stac92hd83xxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5292 | |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 5293 | switch (codec->vendor_id) { |
| 5294 | case 0x111d7604: |
| 5295 | case 0x111d7605: |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 5296 | case 0x111d76d5: |
Matthew Ranostay | 32ed3f4 | 2009-01-22 20:53:29 -0500 | [diff] [blame] | 5297 | if (spec->board_config == STAC_92HD83XXX_PWR_REF) |
| 5298 | break; |
| 5299 | spec->num_pwrs = 0; |
| 5300 | break; |
| 5301 | } |
| 5302 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5303 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); |
| 5304 | if (!err) { |
| 5305 | if (spec->board_config < 0) { |
| 5306 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5307 | "available, default to model=ref\n"); |
| 5308 | spec->board_config = STAC_92HD83XXX_REF; |
| 5309 | goto again; |
| 5310 | } |
| 5311 | err = -EINVAL; |
| 5312 | } |
| 5313 | |
| 5314 | if (err < 0) { |
| 5315 | stac92xx_free(codec); |
| 5316 | return err; |
| 5317 | } |
| 5318 | |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 5319 | switch (spec->board_config) { |
| 5320 | case STAC_DELL_S14: |
| 5321 | nid = 0xf; |
| 5322 | break; |
| 5323 | default: |
| 5324 | nid = 0xe; |
| 5325 | break; |
| 5326 | } |
| 5327 | |
| 5328 | num_dacs = snd_hda_get_connections(codec, nid, |
| 5329 | conn, STAC92HD83_DAC_COUNT + 1) - 1; |
Jaroslav Kysela | 16a433d | 2009-07-22 16:20:40 +0200 | [diff] [blame] | 5330 | if (num_dacs < 0) |
| 5331 | num_dacs = STAC92HD83_DAC_COUNT; |
Matthew Ranostay | 8bb0ac5 | 2009-02-12 16:50:01 -0500 | [diff] [blame] | 5332 | |
| 5333 | /* set port X to select the last DAC |
| 5334 | */ |
| 5335 | snd_hda_codec_write_cache(codec, nid, 0, |
| 5336 | AC_VERB_SET_CONNECT_SEL, num_dacs); |
| 5337 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5338 | codec->patch_ops = stac92xx_patch_ops; |
| 5339 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5340 | codec->proc_widget_hook = stac92hd_proc_hook; |
| 5341 | |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 5342 | return 0; |
| 5343 | } |
| 5344 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5345 | static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { |
| 5346 | .num_items = 3, |
| 5347 | .items = { |
| 5348 | { "Analog Inputs", 0x00 }, |
| 5349 | { "Digital Mic 1", 0x02 }, |
| 5350 | { "Digital Mic 2", 0x03 }, |
| 5351 | } |
| 5352 | }; |
| 5353 | |
| 5354 | static struct hda_input_mux stac92hd71bxx_dmux_amixer = { |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5355 | .num_items = 4, |
| 5356 | .items = { |
| 5357 | { "Analog Inputs", 0x00 }, |
| 5358 | { "Mixer", 0x01 }, |
| 5359 | { "Digital Mic 1", 0x02 }, |
| 5360 | { "Digital Mic 2", 0x03 }, |
| 5361 | } |
| 5362 | }; |
| 5363 | |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5364 | /* get the pin connection (fixed, none, etc) */ |
| 5365 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) |
| 5366 | { |
| 5367 | struct sigmatel_spec *spec = codec->spec; |
| 5368 | unsigned int cfg; |
| 5369 | |
| 5370 | cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); |
| 5371 | return get_defcfg_connect(cfg); |
| 5372 | } |
| 5373 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5374 | static int stac92hd71bxx_connected_ports(struct hda_codec *codec, |
| 5375 | hda_nid_t *nids, int num_nids) |
| 5376 | { |
| 5377 | struct sigmatel_spec *spec = codec->spec; |
| 5378 | int idx, num; |
| 5379 | unsigned int def_conf; |
| 5380 | |
| 5381 | for (num = 0; num < num_nids; num++) { |
| 5382 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5383 | if (spec->pin_nids[idx] == nids[num]) |
| 5384 | break; |
| 5385 | if (idx >= spec->num_pins) |
| 5386 | break; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5387 | def_conf = stac_get_defcfg_connect(codec, idx); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5388 | if (def_conf == AC_JACK_PORT_NONE) |
| 5389 | break; |
| 5390 | } |
| 5391 | return num; |
| 5392 | } |
| 5393 | |
| 5394 | static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, |
| 5395 | hda_nid_t dig0pin) |
| 5396 | { |
| 5397 | struct sigmatel_spec *spec = codec->spec; |
| 5398 | int idx; |
| 5399 | |
| 5400 | for (idx = 0; idx < spec->num_pins; idx++) |
| 5401 | if (spec->pin_nids[idx] == dig0pin) |
| 5402 | break; |
| 5403 | if ((idx + 2) >= spec->num_pins) |
| 5404 | return 0; |
| 5405 | |
| 5406 | /* dig1pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5407 | if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5408 | return 2; |
| 5409 | |
| 5410 | /* dig0pin + dig2pin case */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5411 | if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5412 | return 2; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5413 | if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5414 | return 1; |
| 5415 | else |
| 5416 | return 0; |
| 5417 | } |
| 5418 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5419 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
| 5420 | { |
| 5421 | struct sigmatel_spec *spec; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5422 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5423 | int err = 0; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5424 | unsigned int ndmic_nids = 0; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5425 | |
| 5426 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5427 | if (spec == NULL) |
| 5428 | return -ENOMEM; |
| 5429 | |
| 5430 | codec->spec = spec; |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5431 | codec->patch_ops = stac92xx_patch_ops; |
Herton Ronaldo Krzesinski | 616f89e | 2009-02-04 11:23:19 -0500 | [diff] [blame] | 5432 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
| 5433 | switch (codec->vendor_id) { |
| 5434 | case 0x111d76b6: |
| 5435 | case 0x111d76b7: |
| 5436 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; |
| 5437 | break; |
| 5438 | case 0x111d7603: |
| 5439 | case 0x111d7608: |
| 5440 | /* On 92HD75Bx 0x27 isn't a pin nid */ |
| 5441 | spec->num_pins--; |
| 5442 | /* fallthrough */ |
| 5443 | default: |
| 5444 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; |
| 5445 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5446 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5447 | spec->board_config = snd_hda_check_board_config(codec, |
| 5448 | STAC_92HD71BXX_MODELS, |
| 5449 | stac92hd71bxx_models, |
| 5450 | stac92hd71bxx_cfg_tbl); |
| 5451 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5452 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5453 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5454 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5455 | else |
| 5456 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5457 | stac92hd71bxx_brd_tbl[spec->board_config]); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5458 | |
Takashi Iwai | 41c3b64 | 2008-11-18 10:45:15 +0100 | [diff] [blame] | 5459 | if (spec->board_config > STAC_92HD71BXX_REF) { |
| 5460 | /* GPIO0 = EAPD */ |
| 5461 | spec->gpio_mask = 0x01; |
| 5462 | spec->gpio_dir = 0x01; |
| 5463 | spec->gpio_data = 0x01; |
| 5464 | } |
| 5465 | |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5466 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
| 5467 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
| 5468 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5469 | spec->num_caps = STAC92HD71BXX_NUM_CAPS; |
| 5470 | spec->capvols = stac92hd71bxx_capvols; |
| 5471 | spec->capsws = stac92hd71bxx_capsws; |
| 5472 | |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5473 | switch (codec->vendor_id) { |
| 5474 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
| 5475 | case 0x111d76b7: |
Herton Ronaldo Krzesinski | 23c7b52 | 2009-02-08 19:51:28 -0200 | [diff] [blame] | 5476 | unmute_init++; |
| 5477 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5478 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
| 5479 | case 0x111d76b5: |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5480 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, |
| 5481 | sizeof(stac92hd71bxx_dmux_nomixer)); |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5482 | spec->init = stac92hd71bxx_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5483 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5484 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5485 | stac92hd71bxx_dmic_nids, |
| 5486 | STAC92HD71BXX_NUM_DMICS); |
| 5487 | if (spec->num_dmics) { |
| 5488 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5489 | spec->dinput_mux = &spec->private_dimux; |
| 5490 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; |
| 5491 | } |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5492 | break; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5493 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5494 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, |
| 5495 | sizeof(stac92hd71bxx_dmux_amixer)); |
| 5496 | spec->private_dimux.num_items--; |
Takashi Iwai | 8e5f262 | 2008-11-15 19:28:54 +0100 | [diff] [blame] | 5497 | switch (spec->board_config) { |
| 5498 | case STAC_HP_M4: |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5499 | /* Enable VREF power saving on GPIO1 detect */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5500 | err = stac_add_event(spec, codec->afg, |
| 5501 | STAC_VREF_EVENT, 0x02); |
| 5502 | if (err < 0) |
| 5503 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5504 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5505 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); |
| 5506 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 74aeaab | 2008-10-25 01:06:04 -0400 | [diff] [blame] | 5507 | AC_VERB_SET_UNSOLICITED_ENABLE, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5508 | AC_USRSP_EN | err); |
Matthew Ranostay | 72474be | 2008-10-09 09:32:17 -0400 | [diff] [blame] | 5509 | spec->gpio_mask |= 0x02; |
| 5510 | break; |
| 5511 | } |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5512 | if ((codec->revision_id & 0xf) == 0 || |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5513 | (codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5514 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5515 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5516 | /* no output amps */ |
| 5517 | spec->num_pwrs = 0; |
Takashi Iwai | 50c62f0 | 2009-07-28 18:25:29 +0200 | [diff] [blame] | 5518 | if (snd_hda_get_bool_hint(codec, "analog_mixer") == 1) |
| 5519 | spec->mixer = stac92hd71bxx_analog_mixer; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5520 | |
| 5521 | /* disable VSW */ |
| 5522 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5523 | unmute_init++; |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5524 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); |
| 5525 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5526 | stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; |
| 5527 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5528 | stac92hd71bxx_dmic_nids, |
| 5529 | STAC92HD71BXX_NUM_DMICS - 1); |
Takashi Iwai | 4417932 | 2009-07-28 17:03:49 +0200 | [diff] [blame] | 5530 | if (spec->num_dmics) { |
| 5531 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5532 | spec->dinput_mux = &spec->private_dimux; |
| 5533 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; |
| 5534 | } |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5535 | break; |
| 5536 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
Takashi Iwai | 8c2f767 | 2008-12-01 11:54:35 +0100 | [diff] [blame] | 5537 | if ((codec->revision_id & 0xf) == 1) |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5538 | spec->stream_delay = 40; /* 40 milliseconds */ |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5539 | |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5540 | /* no output amps */ |
| 5541 | spec->num_pwrs = 0; |
| 5542 | /* fallthru */ |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5543 | default: |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5544 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, |
| 5545 | sizeof(stac92hd71bxx_dmux_amixer)); |
Takashi Iwai | 50c62f0 | 2009-07-28 18:25:29 +0200 | [diff] [blame] | 5546 | if (snd_hda_get_bool_hint(codec, "analog_mixer") == 1) |
| 5547 | spec->mixer = stac92hd71bxx_analog_mixer; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5548 | spec->init = stac92hd71bxx_analog_core_init; |
Matthew Ranostay | 0ffa980 | 2008-09-08 11:20:05 -0400 | [diff] [blame] | 5549 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5550 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, |
| 5551 | stac92hd71bxx_dmic_nids, |
| 5552 | STAC92HD71BXX_NUM_DMICS); |
Takashi Iwai | 4417932 | 2009-07-28 17:03:49 +0200 | [diff] [blame] | 5553 | if (spec->num_dmics) { |
| 5554 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); |
| 5555 | spec->dinput_mux = &spec->private_dimux; |
| 5556 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; |
| 5557 | } |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5558 | } |
| 5559 | |
Matthew Ranostay | ca8d33f | 2009-01-26 09:33:52 -0500 | [diff] [blame] | 5560 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) |
| 5561 | snd_hda_sequence_write_cache(codec, unmute_init); |
| 5562 | |
Takashi Iwai | b20f3b8 | 2009-06-02 01:20:22 +0200 | [diff] [blame] | 5563 | /* Some HP machines seem to have unstable codec communications |
| 5564 | * especially with ATI fglrx driver. For recovering from the |
| 5565 | * CORB/RIRB stall, allow the BUS reset and keep always sync |
| 5566 | */ |
| 5567 | if (spec->board_config == STAC_HP_DV5) { |
| 5568 | codec->bus->sync_write = 1; |
| 5569 | codec->bus->allow_bus_reset = 1; |
| 5570 | } |
| 5571 | |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5572 | spec->aloopback_ctl = stac92hd71bxx_loopback; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5573 | spec->aloopback_mask = 0x50; |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 5574 | spec->aloopback_shift = 0; |
| 5575 | |
Matthew Ranostay | 8daaaa9 | 2008-08-15 07:45:52 +0200 | [diff] [blame] | 5576 | spec->powerdown_adcs = 1; |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5577 | spec->digbeep_nid = 0x26; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5578 | spec->mux_nids = stac92hd71bxx_mux_nids; |
| 5579 | spec->adc_nids = stac92hd71bxx_adc_nids; |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5580 | spec->smux_nids = stac92hd71bxx_smux_nids; |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 5581 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5582 | |
| 5583 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
| 5584 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5585 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5586 | |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5587 | switch (spec->board_config) { |
| 5588 | case STAC_HP_M4: |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5589 | /* enable internal microphone */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5590 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); |
Matthew Ranostay | b9aea71 | 2008-10-09 08:37:28 -0400 | [diff] [blame] | 5591 | stac92xx_auto_set_pinctl(codec, 0x0e, |
| 5592 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
Matthew Ranostay | 3a7abfd | 2008-11-20 21:21:43 -0500 | [diff] [blame] | 5593 | /* fallthru */ |
| 5594 | case STAC_DELL_M4_2: |
| 5595 | spec->num_dmics = 0; |
| 5596 | spec->num_smuxes = 0; |
| 5597 | spec->num_dmuxes = 0; |
| 5598 | break; |
| 5599 | case STAC_DELL_M4_1: |
| 5600 | case STAC_DELL_M4_3: |
| 5601 | spec->num_dmics = 1; |
| 5602 | spec->num_smuxes = 0; |
Takashi Iwai | ea18aa4 | 2009-02-27 17:36:33 +0100 | [diff] [blame] | 5603 | spec->num_dmuxes = 1; |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5604 | break; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5605 | case STAC_HP_DV4_1222NR: |
| 5606 | spec->num_dmics = 1; |
| 5607 | /* I don't know if it needs 1 or 2 smuxes - will wait for |
| 5608 | * bug reports to fix if needed |
| 5609 | */ |
| 5610 | spec->num_smuxes = 1; |
| 5611 | spec->num_dmuxes = 1; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5612 | spec->gpio_led = 0x01; |
James Gardiner | 514bf54 | 2009-05-03 04:00:44 -0400 | [diff] [blame] | 5613 | /* fallthrough */ |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5614 | case STAC_HP_DV5: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5615 | snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); |
Herton Ronaldo Krzesinski | e2ea57a | 2009-02-16 10:23:00 +0100 | [diff] [blame] | 5616 | stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); |
| 5617 | break; |
Christoph Plattner | ae6241f | 2009-03-08 23:19:05 +0100 | [diff] [blame] | 5618 | case STAC_HP_HDX: |
| 5619 | spec->num_dmics = 1; |
| 5620 | spec->num_dmuxes = 1; |
| 5621 | spec->num_smuxes = 1; |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5622 | /* orange/white mute led on GPIO3, orange=0, white=1 */ |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5623 | spec->gpio_led = 0x08; |
| 5624 | break; |
| 5625 | } |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5626 | |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5627 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5628 | if (spec->gpio_led) { |
| 5629 | spec->gpio_mask |= spec->gpio_led; |
| 5630 | spec->gpio_dir |= spec->gpio_led; |
| 5631 | spec->gpio_data |= spec->gpio_led; |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5632 | /* register check_power_status callback. */ |
Takashi Iwai | 6fce61a | 2009-03-10 07:48:57 +0100 | [diff] [blame] | 5633 | codec->patch_ops.check_power_status = |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5634 | stac92xx_hp_check_power_status; |
| 5635 | } |
Christoph Plattner | 443e26d | 2009-03-10 00:05:56 +0100 | [diff] [blame] | 5636 | #endif |
Matthew Ranostay | 6a14f58 | 2008-09-12 12:02:30 -0400 | [diff] [blame] | 5637 | |
Takashi Iwai | c21ca4a | 2008-12-19 09:26:08 +0100 | [diff] [blame] | 5638 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 4b33c76 | 2008-10-10 09:07:23 -0400 | [diff] [blame] | 5639 | if (spec->dinput_mux) |
Herton Ronaldo Krzesinski | 6df703a | 2009-02-04 11:34:22 -0500 | [diff] [blame] | 5640 | spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5641 | |
Herton Ronaldo Krzesinski | 29d4ab4 | 2009-02-04 11:37:27 -0500 | [diff] [blame] | 5642 | err = stac92xx_parse_auto_config(codec, 0x21, 0); |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5643 | if (!err) { |
| 5644 | if (spec->board_config < 0) { |
| 5645 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5646 | "available, default to model=ref\n"); |
| 5647 | spec->board_config = STAC_92HD71BXX_REF; |
| 5648 | goto again; |
| 5649 | } |
| 5650 | err = -EINVAL; |
| 5651 | } |
| 5652 | |
| 5653 | if (err < 0) { |
| 5654 | stac92xx_free(codec); |
| 5655 | return err; |
| 5656 | } |
| 5657 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5658 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
| 5659 | |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5660 | return 0; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5661 | } |
Matthew Ranostay | e035b84 | 2007-11-06 11:53:55 +0100 | [diff] [blame] | 5662 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5663 | static int patch_stac922x(struct hda_codec *codec) |
| 5664 | { |
| 5665 | struct sigmatel_spec *spec; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5666 | int err; |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5667 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5668 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5669 | if (spec == NULL) |
| 5670 | return -ENOMEM; |
| 5671 | |
| 5672 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5673 | spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5674 | spec->pin_nids = stac922x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5675 | spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, |
| 5676 | stac922x_models, |
| 5677 | stac922x_cfg_tbl); |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5678 | if (spec->board_config == STAC_INTEL_MAC_AUTO) { |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5679 | spec->gpio_mask = spec->gpio_dir = 0x03; |
| 5680 | spec->gpio_data = 0x03; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5681 | /* Intel Macs have all same PCI SSID, so we need to check |
| 5682 | * codec SSID to distinguish the exact models |
| 5683 | */ |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5684 | 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] | 5685 | switch (codec->subsystem_id) { |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5686 | |
| 5687 | case 0x106b0800: |
| 5688 | spec->board_config = STAC_INTEL_MAC_V1; |
Abhijit Bhopatkar | c45e20e | 2007-04-17 11:57:16 +0200 | [diff] [blame] | 5689 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5690 | case 0x106b0600: |
| 5691 | case 0x106b0700: |
| 5692 | spec->board_config = STAC_INTEL_MAC_V2; |
Nicolas Boichat | 6f0778d | 2007-03-15 12:38:15 +0100 | [diff] [blame] | 5693 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5694 | case 0x106b0e00: |
| 5695 | case 0x106b0f00: |
| 5696 | case 0x106b1600: |
| 5697 | case 0x106b1700: |
| 5698 | case 0x106b0200: |
| 5699 | case 0x106b1e00: |
| 5700 | spec->board_config = STAC_INTEL_MAC_V3; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5701 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5702 | case 0x106b1a00: |
| 5703 | case 0x00000100: |
| 5704 | spec->board_config = STAC_INTEL_MAC_V4; |
Sylvain FORET | f16928f | 2007-04-27 14:22:36 +0200 | [diff] [blame] | 5705 | break; |
Ivan N. Zlatev | 5d5d3bc | 2007-05-29 16:03:00 +0200 | [diff] [blame] | 5706 | case 0x106b0a00: |
| 5707 | case 0x106b2200: |
| 5708 | spec->board_config = STAC_INTEL_MAC_V5; |
Takashi Iwai | 0dae0f8 | 2007-05-21 12:41:29 +0200 | [diff] [blame] | 5709 | break; |
Nicolas Boichat | 536319a | 2008-07-21 22:18:01 +0800 | [diff] [blame] | 5710 | default: |
| 5711 | spec->board_config = STAC_INTEL_MAC_V3; |
| 5712 | break; |
Takashi Iwai | 3fc24d8 | 2007-02-16 13:27:18 +0100 | [diff] [blame] | 5713 | } |
| 5714 | } |
| 5715 | |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5716 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5717 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5718 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5719 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5720 | else |
| 5721 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5722 | stac922x_brd_tbl[spec->board_config]); |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5723 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5724 | spec->adc_nids = stac922x_adc_nids; |
| 5725 | spec->mux_nids = stac922x_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5726 | spec->num_muxes = ARRAY_SIZE(stac922x_mux_nids); |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5727 | spec->num_adcs = ARRAY_SIZE(stac922x_adc_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5728 | spec->num_dmics = 0; |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5729 | spec->num_pwrs = 0; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5730 | |
| 5731 | spec->init = stac922x_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5732 | |
| 5733 | spec->num_caps = STAC922X_NUM_CAPS; |
| 5734 | spec->capvols = stac922x_capvols; |
| 5735 | spec->capsws = stac922x_capsws; |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5736 | |
| 5737 | spec->multiout.dac_nids = spec->dac_nids; |
Takashi Iwai | 19039bd | 2006-06-28 15:52:16 +0200 | [diff] [blame] | 5738 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5739 | err = stac92xx_parse_auto_config(codec, 0x08, 0x09); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5740 | if (!err) { |
| 5741 | if (spec->board_config < 0) { |
| 5742 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5743 | "available, default to model=ref\n"); |
| 5744 | spec->board_config = STAC_D945_REF; |
| 5745 | goto again; |
| 5746 | } |
| 5747 | err = -EINVAL; |
| 5748 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5749 | if (err < 0) { |
| 5750 | stac92xx_free(codec); |
| 5751 | return err; |
| 5752 | } |
| 5753 | |
| 5754 | codec->patch_ops = stac92xx_patch_ops; |
| 5755 | |
Takashi Iwai | 807a4636 | 2007-05-29 19:01:37 +0200 | [diff] [blame] | 5756 | /* Fix Mux capture level; max to 2 */ |
| 5757 | snd_hda_override_amp_caps(codec, 0x12, HDA_OUTPUT, |
| 5758 | (0 << AC_AMPCAP_OFFSET_SHIFT) | |
| 5759 | (2 << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 5760 | (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 5761 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 5762 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5763 | return 0; |
| 5764 | } |
| 5765 | |
| 5766 | static int patch_stac927x(struct hda_codec *codec) |
| 5767 | { |
| 5768 | struct sigmatel_spec *spec; |
| 5769 | int err; |
| 5770 | |
| 5771 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5772 | if (spec == NULL) |
| 5773 | return -ENOMEM; |
| 5774 | |
| 5775 | codec->spec = spec; |
Matthew Ranostay | 45c1d85 | 2009-02-04 17:49:41 -0500 | [diff] [blame] | 5776 | codec->slave_dig_outs = stac927x_slave_dig_outs; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5777 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5778 | spec->pin_nids = stac927x_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5779 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
| 5780 | stac927x_models, |
| 5781 | stac927x_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5782 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5783 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5784 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5785 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5786 | else |
| 5787 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5788 | stac927x_brd_tbl[spec->board_config]); |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5789 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5790 | spec->digbeep_nid = 0x23; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5791 | spec->adc_nids = stac927x_adc_nids; |
| 5792 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
| 5793 | spec->mux_nids = stac927x_mux_nids; |
| 5794 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5795 | spec->smux_nids = stac927x_smux_nids; |
| 5796 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); |
Matthew Ranostay | 6597363 | 2008-09-16 10:39:37 -0400 | [diff] [blame] | 5797 | spec->spdif_labels = stac927x_spdif_labels; |
Matthew Ranostay | b76c850 | 2008-02-06 14:49:44 +0100 | [diff] [blame] | 5798 | spec->dac_list = stac927x_dac_nids; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5799 | spec->multiout.dac_nids = spec->dac_nids; |
| 5800 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5801 | switch (spec->board_config) { |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5802 | case STAC_D965_3ST: |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5803 | case STAC_D965_5ST: |
| 5804 | /* GPIO0 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5805 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5806 | spec->gpio_data = 0x01; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5807 | spec->num_dmics = 0; |
| 5808 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5809 | spec->init = d965_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5810 | break; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5811 | case STAC_DELL_BIOS: |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5812 | switch (codec->subsystem_id) { |
| 5813 | case 0x10280209: |
| 5814 | case 0x1028022e: |
| 5815 | /* correct the device field to SPDIF out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5816 | snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); |
Matthew Ranostay | 780c8be | 2008-04-14 13:32:27 +0200 | [diff] [blame] | 5817 | break; |
Takashi Iwai | 86d190e | 2009-05-26 15:18:58 +0200 | [diff] [blame] | 5818 | } |
Matthew Ranostay | 03d7ca1 | 2008-02-21 07:51:46 +0100 | [diff] [blame] | 5819 | /* configure the analog microphone on some laptops */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5820 | snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); |
Matthew Ranostay | 2f32d90 | 2008-01-10 13:06:26 +0100 | [diff] [blame] | 5821 | /* correct the front output jack as a hp out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5822 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5823 | /* correct the front input jack as a mic */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5824 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); |
Matthew Ranostay | c481fca | 2008-01-07 12:18:28 +0100 | [diff] [blame] | 5825 | /* fallthru */ |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5826 | case STAC_DELL_3ST: |
| 5827 | /* GPIO2 High = Enable EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5828 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5829 | spec->gpio_data = 0x04; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5830 | spec->dmic_nids = stac927x_dmic_nids; |
| 5831 | spec->num_dmics = STAC927X_NUM_DMICS; |
| 5832 | |
Tobin Davis | 93ed150 | 2006-09-01 21:03:12 +0200 | [diff] [blame] | 5833 | spec->init = d965_core_init; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5834 | spec->dmux_nids = stac927x_dmux_nids; |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5835 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5836 | break; |
| 5837 | default: |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5838 | if (spec->board_config > STAC_D965_REF) { |
| 5839 | /* GPIO0 High = Enable EAPD */ |
| 5840 | spec->eapd_mask = spec->gpio_mask = 0x01; |
| 5841 | spec->gpio_dir = spec->gpio_data = 0x01; |
| 5842 | } |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5843 | spec->num_dmics = 0; |
| 5844 | |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5845 | spec->init = stac927x_core_init; |
Tobin Davis | 81d3dbd | 2006-08-22 19:44:45 +0200 | [diff] [blame] | 5846 | } |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5847 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5848 | spec->num_caps = STAC927X_NUM_CAPS; |
| 5849 | spec->capvols = stac927x_capvols; |
| 5850 | spec->capsws = stac927x_capsws; |
| 5851 | |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5852 | spec->num_pwrs = 0; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5853 | spec->aloopback_ctl = stac927x_loopback; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5854 | spec->aloopback_mask = 0x40; |
| 5855 | spec->aloopback_shift = 0; |
Matthew Ranostay | c0cea0d | 2008-11-16 11:42:34 -0500 | [diff] [blame] | 5856 | spec->eapd_switch = 1; |
Matthew Ranostay | 8e9068b | 2007-12-17 11:58:13 +0100 | [diff] [blame] | 5857 | |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 5858 | err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5859 | if (!err) { |
| 5860 | if (spec->board_config < 0) { |
| 5861 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5862 | "available, default to model=ref\n"); |
| 5863 | spec->board_config = STAC_D965_REF; |
| 5864 | goto again; |
| 5865 | } |
| 5866 | err = -EINVAL; |
| 5867 | } |
Matt | c7d4b2f | 2005-06-27 14:59:41 +0200 | [diff] [blame] | 5868 | if (err < 0) { |
| 5869 | stac92xx_free(codec); |
| 5870 | return err; |
| 5871 | } |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5872 | |
| 5873 | codec->patch_ops = stac92xx_patch_ops; |
| 5874 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5875 | codec->proc_widget_hook = stac927x_proc_hook; |
| 5876 | |
Takashi Iwai | 5298765 | 2008-01-16 16:09:47 +0100 | [diff] [blame] | 5877 | /* |
| 5878 | * !!FIXME!! |
| 5879 | * The STAC927x seem to require fairly long delays for certain |
| 5880 | * command sequences. With too short delays (even if the answer |
| 5881 | * is set to RIRB properly), it results in the silence output |
| 5882 | * on some hardwares like Dell. |
| 5883 | * |
| 5884 | * The below flag enables the longer delay (see get_response |
| 5885 | * in hda_intel.c). |
| 5886 | */ |
| 5887 | codec->bus->needs_damn_long_delay = 1; |
| 5888 | |
Takashi Iwai | e28d832 | 2008-12-17 13:48:29 +0100 | [diff] [blame] | 5889 | /* no jack detecion for ref-no-jd model */ |
| 5890 | if (spec->board_config == STAC_D965_REF_NO_JD) |
| 5891 | spec->hp_detect = 0; |
| 5892 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 5893 | return 0; |
| 5894 | } |
| 5895 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5896 | static int patch_stac9205(struct hda_codec *codec) |
| 5897 | { |
| 5898 | struct sigmatel_spec *spec; |
Takashi Iwai | 8259980 | 2007-07-31 15:56:24 +0200 | [diff] [blame] | 5899 | int err; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5900 | |
| 5901 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 5902 | if (spec == NULL) |
| 5903 | return -ENOMEM; |
| 5904 | |
| 5905 | codec->spec = spec; |
Takashi Iwai | a4eed13 | 2007-07-06 18:17:04 +0200 | [diff] [blame] | 5906 | spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); |
Richard Fish | 11b44bb | 2006-08-23 18:31:34 +0200 | [diff] [blame] | 5907 | spec->pin_nids = stac9205_pin_nids; |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5908 | spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, |
| 5909 | stac9205_models, |
| 5910 | stac9205_cfg_tbl); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5911 | again: |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5912 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 5913 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 5914 | codec->chip_name); |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5915 | else |
| 5916 | stac92xx_set_config_regs(codec, |
Takashi Iwai | af9f341 | 2008-11-18 10:38:56 +0100 | [diff] [blame] | 5917 | stac9205_brd_tbl[spec->board_config]); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5918 | |
Matthew Ranostay | 1cd2224 | 2008-07-18 18:20:52 +0200 | [diff] [blame] | 5919 | spec->digbeep_nid = 0x23; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5920 | spec->adc_nids = stac9205_adc_nids; |
Maxim Levitsky | 9e05b7a | 2007-09-03 15:31:02 +0200 | [diff] [blame] | 5921 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5922 | spec->mux_nids = stac9205_mux_nids; |
Takashi Iwai | 2549413 | 2007-03-12 12:36:16 +0100 | [diff] [blame] | 5923 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
Matthew Ranostay | d973775 | 2008-09-07 12:03:41 +0200 | [diff] [blame] | 5924 | spec->smux_nids = stac9205_smux_nids; |
| 5925 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); |
Matt Porter | 8b65727 | 2006-10-26 17:12:59 +0200 | [diff] [blame] | 5926 | spec->dmic_nids = stac9205_dmic_nids; |
Takashi Iwai | f6e9852 | 2007-10-16 14:27:04 +0200 | [diff] [blame] | 5927 | spec->num_dmics = STAC9205_NUM_DMICS; |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5928 | spec->dmux_nids = stac9205_dmux_nids; |
Takashi Iwai | 1697055 | 2007-12-18 18:05:52 +0100 | [diff] [blame] | 5929 | spec->num_dmuxes = ARRAY_SIZE(stac9205_dmux_nids); |
Matthew Ranostay | a64135a | 2008-01-10 16:55:06 +0100 | [diff] [blame] | 5930 | spec->num_pwrs = 0; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5931 | |
| 5932 | spec->init = stac9205_core_init; |
Takashi Iwai | d78d7a9 | 2009-03-02 14:26:25 +0100 | [diff] [blame] | 5933 | spec->aloopback_ctl = stac9205_loopback; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5934 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 5935 | spec->num_caps = STAC9205_NUM_CAPS; |
| 5936 | spec->capvols = stac9205_capvols; |
| 5937 | spec->capsws = stac9205_capsws; |
| 5938 | |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 5939 | spec->aloopback_mask = 0x40; |
| 5940 | spec->aloopback_shift = 0; |
Takashi Iwai | d9a4268 | 2009-01-22 17:40:18 +0100 | [diff] [blame] | 5941 | /* Turn on/off EAPD per HP plugging */ |
| 5942 | if (spec->board_config != STAC_9205_EAPD) |
| 5943 | spec->eapd_switch = 1; |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5944 | spec->multiout.dac_nids = spec->dac_nids; |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5945 | |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5946 | switch (spec->board_config){ |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5947 | case STAC_9205_DELL_M43: |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5948 | /* Enable SPDIF in/out */ |
Takashi Iwai | 330ee99 | 2009-02-20 14:33:36 +0100 | [diff] [blame] | 5949 | snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); |
| 5950 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
Matt Porter | 3338240 | 2006-12-18 13:17:28 +0100 | [diff] [blame] | 5951 | |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5952 | /* Enable unsol response for GPIO4/Dock HP connection */ |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5953 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); |
| 5954 | if (err < 0) |
| 5955 | return err; |
Takashi Iwai | c5d08bb | 2008-11-18 10:55:36 +0100 | [diff] [blame] | 5956 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5957 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); |
| 5958 | snd_hda_codec_write_cache(codec, codec->afg, 0, |
Takashi Iwai | c6e4c66 | 2008-11-25 11:58:19 +0100 | [diff] [blame] | 5959 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 5960 | AC_USRSP_EN | err); |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5961 | |
| 5962 | spec->gpio_dir = 0x0b; |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5963 | spec->eapd_mask = 0x01; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5964 | spec->gpio_mask = 0x1b; |
| 5965 | spec->gpio_mute = 0x10; |
Matthew Ranostay | e2e7d62 | 2008-01-24 15:32:15 +0100 | [diff] [blame] | 5966 | /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5967 | * GPIO3 Low = DRM |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5968 | */ |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5969 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5970 | break; |
Matthew Ranostay | b2c4f4d | 2008-09-26 10:06:40 -0400 | [diff] [blame] | 5971 | case STAC_9205_REF: |
| 5972 | /* SPDIF-In enabled */ |
| 5973 | break; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5974 | default: |
| 5975 | /* GPIO0 High = EAPD */ |
Matthew Ranostay | 0fc9dec | 2008-04-14 13:32:54 +0200 | [diff] [blame] | 5976 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
Matthew Ranostay | 4fe5195 | 2008-01-29 15:28:44 +0100 | [diff] [blame] | 5977 | spec->gpio_data = 0x01; |
Tobin Davis | ae0a8ed | 2007-08-13 15:50:29 +0200 | [diff] [blame] | 5978 | break; |
| 5979 | } |
Matthew Ranostay | 87d4836 | 2007-07-17 11:52:24 +0200 | [diff] [blame] | 5980 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5981 | err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); |
Takashi Iwai | 9e507ab | 2007-02-08 17:50:10 +0100 | [diff] [blame] | 5982 | if (!err) { |
| 5983 | if (spec->board_config < 0) { |
| 5984 | printk(KERN_WARNING "hda_codec: No auto-config is " |
| 5985 | "available, default to model=ref\n"); |
| 5986 | spec->board_config = STAC_9205_REF; |
| 5987 | goto again; |
| 5988 | } |
| 5989 | err = -EINVAL; |
| 5990 | } |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 5991 | if (err < 0) { |
| 5992 | stac92xx_free(codec); |
| 5993 | return err; |
| 5994 | } |
| 5995 | |
| 5996 | codec->patch_ops = stac92xx_patch_ops; |
| 5997 | |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 5998 | codec->proc_widget_hook = stac9205_proc_hook; |
| 5999 | |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6000 | return 0; |
| 6001 | } |
| 6002 | |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6003 | /* |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6004 | * STAC9872 hack |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6005 | */ |
| 6006 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6007 | static struct hda_verb stac9872_core_init[] = { |
Takashi Iwai | 1624cb9 | 2007-07-05 13:10:51 +0200 | [diff] [blame] | 6008 | {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] | 6009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
| 6010 | {} |
| 6011 | }; |
| 6012 | |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6013 | static hda_nid_t stac9872_pin_nids[] = { |
| 6014 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
| 6015 | 0x11, 0x13, 0x14, |
| 6016 | }; |
| 6017 | |
| 6018 | static hda_nid_t stac9872_adc_nids[] = { |
| 6019 | 0x8 /*,0x6*/ |
| 6020 | }; |
| 6021 | |
| 6022 | static hda_nid_t stac9872_mux_nids[] = { |
| 6023 | 0x15 |
| 6024 | }; |
| 6025 | |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6026 | static unsigned long stac9872_capvols[] = { |
| 6027 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), |
| 6028 | }; |
| 6029 | #define stac9872_capsws stac9872_capvols |
| 6030 | |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6031 | static unsigned int stac9872_vaio_pin_configs[9] = { |
| 6032 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
| 6033 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
| 6034 | 0x90a7013e |
| 6035 | }; |
| 6036 | |
| 6037 | static const char *stac9872_models[STAC_9872_MODELS] = { |
| 6038 | [STAC_9872_AUTO] = "auto", |
| 6039 | [STAC_9872_VAIO] = "vaio", |
| 6040 | }; |
| 6041 | |
| 6042 | static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { |
| 6043 | [STAC_9872_VAIO] = stac9872_vaio_pin_configs, |
| 6044 | }; |
| 6045 | |
| 6046 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6047 | SND_PCI_QUIRK_MASK(0x104d, 0xfff0, 0x81e0, |
| 6048 | "Sony VAIO F/S", STAC_9872_VAIO), |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6049 | {} /* terminator */ |
| 6050 | }; |
| 6051 | |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6052 | static int patch_stac9872(struct hda_codec *codec) |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6053 | { |
| 6054 | struct sigmatel_spec *spec; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6055 | int err; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6056 | |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6057 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 6058 | if (spec == NULL) |
| 6059 | return -ENOMEM; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6060 | codec->spec = spec; |
Takashi Iwai | b04add9 | 2009-07-20 08:01:36 +0200 | [diff] [blame] | 6061 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); |
| 6062 | spec->pin_nids = stac9872_pin_nids; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6063 | |
| 6064 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, |
| 6065 | stac9872_models, |
| 6066 | stac9872_cfg_tbl); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6067 | if (spec->board_config < 0) |
Takashi Iwai | 9a11f1a | 2009-07-28 16:01:20 +0200 | [diff] [blame] | 6068 | snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n", |
| 6069 | codec->chip_name); |
Takashi Iwai | 307282c | 2009-03-12 18:17:58 +0100 | [diff] [blame] | 6070 | else |
| 6071 | stac92xx_set_config_regs(codec, |
| 6072 | stac9872_brd_tbl[spec->board_config]); |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6073 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6074 | spec->multiout.dac_nids = spec->dac_nids; |
| 6075 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); |
| 6076 | spec->adc_nids = stac9872_adc_nids; |
| 6077 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); |
| 6078 | spec->mux_nids = stac9872_mux_nids; |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6079 | spec->init = stac9872_core_init; |
Takashi Iwai | 6479c63 | 2009-07-28 18:20:25 +0200 | [diff] [blame] | 6080 | spec->num_caps = 1; |
| 6081 | spec->capvols = stac9872_capvols; |
| 6082 | spec->capsws = stac9872_capsws; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6083 | |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6084 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); |
| 6085 | if (err < 0) { |
| 6086 | stac92xx_free(codec); |
| 6087 | return -EINVAL; |
Takashi Iwai | caa10b6 | 2009-01-20 17:19:01 +0100 | [diff] [blame] | 6088 | } |
Takashi Iwai | 1e137f9 | 2009-01-21 07:41:22 +0100 | [diff] [blame] | 6089 | spec->input_mux = &spec->private_imux; |
| 6090 | codec->patch_ops = stac92xx_patch_ops; |
Takashi Iwai | db064e5 | 2006-03-16 16:04:58 +0100 | [diff] [blame] | 6091 | return 0; |
| 6092 | } |
| 6093 | |
| 6094 | |
| 6095 | /* |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6096 | * patch entries |
| 6097 | */ |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 6098 | static struct hda_codec_preset snd_hda_preset_sigmatel[] = { |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6099 | { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, |
| 6100 | { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, |
| 6101 | { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, |
| 6102 | { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, |
| 6103 | { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, |
| 6104 | { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, |
| 6105 | { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, |
Matt Porter | 22a27c7 | 2006-07-06 18:49:10 +0200 | [diff] [blame] | 6106 | { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, |
| 6107 | { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, |
| 6108 | { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, |
| 6109 | { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, |
| 6110 | { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, |
| 6111 | { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, |
Matt Porter | 3cc08dc | 2006-01-23 15:27:49 +0100 | [diff] [blame] | 6112 | { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, |
| 6113 | { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, |
| 6114 | { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, |
| 6115 | { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, |
| 6116 | { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, |
| 6117 | { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, |
| 6118 | { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, |
| 6119 | { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, |
| 6120 | { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, |
| 6121 | { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, |
Tobin Davis | 8e21c34 | 2007-01-08 11:04:17 +0100 | [diff] [blame] | 6122 | { .id = 0x83847632, .name = "STAC9202", .patch = patch_stac925x }, |
| 6123 | { .id = 0x83847633, .name = "STAC9202D", .patch = patch_stac925x }, |
| 6124 | { .id = 0x83847634, .name = "STAC9250", .patch = patch_stac925x }, |
| 6125 | { .id = 0x83847635, .name = "STAC9250D", .patch = patch_stac925x }, |
| 6126 | { .id = 0x83847636, .name = "STAC9251", .patch = patch_stac925x }, |
| 6127 | { .id = 0x83847637, .name = "STAC9250D", .patch = patch_stac925x }, |
Takashi Iwai | 7bd3c0f | 2008-05-02 12:28:02 +0200 | [diff] [blame] | 6128 | { .id = 0x83847645, .name = "92HD206X", .patch = patch_stac927x }, |
| 6129 | { .id = 0x83847646, .name = "92HD206D", .patch = patch_stac927x }, |
Guillaume Munch | 6d85906 | 2006-08-22 17:15:47 +0200 | [diff] [blame] | 6130 | /* The following does not take into account .id=0x83847661 when subsys = |
| 6131 | * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are |
| 6132 | * currently not fully supported. |
| 6133 | */ |
| 6134 | { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, |
| 6135 | { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, |
| 6136 | { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, |
Simos Xenitellis | a5c0f88 | 2009-06-10 16:33:31 +0100 | [diff] [blame] | 6137 | { .id = 0x83847698, .name = "STAC9205", .patch = patch_stac9205 }, |
Matt Porter | f3302a5 | 2006-07-31 12:49:34 +0200 | [diff] [blame] | 6138 | { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, |
| 6139 | { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, |
| 6140 | { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, |
| 6141 | { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, |
| 6142 | { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, |
| 6143 | { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, |
| 6144 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
| 6145 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6146 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | d0513fc | 2008-07-27 10:30:30 +0200 | [diff] [blame] | 6147 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, |
| 6148 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | ff2e733 | 2009-04-01 14:49:48 -0400 | [diff] [blame] | 6149 | { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, |
Matthew Ranostay | aafc441 | 2008-06-13 18:04:33 +0200 | [diff] [blame] | 6150 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6151 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
| 6152 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | e1f0d66 | 2007-12-13 17:47:21 +0100 | [diff] [blame] | 6153 | { .id = 0x111d7676, .name = "92HD73E1X5", .patch = patch_stac92hd73xx }, |
Matthew Ranostay | 541eee8 | 2007-12-14 12:08:04 +0100 | [diff] [blame] | 6154 | { .id = 0x111d76b0, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6155 | { .id = 0x111d76b1, .name = "92HD71B8X", .patch = patch_stac92hd71bxx }, |
| 6156 | { .id = 0x111d76b2, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6157 | { .id = 0x111d76b3, .name = "92HD71B7X", .patch = patch_stac92hd71bxx }, |
| 6158 | { .id = 0x111d76b4, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6159 | { .id = 0x111d76b5, .name = "92HD71B6X", .patch = patch_stac92hd71bxx }, |
| 6160 | { .id = 0x111d76b6, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
| 6161 | { .id = 0x111d76b7, .name = "92HD71B5X", .patch = patch_stac92hd71bxx }, |
Matt | 2f2f425 | 2005-04-13 14:45:30 +0200 | [diff] [blame] | 6162 | {} /* terminator */ |
| 6163 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 6164 | |
| 6165 | MODULE_ALIAS("snd-hda-codec-id:8384*"); |
| 6166 | MODULE_ALIAS("snd-hda-codec-id:111d*"); |
| 6167 | |
| 6168 | MODULE_LICENSE("GPL"); |
| 6169 | MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); |
| 6170 | |
| 6171 | static struct hda_codec_preset_list sigmatel_list = { |
| 6172 | .preset = snd_hda_preset_sigmatel, |
| 6173 | .owner = THIS_MODULE, |
| 6174 | }; |
| 6175 | |
| 6176 | static int __init patch_sigmatel_init(void) |
| 6177 | { |
| 6178 | return snd_hda_add_codec_preset(&sigmatel_list); |
| 6179 | } |
| 6180 | |
| 6181 | static void __exit patch_sigmatel_exit(void) |
| 6182 | { |
| 6183 | snd_hda_delete_codec_preset(&sigmatel_list); |
| 6184 | } |
| 6185 | |
| 6186 | module_init(patch_sigmatel_init) |
| 6187 | module_exit(patch_sigmatel_exit) |