Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 75 | ALC260_HP_3013, |
| 76 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 77 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 78 | ALC260_WILL, |
| 79 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_SND_DEBUG |
| 81 | ALC260_TEST, |
| 82 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 84 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 87 | /* ALC262 models */ |
| 88 | enum { |
| 89 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 90 | ALC262_HIPPO, |
| 91 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 92 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 93 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 94 | ALC262_HP_BPC_D7000_WL, |
| 95 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 96 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 97 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 98 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 99 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 100 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 101 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 102 | ALC262_LENOVO_3000, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 103 | ALC262_AUTO, |
| 104 | ALC262_MODEL_LAST /* last tag */ |
| 105 | }; |
| 106 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 107 | /* ALC268 models */ |
| 108 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 109 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 110 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 111 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 112 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 113 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 114 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 115 | #ifdef CONFIG_SND_DEBUG |
| 116 | ALC268_TEST, |
| 117 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 118 | ALC268_AUTO, |
| 119 | ALC268_MODEL_LAST /* last tag */ |
| 120 | }; |
| 121 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 122 | /* ALC269 models */ |
| 123 | enum { |
| 124 | ALC269_BASIC, |
| 125 | ALC269_AUTO, |
| 126 | ALC269_MODEL_LAST /* last tag */ |
| 127 | }; |
| 128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 129 | /* ALC861 models */ |
| 130 | enum { |
| 131 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 132 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 133 | ALC861_3ST_DIG, |
| 134 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 135 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 136 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 137 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 138 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | ALC861_AUTO, |
| 140 | ALC861_MODEL_LAST, |
| 141 | }; |
| 142 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 143 | /* ALC861-VD models */ |
| 144 | enum { |
| 145 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 146 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 147 | ALC861VD_3ST, |
| 148 | ALC861VD_3ST_DIG, |
| 149 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 150 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 151 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 152 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 153 | ALC861VD_AUTO, |
| 154 | ALC861VD_MODEL_LAST, |
| 155 | }; |
| 156 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 157 | /* ALC662 models */ |
| 158 | enum { |
| 159 | ALC662_3ST_2ch_DIG, |
| 160 | ALC662_3ST_6ch_DIG, |
| 161 | ALC662_3ST_6ch, |
| 162 | ALC662_5ST_DIG, |
| 163 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 164 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 165 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 166 | ALC662_AUTO, |
| 167 | ALC662_MODEL_LAST, |
| 168 | }; |
| 169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 170 | /* ALC882 models */ |
| 171 | enum { |
| 172 | ALC882_3ST_DIG, |
| 173 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 174 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 175 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 176 | ALC882_TARGA, |
| 177 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 178 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 179 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 180 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 181 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 182 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | ALC882_MODEL_LAST, |
| 184 | }; |
| 185 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 186 | /* ALC883 models */ |
| 187 | enum { |
| 188 | ALC883_3ST_2ch_DIG, |
| 189 | ALC883_3ST_6ch_DIG, |
| 190 | ALC883_3ST_6ch, |
| 191 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 192 | ALC883_TARGA_DIG, |
| 193 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 194 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 195 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 196 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 197 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 198 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 199 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 200 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 201 | ALC888_LENOVO_MS7195_DIG, |
| 202 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 203 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 204 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 205 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 206 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 207 | ALC883_FUJITSU_PI2515, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 208 | ALC883_AUTO, |
| 209 | ALC883_MODEL_LAST, |
| 210 | }; |
| 211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | /* for GPIO Poll */ |
| 213 | #define GPIO_MASK 0x03 |
| 214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | struct alc_spec { |
| 216 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 217 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | unsigned int num_mixers; |
| 219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 220 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 221 | * don't forget NULL |
| 222 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 223 | */ |
| 224 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 226 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | struct hda_pcm_stream *stream_analog_playback; |
| 228 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 229 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 230 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 232 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | struct hda_pcm_stream *stream_digital_playback; |
| 234 | struct hda_pcm_stream *stream_digital_capture; |
| 235 | |
| 236 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 237 | struct hda_multi_out multiout; /* playback set-up |
| 238 | * max_channels, dacs must be set |
| 239 | * dig_out_nid and hp_nid are optional |
| 240 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 241 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
| 243 | /* capture */ |
| 244 | unsigned int num_adc_nids; |
| 245 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 246 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 247 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
| 249 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 250 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | const struct hda_input_mux *input_mux; |
| 252 | unsigned int cur_mux[3]; |
| 253 | |
| 254 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 255 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 257 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
| 259 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 260 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 261 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 262 | /* dynamic controls, init_verbs and input_mux */ |
| 263 | struct auto_pin_cfg autocfg; |
| 264 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 265 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 266 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 267 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 268 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 269 | /* hooks */ |
| 270 | void (*init_hook)(struct hda_codec *codec); |
| 271 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 272 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 273 | /* for pin sensing */ |
| 274 | unsigned int sense_updated: 1; |
| 275 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 276 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 277 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 278 | /* for virtual master */ |
| 279 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 280 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 281 | struct hda_loopback_check loopback; |
| 282 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 283 | }; |
| 284 | |
| 285 | /* |
| 286 | * configuration template - to be copied to the spec instance |
| 287 | */ |
| 288 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 289 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 290 | * with spec |
| 291 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 292 | const struct hda_verb *init_verbs[5]; |
| 293 | unsigned int num_dacs; |
| 294 | hda_nid_t *dac_nids; |
| 295 | hda_nid_t dig_out_nid; /* optional */ |
| 296 | hda_nid_t hp_nid; /* optional */ |
| 297 | unsigned int num_adc_nids; |
| 298 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 299 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 300 | hda_nid_t dig_in_nid; |
| 301 | unsigned int num_channel_mode; |
| 302 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 303 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 304 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 305 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 306 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 307 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 308 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 309 | struct hda_amp_list *loopbacks; |
| 310 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | }; |
| 312 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* |
| 315 | * input MUX handling |
| 316 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 317 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 318 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | { |
| 320 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 321 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 322 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 323 | if (mux_idx >= spec->num_mux_defs) |
| 324 | mux_idx = 0; |
| 325 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | } |
| 327 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 328 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 329 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | { |
| 331 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 332 | struct alc_spec *spec = codec->spec; |
| 333 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 334 | |
| 335 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 336 | return 0; |
| 337 | } |
| 338 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 340 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
| 342 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 343 | struct alc_spec *spec = codec->spec; |
| 344 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 345 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 346 | hda_nid_t nid = spec->capsrc_nids ? |
| 347 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 348 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 349 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | } |
| 351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 352 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | /* |
| 354 | * channel mode setting |
| 355 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 356 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 357 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | { |
| 359 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 360 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 361 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 362 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | } |
| 364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 365 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 366 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | { |
| 368 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 369 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 370 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 371 | spec->num_channel_mode, |
| 372 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | } |
| 374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 375 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 376 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | { |
| 378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 379 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 380 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 381 | spec->num_channel_mode, |
| 382 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 383 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 384 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 385 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | } |
| 387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 389 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 390 | * instead of "%" to avoid consequences of accidently treating the % as |
| 391 | * being part of a format specifier. Maximum allowed length of a value is |
| 392 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 393 | * |
| 394 | * Note: some retasking pin complexes seem to ignore requests for input |
| 395 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 396 | * are requested. Therefore order this list so that this behaviour will not |
| 397 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 398 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 399 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 400 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 401 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 402 | "Mic 50pc bias", "Mic 80pc bias", |
| 403 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 404 | }; |
| 405 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 406 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 407 | }; |
| 408 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 409 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 410 | * addition, "input" pins may or may not process the mic bias option |
| 411 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 412 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 413 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 414 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 415 | #define ALC_PIN_DIR_IN 0x00 |
| 416 | #define ALC_PIN_DIR_OUT 0x01 |
| 417 | #define ALC_PIN_DIR_INOUT 0x02 |
| 418 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 419 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 420 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 421 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | * For each direction the minimum and maximum values are given. |
| 423 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 424 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 426 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 427 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 428 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 429 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 430 | }; |
| 431 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 432 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 433 | #define alc_pin_mode_n_items(_dir) \ |
| 434 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 435 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 436 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 437 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 438 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 439 | unsigned int item_num = uinfo->value.enumerated.item; |
| 440 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 441 | |
| 442 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 443 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 444 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 445 | |
| 446 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 447 | item_num = alc_pin_mode_min(dir); |
| 448 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 449 | return 0; |
| 450 | } |
| 451 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 452 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 453 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 454 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 455 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 458 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 459 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 461 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 462 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 463 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 464 | /* Find enumerated value for current pinctl setting */ |
| 465 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | return 0; |
| 470 | } |
| 471 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 473 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | { |
| 475 | signed int change; |
| 476 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 477 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 478 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 479 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 481 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 482 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 484 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | val = alc_pin_mode_min(dir); |
| 486 | |
| 487 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 488 | if (change) { |
| 489 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 490 | snd_hda_codec_write_cache(codec, nid, 0, |
| 491 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 492 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 493 | |
| 494 | /* Also enable the retasking pin's input/output as required |
| 495 | * for the requested pin mode. Enum values of 2 or less are |
| 496 | * input modes. |
| 497 | * |
| 498 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 499 | * reduces noise slightly (particularly on input) so we'll |
| 500 | * do it. However, having both input and output buffers |
| 501 | * enabled simultaneously doesn't seem to be problematic if |
| 502 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 503 | */ |
| 504 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 505 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 506 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 507 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 508 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 509 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 510 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 511 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 512 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 513 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 514 | } |
| 515 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 516 | return change; |
| 517 | } |
| 518 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 520 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 521 | .info = alc_pin_mode_info, \ |
| 522 | .get = alc_pin_mode_get, \ |
| 523 | .put = alc_pin_mode_put, \ |
| 524 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 525 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 526 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 527 | * together using a mask with more than one bit set. This control is |
| 528 | * currently used only by the ALC260 test model. At this stage they are not |
| 529 | * needed for any "production" models. |
| 530 | */ |
| 531 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 532 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 536 | { |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 539 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 540 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 541 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 542 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 543 | |
| 544 | *valp = (val & mask) != 0; |
| 545 | return 0; |
| 546 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 547 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 548 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 549 | { |
| 550 | signed int change; |
| 551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 552 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 553 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 554 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 556 | AC_VERB_GET_GPIO_DATA, |
| 557 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 558 | |
| 559 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 561 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 562 | gpio_data &= ~mask; |
| 563 | else |
| 564 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 565 | snd_hda_codec_write_cache(codec, nid, 0, |
| 566 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 567 | |
| 568 | return change; |
| 569 | } |
| 570 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 571 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 572 | .info = alc_gpio_data_info, \ |
| 573 | .get = alc_gpio_data_get, \ |
| 574 | .put = alc_gpio_data_put, \ |
| 575 | .private_value = nid | (mask<<16) } |
| 576 | #endif /* CONFIG_SND_DEBUG */ |
| 577 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 578 | /* A switch control to allow the enabling of the digital IO pins on the |
| 579 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 580 | * to provide something in the test model allowing digital outputs to be |
| 581 | * identified if present. If models are found which can utilise these |
| 582 | * outputs a more complete mixer control can be devised for those models if |
| 583 | * necessary. |
| 584 | */ |
| 585 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 586 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 590 | { |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 593 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 594 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 596 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 597 | |
| 598 | *valp = (val & mask) != 0; |
| 599 | return 0; |
| 600 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 601 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 602 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 603 | { |
| 604 | signed int change; |
| 605 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 606 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 607 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 608 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 610 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 611 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | |
| 613 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 615 | if (val==0) |
| 616 | ctrl_data &= ~mask; |
| 617 | else |
| 618 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 619 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 620 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 621 | |
| 622 | return change; |
| 623 | } |
| 624 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 625 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 626 | .info = alc_spdif_ctrl_info, \ |
| 627 | .get = alc_spdif_ctrl_get, \ |
| 628 | .put = alc_spdif_ctrl_put, \ |
| 629 | .private_value = nid | (mask<<16) } |
| 630 | #endif /* CONFIG_SND_DEBUG */ |
| 631 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 632 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 633 | * Again, this is only used in the ALC26x test models to help identify when |
| 634 | * the EAPD line must be asserted for features to work. |
| 635 | */ |
| 636 | #ifdef CONFIG_SND_DEBUG |
| 637 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 638 | |
| 639 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
| 641 | { |
| 642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 643 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 644 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 645 | long *valp = ucontrol->value.integer.value; |
| 646 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 647 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 648 | |
| 649 | *valp = (val & mask) != 0; |
| 650 | return 0; |
| 651 | } |
| 652 | |
| 653 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
| 655 | { |
| 656 | int change; |
| 657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 658 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 660 | long val = *ucontrol->value.integer.value; |
| 661 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 662 | AC_VERB_GET_EAPD_BTLENABLE, |
| 663 | 0x00); |
| 664 | |
| 665 | /* Set/unset the masked control bit(s) as needed */ |
| 666 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 667 | if (!val) |
| 668 | ctrl_data &= ~mask; |
| 669 | else |
| 670 | ctrl_data |= mask; |
| 671 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 672 | ctrl_data); |
| 673 | |
| 674 | return change; |
| 675 | } |
| 676 | |
| 677 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 678 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 679 | .info = alc_eapd_ctrl_info, \ |
| 680 | .get = alc_eapd_ctrl_get, \ |
| 681 | .put = alc_eapd_ctrl_put, \ |
| 682 | .private_value = nid | (mask<<16) } |
| 683 | #endif /* CONFIG_SND_DEBUG */ |
| 684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 685 | /* |
| 686 | * set up from the preset table |
| 687 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 688 | static void setup_preset(struct alc_spec *spec, |
| 689 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 690 | { |
| 691 | int i; |
| 692 | |
| 693 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 694 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 696 | i++) |
| 697 | spec->init_verbs[spec->num_init_verbs++] = |
| 698 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 699 | |
| 700 | spec->channel_mode = preset->channel_mode; |
| 701 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 702 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 703 | |
| 704 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 705 | |
| 706 | spec->multiout.num_dacs = preset->num_dacs; |
| 707 | spec->multiout.dac_nids = preset->dac_nids; |
| 708 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 709 | spec->multiout.hp_nid = preset->hp_nid; |
| 710 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 711 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 712 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 713 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 714 | spec->input_mux = preset->input_mux; |
| 715 | |
| 716 | spec->num_adc_nids = preset->num_adc_nids; |
| 717 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 718 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 719 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 720 | |
| 721 | spec->unsol_event = preset->unsol_event; |
| 722 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 723 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 724 | spec->loopback.amplist = preset->loopbacks; |
| 725 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 726 | } |
| 727 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 728 | /* Enable GPIO mask and set output */ |
| 729 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 730 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 731 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 732 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 733 | { } |
| 734 | }; |
| 735 | |
| 736 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 737 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 738 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 739 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 740 | { } |
| 741 | }; |
| 742 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 743 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 744 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 745 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 746 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 747 | { } |
| 748 | }; |
| 749 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 750 | static void alc_sku_automute(struct hda_codec *codec) |
| 751 | { |
| 752 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 753 | unsigned int present; |
| 754 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 755 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 756 | |
| 757 | /* need to execute and sync at first */ |
| 758 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 759 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 760 | AC_VERB_GET_PIN_SENSE, 0); |
| 761 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 762 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 763 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | /* unsolicited event for HP jack sensing */ |
| 767 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 768 | { |
| 769 | if (codec->vendor_id == 0x10ec0880) |
| 770 | res >>= 28; |
| 771 | else |
| 772 | res >>= 26; |
| 773 | if (res != ALC880_HP_EVENT) |
| 774 | return; |
| 775 | |
| 776 | alc_sku_automute(codec); |
| 777 | } |
| 778 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 779 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 780 | * 31 ~ 16 : Manufacture ID |
| 781 | * 15 ~ 8 : SKU ID |
| 782 | * 7 ~ 0 : Assembly ID |
| 783 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 784 | */ |
| 785 | static void alc_subsystem_id(struct hda_codec *codec, |
| 786 | unsigned int porta, unsigned int porte, |
| 787 | unsigned int portd) |
| 788 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 789 | unsigned int ass, tmp, i; |
| 790 | unsigned nid; |
| 791 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 792 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 793 | ass = codec->subsystem_id & 0xffff; |
| 794 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 795 | goto do_sku; |
| 796 | |
| 797 | /* |
| 798 | * 31~30 : port conetcivity |
| 799 | * 29~21 : reserve |
| 800 | * 20 : PCBEEP input |
| 801 | * 19~16 : Check sum (15:1) |
| 802 | * 15~1 : Custom |
| 803 | * 0 : override |
| 804 | */ |
| 805 | nid = 0x1d; |
| 806 | if (codec->vendor_id == 0x10ec0260) |
| 807 | nid = 0x17; |
| 808 | ass = snd_hda_codec_read(codec, nid, 0, |
| 809 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 810 | if (!(ass & 1) && !(ass & 0x100000)) |
| 811 | return; |
| 812 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 813 | return; |
| 814 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 815 | /* check sum */ |
| 816 | tmp = 0; |
| 817 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 818 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 819 | tmp++; |
| 820 | } |
| 821 | if (((ass >> 16) & 0xf) != tmp) |
| 822 | return; |
| 823 | do_sku: |
| 824 | /* |
| 825 | * 0 : override |
| 826 | * 1 : Swap Jack |
| 827 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 828 | * 3~5 : External Amplifier control |
| 829 | * 7~6 : Reserved |
| 830 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 831 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 832 | switch (tmp) { |
| 833 | case 1: |
| 834 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 835 | break; |
| 836 | case 3: |
| 837 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 838 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 839 | case 7: |
| 840 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 841 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 842 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 843 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 844 | case 0x10ec0260: |
| 845 | snd_hda_codec_write(codec, 0x0f, 0, |
| 846 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 847 | snd_hda_codec_write(codec, 0x10, 0, |
| 848 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 849 | break; |
| 850 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 851 | case 0x10ec0267: |
| 852 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | case 0x10ec0269: |
| 854 | case 0x10ec0862: |
| 855 | case 0x10ec0662: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame^] | 856 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 857 | snd_hda_codec_write(codec, 0x14, 0, |
| 858 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 859 | snd_hda_codec_write(codec, 0x15, 0, |
| 860 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 861 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 862 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 863 | switch (codec->vendor_id) { |
| 864 | case 0x10ec0260: |
| 865 | snd_hda_codec_write(codec, 0x1a, 0, |
| 866 | AC_VERB_SET_COEF_INDEX, 7); |
| 867 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 868 | AC_VERB_GET_PROC_COEF, 0); |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_COEF_INDEX, 7); |
| 871 | snd_hda_codec_write(codec, 0x1a, 0, |
| 872 | AC_VERB_SET_PROC_COEF, |
| 873 | tmp | 0x2010); |
| 874 | break; |
| 875 | case 0x10ec0262: |
| 876 | case 0x10ec0880: |
| 877 | case 0x10ec0882: |
| 878 | case 0x10ec0883: |
| 879 | case 0x10ec0885: |
| 880 | case 0x10ec0888: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame^] | 881 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 882 | snd_hda_codec_write(codec, 0x20, 0, |
| 883 | AC_VERB_SET_COEF_INDEX, 7); |
| 884 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 885 | AC_VERB_GET_PROC_COEF, 0); |
| 886 | snd_hda_codec_write(codec, 0x20, 0, |
| 887 | AC_VERB_SET_COEF_INDEX, 7); |
| 888 | snd_hda_codec_write(codec, 0x20, 0, |
| 889 | AC_VERB_SET_PROC_COEF, |
| 890 | tmp | 0x2010); |
| 891 | break; |
| 892 | case 0x10ec0267: |
| 893 | case 0x10ec0268: |
| 894 | snd_hda_codec_write(codec, 0x20, 0, |
| 895 | AC_VERB_SET_COEF_INDEX, 7); |
| 896 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 897 | AC_VERB_GET_PROC_COEF, 0); |
| 898 | snd_hda_codec_write(codec, 0x20, 0, |
| 899 | AC_VERB_SET_COEF_INDEX, 7); |
| 900 | snd_hda_codec_write(codec, 0x20, 0, |
| 901 | AC_VERB_SET_PROC_COEF, |
| 902 | tmp | 0x3000); |
| 903 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 904 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 906 | break; |
| 907 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 908 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 909 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | * when the external headphone out jack is plugged" |
| 911 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 912 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 913 | return; |
| 914 | /* |
| 915 | * 10~8 : Jack location |
| 916 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 917 | * 14~13: Resvered |
| 918 | * 15 : 1 --> enable the function "Mute internal speaker |
| 919 | * when the external headphone out jack is plugged" |
| 920 | */ |
| 921 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 922 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 923 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 924 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 925 | else |
| 926 | return; |
| 927 | } |
| 928 | |
| 929 | if (!spec->autocfg.hp_pins[0]) { |
| 930 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 931 | if (tmp == 0) |
| 932 | spec->autocfg.hp_pins[0] = porta; |
| 933 | else if (tmp == 1) |
| 934 | spec->autocfg.hp_pins[0] = porte; |
| 935 | else if (tmp == 2) |
| 936 | spec->autocfg.hp_pins[0] = portd; |
| 937 | else |
| 938 | return; |
| 939 | } |
| 940 | |
| 941 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 942 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 943 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 944 | spec->unsol_event = alc_sku_unsol_event; |
| 945 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 946 | } |
| 947 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 948 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 949 | * Fix-up pin default configurations |
| 950 | */ |
| 951 | |
| 952 | struct alc_pincfg { |
| 953 | hda_nid_t nid; |
| 954 | u32 val; |
| 955 | }; |
| 956 | |
| 957 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 958 | const struct snd_pci_quirk *quirk, |
| 959 | const struct alc_pincfg **pinfix) |
| 960 | { |
| 961 | const struct alc_pincfg *cfg; |
| 962 | |
| 963 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 964 | if (!quirk) |
| 965 | return; |
| 966 | |
| 967 | cfg = pinfix[quirk->value]; |
| 968 | for (; cfg->nid; cfg++) { |
| 969 | int i; |
| 970 | u32 val = cfg->val; |
| 971 | for (i = 0; i < 4; i++) { |
| 972 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 973 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 974 | val & 0xff); |
| 975 | val >>= 8; |
| 976 | } |
| 977 | } |
| 978 | } |
| 979 | |
| 980 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 981 | * ALC880 3-stack model |
| 982 | * |
| 983 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 984 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 985 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 986 | */ |
| 987 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 988 | static hda_nid_t alc880_dac_nids[4] = { |
| 989 | /* front, rear, clfe, rear_surr */ |
| 990 | 0x02, 0x05, 0x04, 0x03 |
| 991 | }; |
| 992 | |
| 993 | static hda_nid_t alc880_adc_nids[3] = { |
| 994 | /* ADC0-2 */ |
| 995 | 0x07, 0x08, 0x09, |
| 996 | }; |
| 997 | |
| 998 | /* The datasheet says the node 0x07 is connected from inputs, |
| 999 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1000 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1001 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1002 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1003 | /* ADC1-2 */ |
| 1004 | 0x08, 0x09, |
| 1005 | }; |
| 1006 | |
| 1007 | #define ALC880_DIGOUT_NID 0x06 |
| 1008 | #define ALC880_DIGIN_NID 0x0a |
| 1009 | |
| 1010 | static struct hda_input_mux alc880_capture_source = { |
| 1011 | .num_items = 4, |
| 1012 | .items = { |
| 1013 | { "Mic", 0x0 }, |
| 1014 | { "Front Mic", 0x3 }, |
| 1015 | { "Line", 0x2 }, |
| 1016 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1017 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1018 | }; |
| 1019 | |
| 1020 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1021 | /* 2ch mode */ |
| 1022 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1023 | /* set line-in to input, mute it */ |
| 1024 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1025 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1026 | /* set mic-in to input vref 80%, mute it */ |
| 1027 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1028 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1029 | { } /* end */ |
| 1030 | }; |
| 1031 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1032 | /* 6ch mode */ |
| 1033 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1034 | /* set line-in to output, unmute it */ |
| 1035 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1036 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1037 | /* set mic-in to output, unmute it */ |
| 1038 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1039 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1040 | { } /* end */ |
| 1041 | }; |
| 1042 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1043 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1044 | { 2, alc880_threestack_ch2_init }, |
| 1045 | { 6, alc880_threestack_ch6_init }, |
| 1046 | }; |
| 1047 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1048 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1049 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1050 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1051 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1052 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1053 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1054 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1055 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1056 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1057 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1058 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1060 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1061 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1062 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1063 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1064 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1065 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1066 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1067 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1068 | { |
| 1069 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1070 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1071 | .info = alc_ch_mode_info, |
| 1072 | .get = alc_ch_mode_get, |
| 1073 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1074 | }, |
| 1075 | { } /* end */ |
| 1076 | }; |
| 1077 | |
| 1078 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1079 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1080 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1083 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1084 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1085 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1086 | { |
| 1087 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1088 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1089 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1090 | */ |
| 1091 | /* .name = "Capture Source", */ |
| 1092 | .name = "Input Source", |
| 1093 | .count = 3, |
| 1094 | .info = alc_mux_enum_info, |
| 1095 | .get = alc_mux_enum_get, |
| 1096 | .put = alc_mux_enum_put, |
| 1097 | }, |
| 1098 | { } /* end */ |
| 1099 | }; |
| 1100 | |
| 1101 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1102 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1103 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1104 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1105 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1106 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1107 | { |
| 1108 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1109 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1110 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1111 | */ |
| 1112 | /* .name = "Capture Source", */ |
| 1113 | .name = "Input Source", |
| 1114 | .count = 2, |
| 1115 | .info = alc_mux_enum_info, |
| 1116 | .get = alc_mux_enum_get, |
| 1117 | .put = alc_mux_enum_put, |
| 1118 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1119 | { } /* end */ |
| 1120 | }; |
| 1121 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1122 | |
| 1123 | |
| 1124 | /* |
| 1125 | * ALC880 5-stack model |
| 1126 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1127 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1128 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1129 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1130 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1131 | */ |
| 1132 | |
| 1133 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1134 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1135 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1136 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1137 | { } /* end */ |
| 1138 | }; |
| 1139 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1140 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1141 | /* 6ch mode */ |
| 1142 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1143 | /* set line-in to input, mute it */ |
| 1144 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1145 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1146 | { } /* end */ |
| 1147 | }; |
| 1148 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1149 | /* 8ch mode */ |
| 1150 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1151 | /* set line-in to output, unmute it */ |
| 1152 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1153 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1154 | { } /* end */ |
| 1155 | }; |
| 1156 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1157 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1158 | { 6, alc880_fivestack_ch6_init }, |
| 1159 | { 8, alc880_fivestack_ch8_init }, |
| 1160 | }; |
| 1161 | |
| 1162 | |
| 1163 | /* |
| 1164 | * ALC880 6-stack model |
| 1165 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1166 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1167 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1168 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1169 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1170 | */ |
| 1171 | |
| 1172 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1173 | /* front, rear, clfe, rear_surr */ |
| 1174 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1175 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1176 | |
| 1177 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1178 | .num_items = 4, |
| 1179 | .items = { |
| 1180 | { "Mic", 0x0 }, |
| 1181 | { "Front Mic", 0x1 }, |
| 1182 | { "Line", 0x2 }, |
| 1183 | { "CD", 0x4 }, |
| 1184 | }, |
| 1185 | }; |
| 1186 | |
| 1187 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1188 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1189 | { 8, NULL }, |
| 1190 | }; |
| 1191 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1192 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1193 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1194 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1195 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1196 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1197 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1198 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1199 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1200 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1201 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1202 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1203 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1204 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1205 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1206 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1207 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1208 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1209 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1210 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1211 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1212 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1213 | { |
| 1214 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1215 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1216 | .info = alc_ch_mode_info, |
| 1217 | .get = alc_ch_mode_get, |
| 1218 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1219 | }, |
| 1220 | { } /* end */ |
| 1221 | }; |
| 1222 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1223 | |
| 1224 | /* |
| 1225 | * ALC880 W810 model |
| 1226 | * |
| 1227 | * W810 has rear IO for: |
| 1228 | * Front (DAC 02) |
| 1229 | * Surround (DAC 03) |
| 1230 | * Center/LFE (DAC 04) |
| 1231 | * Digital out (06) |
| 1232 | * |
| 1233 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1234 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1235 | * |
| 1236 | * There is a variable resistor to control the speaker or headphone |
| 1237 | * volume. This is a hardware-only device without a software API. |
| 1238 | * |
| 1239 | * Plugging headphones in will disable the internal speakers. This is |
| 1240 | * implemented in hardware, not via the driver using jack sense. In |
| 1241 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1242 | * disable both the speakers and headphones. |
| 1243 | * |
| 1244 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1245 | * These may not do anything useful with this driver yet, because I |
| 1246 | * haven't setup any initialization verbs for these yet... |
| 1247 | */ |
| 1248 | |
| 1249 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1250 | /* front, rear/surround, clfe */ |
| 1251 | 0x02, 0x03, 0x04 |
| 1252 | }; |
| 1253 | |
| 1254 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1255 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1256 | { 6, NULL } |
| 1257 | }; |
| 1258 | |
| 1259 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1260 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1261 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1262 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1263 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1265 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1266 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1267 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1268 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1269 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1270 | { } /* end */ |
| 1271 | }; |
| 1272 | |
| 1273 | |
| 1274 | /* |
| 1275 | * Z710V model |
| 1276 | * |
| 1277 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1278 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1279 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1280 | */ |
| 1281 | |
| 1282 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1283 | 0x02 |
| 1284 | }; |
| 1285 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1286 | |
| 1287 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1288 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1289 | { 2, NULL } |
| 1290 | }; |
| 1291 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1292 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1293 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1294 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1295 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1296 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1297 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1298 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1299 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1300 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1301 | { } /* end */ |
| 1302 | }; |
| 1303 | |
| 1304 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1305 | /* |
| 1306 | * ALC880 F1734 model |
| 1307 | * |
| 1308 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1309 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1310 | */ |
| 1311 | |
| 1312 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1313 | 0x03 |
| 1314 | }; |
| 1315 | #define ALC880_F1734_HP_DAC 0x02 |
| 1316 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1317 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1318 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1319 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1320 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1321 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1322 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1323 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1324 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1325 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1326 | { } /* end */ |
| 1327 | }; |
| 1328 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1329 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1330 | .num_items = 2, |
| 1331 | .items = { |
| 1332 | { "Mic", 0x1 }, |
| 1333 | { "CD", 0x4 }, |
| 1334 | }, |
| 1335 | }; |
| 1336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1337 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1338 | /* |
| 1339 | * ALC880 ASUS model |
| 1340 | * |
| 1341 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1342 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1343 | * Mic = 0x18, Line = 0x1a |
| 1344 | */ |
| 1345 | |
| 1346 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1347 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1348 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1349 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1350 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1351 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1352 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1353 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1354 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1355 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1356 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1357 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1358 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1359 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1360 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1361 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1362 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1363 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1364 | { |
| 1365 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1366 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1367 | .info = alc_ch_mode_info, |
| 1368 | .get = alc_ch_mode_get, |
| 1369 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1370 | }, |
| 1371 | { } /* end */ |
| 1372 | }; |
| 1373 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1374 | /* |
| 1375 | * ALC880 ASUS W1V model |
| 1376 | * |
| 1377 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1378 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1379 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1380 | */ |
| 1381 | |
| 1382 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1383 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1384 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1385 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1386 | { } /* end */ |
| 1387 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1388 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1389 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1390 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1391 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1392 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1393 | { } /* end */ |
| 1394 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1396 | /* TCL S700 */ |
| 1397 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1398 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1399 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1400 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1401 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1402 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1405 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1406 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1407 | { |
| 1408 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1409 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1410 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1411 | */ |
| 1412 | /* .name = "Capture Source", */ |
| 1413 | .name = "Input Source", |
| 1414 | .count = 1, |
| 1415 | .info = alc_mux_enum_info, |
| 1416 | .get = alc_mux_enum_get, |
| 1417 | .put = alc_mux_enum_put, |
| 1418 | }, |
| 1419 | { } /* end */ |
| 1420 | }; |
| 1421 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1422 | /* Uniwill */ |
| 1423 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1424 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1425 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1426 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1427 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1428 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1429 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1430 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1431 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1432 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1433 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1434 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1435 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1436 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1437 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1438 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1439 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1440 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1441 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1442 | { |
| 1443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1444 | .name = "Channel Mode", |
| 1445 | .info = alc_ch_mode_info, |
| 1446 | .get = alc_ch_mode_get, |
| 1447 | .put = alc_ch_mode_put, |
| 1448 | }, |
| 1449 | { } /* end */ |
| 1450 | }; |
| 1451 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1452 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1453 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1454 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1455 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1456 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1457 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1458 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1459 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1460 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1461 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1462 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1463 | { } /* end */ |
| 1464 | }; |
| 1465 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1466 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1467 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1468 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1469 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1470 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1471 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1473 | { } /* end */ |
| 1474 | }; |
| 1475 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1476 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1477 | * virtual master controls |
| 1478 | */ |
| 1479 | |
| 1480 | /* |
| 1481 | * slave controls for virtual master |
| 1482 | */ |
| 1483 | static const char *alc_slave_vols[] = { |
| 1484 | "Front Playback Volume", |
| 1485 | "Surround Playback Volume", |
| 1486 | "Center Playback Volume", |
| 1487 | "LFE Playback Volume", |
| 1488 | "Side Playback Volume", |
| 1489 | "Headphone Playback Volume", |
| 1490 | "Speaker Playback Volume", |
| 1491 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1492 | "Line-Out Playback Volume", |
| 1493 | NULL, |
| 1494 | }; |
| 1495 | |
| 1496 | static const char *alc_slave_sws[] = { |
| 1497 | "Front Playback Switch", |
| 1498 | "Surround Playback Switch", |
| 1499 | "Center Playback Switch", |
| 1500 | "LFE Playback Switch", |
| 1501 | "Side Playback Switch", |
| 1502 | "Headphone Playback Switch", |
| 1503 | "Speaker Playback Switch", |
| 1504 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1505 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1506 | NULL, |
| 1507 | }; |
| 1508 | |
| 1509 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1510 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1511 | */ |
| 1512 | static int alc_build_controls(struct hda_codec *codec) |
| 1513 | { |
| 1514 | struct alc_spec *spec = codec->spec; |
| 1515 | int err; |
| 1516 | int i; |
| 1517 | |
| 1518 | for (i = 0; i < spec->num_mixers; i++) { |
| 1519 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1520 | if (err < 0) |
| 1521 | return err; |
| 1522 | } |
| 1523 | |
| 1524 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1525 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1526 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1527 | if (err < 0) |
| 1528 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1529 | err = snd_hda_create_spdif_share_sw(codec, |
| 1530 | &spec->multiout); |
| 1531 | if (err < 0) |
| 1532 | return err; |
| 1533 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1534 | } |
| 1535 | if (spec->dig_in_nid) { |
| 1536 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1537 | if (err < 0) |
| 1538 | return err; |
| 1539 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1540 | |
| 1541 | /* if we have no master control, let's create it */ |
| 1542 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1543 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1544 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1545 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1546 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1547 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1548 | if (err < 0) |
| 1549 | return err; |
| 1550 | } |
| 1551 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1552 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1553 | NULL, alc_slave_sws); |
| 1554 | if (err < 0) |
| 1555 | return err; |
| 1556 | } |
| 1557 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1558 | return 0; |
| 1559 | } |
| 1560 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1561 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1562 | /* |
| 1563 | * initialize the codec volumes, etc |
| 1564 | */ |
| 1565 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1566 | /* |
| 1567 | * generic initialization of ADC, input mixers and output mixers |
| 1568 | */ |
| 1569 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1570 | /* |
| 1571 | * Unmute ADC0-2 and set the default input to mic-in |
| 1572 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1573 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1574 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1575 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1576 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1577 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1578 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1579 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1580 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1581 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1582 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1583 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1584 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1585 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1592 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1593 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1594 | /* |
| 1595 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1597 | /* set vol=0 to output mixers */ |
| 1598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1600 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1601 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1602 | /* set up input amps for analog loopback */ |
| 1603 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1605 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1607 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1609 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1611 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1612 | |
| 1613 | { } |
| 1614 | }; |
| 1615 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1616 | /* |
| 1617 | * 3-stack pin configuration: |
| 1618 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1619 | */ |
| 1620 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1621 | /* |
| 1622 | * preset connection lists of input pins |
| 1623 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1624 | */ |
| 1625 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1626 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1627 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1628 | |
| 1629 | /* |
| 1630 | * Set pin mode and muting |
| 1631 | */ |
| 1632 | /* set front pin widgets 0x14 for output */ |
| 1633 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1634 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1635 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1636 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1637 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1638 | /* Mic2 (as headphone out) for HP output */ |
| 1639 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1640 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1641 | /* Line In pin widget for input */ |
| 1642 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1643 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1644 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1645 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1646 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1647 | /* CD pin widget for input */ |
| 1648 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1649 | |
| 1650 | { } |
| 1651 | }; |
| 1652 | |
| 1653 | /* |
| 1654 | * 5-stack pin configuration: |
| 1655 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1656 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1657 | */ |
| 1658 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1659 | /* |
| 1660 | * preset connection lists of input pins |
| 1661 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1662 | */ |
| 1663 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1664 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1665 | |
| 1666 | /* |
| 1667 | * Set pin mode and muting |
| 1668 | */ |
| 1669 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1671 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1672 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1673 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1674 | /* unmute pins for output (no gain on this amp) */ |
| 1675 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1677 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1678 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1679 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1680 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1681 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1682 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1683 | /* Mic2 (as headphone out) for HP output */ |
| 1684 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1685 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1686 | /* Line In pin widget for input */ |
| 1687 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1688 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1689 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1690 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1691 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1692 | /* CD pin widget for input */ |
| 1693 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1694 | |
| 1695 | { } |
| 1696 | }; |
| 1697 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1698 | /* |
| 1699 | * W810 pin configuration: |
| 1700 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1701 | */ |
| 1702 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1703 | /* hphone/speaker input selector: front DAC */ |
| 1704 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1705 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1707 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1708 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1710 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1711 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1712 | |
| 1713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1714 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1715 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1716 | { } |
| 1717 | }; |
| 1718 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1719 | /* |
| 1720 | * Z71V pin configuration: |
| 1721 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1722 | */ |
| 1723 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1724 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1725 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1726 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1727 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1728 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1729 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1730 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1731 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1732 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1733 | |
| 1734 | { } |
| 1735 | }; |
| 1736 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1737 | /* |
| 1738 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1739 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1740 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | */ |
| 1742 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1743 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1744 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1745 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1747 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1749 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1751 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1752 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1753 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1754 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1755 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1756 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1758 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1759 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1760 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1761 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1762 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1763 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1764 | { } |
| 1765 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1766 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1767 | /* |
| 1768 | * Uniwill pin configuration: |
| 1769 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1770 | * line = 0x1a |
| 1771 | */ |
| 1772 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1773 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1774 | |
| 1775 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1776 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1777 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1778 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1779 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1780 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1781 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1782 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1784 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1786 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1788 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1789 | |
| 1790 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1791 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1792 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1793 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1794 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1795 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1796 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1797 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1798 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1799 | |
| 1800 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1801 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1802 | |
| 1803 | { } |
| 1804 | }; |
| 1805 | |
| 1806 | /* |
| 1807 | * Uniwill P53 |
| 1808 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1809 | */ |
| 1810 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1811 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1812 | |
| 1813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1814 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1815 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1816 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1817 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1818 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1820 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1822 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1824 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1825 | |
| 1826 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1827 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1828 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1829 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1831 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1832 | |
| 1833 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1834 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1835 | |
| 1836 | { } |
| 1837 | }; |
| 1838 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1839 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1840 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1841 | { } |
| 1842 | }; |
| 1843 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1844 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1845 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1846 | { |
| 1847 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1848 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1849 | |
| 1850 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1851 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1852 | bits = present ? HDA_AMP_MUTE : 0; |
| 1853 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1854 | HDA_AMP_MUTE, bits); |
| 1855 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1856 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1857 | } |
| 1858 | |
| 1859 | /* auto-toggle front mic */ |
| 1860 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1861 | { |
| 1862 | unsigned int present; |
| 1863 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1864 | |
| 1865 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1866 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1867 | bits = present ? HDA_AMP_MUTE : 0; |
| 1868 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1869 | } |
| 1870 | |
| 1871 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1872 | { |
| 1873 | alc880_uniwill_hp_automute(codec); |
| 1874 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1875 | } |
| 1876 | |
| 1877 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1878 | unsigned int res) |
| 1879 | { |
| 1880 | /* Looks like the unsol event is incompatible with the standard |
| 1881 | * definition. 4bit tag is placed at 28 bit! |
| 1882 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1883 | switch (res >> 28) { |
| 1884 | case ALC880_HP_EVENT: |
| 1885 | alc880_uniwill_hp_automute(codec); |
| 1886 | break; |
| 1887 | case ALC880_MIC_EVENT: |
| 1888 | alc880_uniwill_mic_automute(codec); |
| 1889 | break; |
| 1890 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1891 | } |
| 1892 | |
| 1893 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1894 | { |
| 1895 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1896 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1897 | |
| 1898 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1899 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1900 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1901 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1902 | } |
| 1903 | |
| 1904 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1905 | { |
| 1906 | unsigned int present; |
| 1907 | |
| 1908 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1909 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1910 | present &= HDA_AMP_VOLMASK; |
| 1911 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1912 | HDA_AMP_VOLMASK, present); |
| 1913 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1914 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1915 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1916 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1917 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1918 | unsigned int res) |
| 1919 | { |
| 1920 | /* Looks like the unsol event is incompatible with the standard |
| 1921 | * definition. 4bit tag is placed at 28 bit! |
| 1922 | */ |
| 1923 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1924 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1925 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1926 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1927 | } |
| 1928 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1929 | /* |
| 1930 | * F1734 pin configuration: |
| 1931 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1932 | */ |
| 1933 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1934 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1935 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1936 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1937 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1938 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1939 | |
| 1940 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1941 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1942 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1943 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1944 | |
| 1945 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1946 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1947 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1948 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1949 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1950 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1951 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1952 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1953 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1954 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1955 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1956 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1957 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1958 | { } |
| 1959 | }; |
| 1960 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1961 | /* |
| 1962 | * ASUS pin configuration: |
| 1963 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1964 | */ |
| 1965 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1966 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1967 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1968 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1969 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1970 | |
| 1971 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1972 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1973 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1974 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1975 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1976 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1977 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1979 | |
| 1980 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1982 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1983 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1984 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1985 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1986 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1987 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1988 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1989 | |
| 1990 | { } |
| 1991 | }; |
| 1992 | |
| 1993 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1994 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1995 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1996 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1997 | /* Clevo m520g init */ |
| 1998 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1999 | /* headphone output */ |
| 2000 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2001 | /* line-out */ |
| 2002 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2004 | /* Line-in */ |
| 2005 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2006 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2007 | /* CD */ |
| 2008 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2009 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2010 | /* Mic1 (rear panel) */ |
| 2011 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2012 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2013 | /* Mic2 (front panel) */ |
| 2014 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2015 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2016 | /* headphone */ |
| 2017 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2018 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2019 | /* change to EAPD mode */ |
| 2020 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2021 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2022 | |
| 2023 | { } |
| 2024 | }; |
| 2025 | |
| 2026 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2027 | /* change to EAPD mode */ |
| 2028 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2029 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2030 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2031 | /* Headphone output */ |
| 2032 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2033 | /* Front output*/ |
| 2034 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2035 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2036 | |
| 2037 | /* Line In pin widget for input */ |
| 2038 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2039 | /* CD pin widget for input */ |
| 2040 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2041 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2042 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2043 | |
| 2044 | /* change to EAPD mode */ |
| 2045 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2046 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2047 | |
| 2048 | { } |
| 2049 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2050 | |
| 2051 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2052 | * LG m1 express dual |
| 2053 | * |
| 2054 | * Pin assignment: |
| 2055 | * Rear Line-In/Out (blue): 0x14 |
| 2056 | * Build-in Mic-In: 0x15 |
| 2057 | * Speaker-out: 0x17 |
| 2058 | * HP-Out (green): 0x1b |
| 2059 | * Mic-In/Out (red): 0x19 |
| 2060 | * SPDIF-Out: 0x1e |
| 2061 | */ |
| 2062 | |
| 2063 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2064 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2065 | 0x05, 0x02, 0x03 |
| 2066 | }; |
| 2067 | |
| 2068 | /* seems analog CD is not working */ |
| 2069 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2070 | .num_items = 3, |
| 2071 | .items = { |
| 2072 | { "Mic", 0x1 }, |
| 2073 | { "Line", 0x5 }, |
| 2074 | { "Internal Mic", 0x6 }, |
| 2075 | }, |
| 2076 | }; |
| 2077 | |
| 2078 | /* 2,4,6 channel modes */ |
| 2079 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2080 | /* set line-in and mic-in to input */ |
| 2081 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2082 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2083 | { } |
| 2084 | }; |
| 2085 | |
| 2086 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2087 | /* set line-in to out and mic-in to input */ |
| 2088 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2089 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2090 | { } |
| 2091 | }; |
| 2092 | |
| 2093 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2094 | /* set line-in and mic-in to output */ |
| 2095 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2096 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2097 | { } |
| 2098 | }; |
| 2099 | |
| 2100 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2101 | { 2, alc880_lg_ch2_init }, |
| 2102 | { 4, alc880_lg_ch4_init }, |
| 2103 | { 6, alc880_lg_ch6_init }, |
| 2104 | }; |
| 2105 | |
| 2106 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2107 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2108 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2109 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2110 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2111 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2112 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2113 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2114 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2115 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2116 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2117 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2118 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2119 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2120 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2121 | { |
| 2122 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2123 | .name = "Channel Mode", |
| 2124 | .info = alc_ch_mode_info, |
| 2125 | .get = alc_ch_mode_get, |
| 2126 | .put = alc_ch_mode_put, |
| 2127 | }, |
| 2128 | { } /* end */ |
| 2129 | }; |
| 2130 | |
| 2131 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2132 | /* set capture source to mic-in */ |
| 2133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2134 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2135 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2136 | /* mute all amp mixer inputs */ |
| 2137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2139 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2140 | /* line-in to input */ |
| 2141 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2142 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2143 | /* built-in mic */ |
| 2144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2145 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2146 | /* speaker-out */ |
| 2147 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2148 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | /* mic-in to input */ |
| 2150 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2151 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2152 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2153 | /* HP-out */ |
| 2154 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2155 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2156 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2157 | /* jack sense */ |
| 2158 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | /* toggle speaker-output according to the hp-jack state */ |
| 2163 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2164 | { |
| 2165 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2166 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2167 | |
| 2168 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2169 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2170 | bits = present ? HDA_AMP_MUTE : 0; |
| 2171 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2172 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2173 | } |
| 2174 | |
| 2175 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2176 | { |
| 2177 | /* Looks like the unsol event is incompatible with the standard |
| 2178 | * definition. 4bit tag is placed at 28 bit! |
| 2179 | */ |
| 2180 | if ((res >> 28) == 0x01) |
| 2181 | alc880_lg_automute(codec); |
| 2182 | } |
| 2183 | |
| 2184 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2185 | * LG LW20 |
| 2186 | * |
| 2187 | * Pin assignment: |
| 2188 | * Speaker-out: 0x14 |
| 2189 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2190 | * Built-in Mic-In: 0x19 |
| 2191 | * Line-In: 0x1b |
| 2192 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2193 | * SPDIF-Out: 0x1e |
| 2194 | */ |
| 2195 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2196 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2197 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2198 | .items = { |
| 2199 | { "Mic", 0x0 }, |
| 2200 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2201 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2202 | }, |
| 2203 | }; |
| 2204 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2205 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2206 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2207 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2208 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2209 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2210 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2211 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2212 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2213 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2214 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2215 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2216 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2217 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2218 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2219 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2220 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2221 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2222 | { |
| 2223 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2224 | .name = "Channel Mode", |
| 2225 | .info = alc_ch_mode_info, |
| 2226 | .get = alc_ch_mode_get, |
| 2227 | .put = alc_ch_mode_put, |
| 2228 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2229 | { } /* end */ |
| 2230 | }; |
| 2231 | |
| 2232 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2233 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2234 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2235 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2236 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2237 | /* set capture source to mic-in */ |
| 2238 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2239 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2240 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2242 | /* speaker-out */ |
| 2243 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2244 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2245 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2246 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2247 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2248 | /* mic-in to input */ |
| 2249 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2250 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2251 | /* built-in mic */ |
| 2252 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2253 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2254 | /* jack sense */ |
| 2255 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2256 | { } |
| 2257 | }; |
| 2258 | |
| 2259 | /* toggle speaker-output according to the hp-jack state */ |
| 2260 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2261 | { |
| 2262 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2263 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2264 | |
| 2265 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2266 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2267 | bits = present ? HDA_AMP_MUTE : 0; |
| 2268 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2269 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2270 | } |
| 2271 | |
| 2272 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2273 | { |
| 2274 | /* Looks like the unsol event is incompatible with the standard |
| 2275 | * definition. 4bit tag is placed at 28 bit! |
| 2276 | */ |
| 2277 | if ((res >> 28) == 0x01) |
| 2278 | alc880_lg_lw_automute(codec); |
| 2279 | } |
| 2280 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2281 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2282 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2283 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2285 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2286 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2287 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2288 | { } /* end */ |
| 2289 | }; |
| 2290 | |
| 2291 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2292 | .num_items = 2, |
| 2293 | .items = { |
| 2294 | { "Mic", 0x0 }, |
| 2295 | { "Internal Mic", 0x1 }, |
| 2296 | }, |
| 2297 | }; |
| 2298 | |
| 2299 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2300 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2301 | |
| 2302 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2303 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2304 | |
| 2305 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2306 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2307 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2308 | /* Mic2 (as headphone out) for HP output */ |
| 2309 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2310 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2311 | /* Internal Speaker */ |
| 2312 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2313 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2314 | |
| 2315 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2316 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2317 | |
| 2318 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2319 | { } |
| 2320 | }; |
| 2321 | |
| 2322 | /* toggle speaker-output according to the hp-jack state */ |
| 2323 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2324 | { |
| 2325 | unsigned int present; |
| 2326 | unsigned char bits; |
| 2327 | |
| 2328 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2329 | AC_VERB_GET_PIN_SENSE, 0) |
| 2330 | & AC_PINSENSE_PRESENCE; |
| 2331 | bits = present ? HDA_AMP_MUTE : 0; |
| 2332 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2333 | HDA_AMP_MUTE, bits); |
| 2334 | if (present) |
| 2335 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2336 | else |
| 2337 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2338 | } |
| 2339 | |
| 2340 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2341 | unsigned int res) |
| 2342 | { |
| 2343 | /* Looks like the unsol event is incompatible with the standard |
| 2344 | * definition. 4bit tag is placed at 28 bit! |
| 2345 | */ |
| 2346 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2347 | alc880_medion_rim_automute(codec); |
| 2348 | } |
| 2349 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2350 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2351 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2352 | { 0x0b, HDA_INPUT, 0 }, |
| 2353 | { 0x0b, HDA_INPUT, 1 }, |
| 2354 | { 0x0b, HDA_INPUT, 2 }, |
| 2355 | { 0x0b, HDA_INPUT, 3 }, |
| 2356 | { 0x0b, HDA_INPUT, 4 }, |
| 2357 | { } /* end */ |
| 2358 | }; |
| 2359 | |
| 2360 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2361 | { 0x0b, HDA_INPUT, 1 }, |
| 2362 | { 0x0b, HDA_INPUT, 6 }, |
| 2363 | { 0x0b, HDA_INPUT, 7 }, |
| 2364 | { } /* end */ |
| 2365 | }; |
| 2366 | #endif |
| 2367 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2368 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2369 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2370 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2371 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2372 | static int alc_init(struct hda_codec *codec) |
| 2373 | { |
| 2374 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2375 | unsigned int i; |
| 2376 | |
| 2377 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2378 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2379 | |
| 2380 | if (spec->init_hook) |
| 2381 | spec->init_hook(codec); |
| 2382 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2383 | return 0; |
| 2384 | } |
| 2385 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2386 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2387 | { |
| 2388 | struct alc_spec *spec = codec->spec; |
| 2389 | |
| 2390 | if (spec->unsol_event) |
| 2391 | spec->unsol_event(codec, res); |
| 2392 | } |
| 2393 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2394 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2395 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2396 | { |
| 2397 | struct alc_spec *spec = codec->spec; |
| 2398 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2399 | } |
| 2400 | #endif |
| 2401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2402 | /* |
| 2403 | * Analog playback callbacks |
| 2404 | */ |
| 2405 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2406 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2407 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2408 | { |
| 2409 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2410 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2411 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2412 | } |
| 2413 | |
| 2414 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2415 | struct hda_codec *codec, |
| 2416 | unsigned int stream_tag, |
| 2417 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2418 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2419 | { |
| 2420 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2421 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2422 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2423 | } |
| 2424 | |
| 2425 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2426 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2427 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2428 | { |
| 2429 | struct alc_spec *spec = codec->spec; |
| 2430 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2431 | } |
| 2432 | |
| 2433 | /* |
| 2434 | * Digital out |
| 2435 | */ |
| 2436 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2437 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2438 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2439 | { |
| 2440 | struct alc_spec *spec = codec->spec; |
| 2441 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2442 | } |
| 2443 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2444 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2445 | struct hda_codec *codec, |
| 2446 | unsigned int stream_tag, |
| 2447 | unsigned int format, |
| 2448 | struct snd_pcm_substream *substream) |
| 2449 | { |
| 2450 | struct alc_spec *spec = codec->spec; |
| 2451 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2452 | stream_tag, format, substream); |
| 2453 | } |
| 2454 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2455 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2456 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2457 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2458 | { |
| 2459 | struct alc_spec *spec = codec->spec; |
| 2460 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2461 | } |
| 2462 | |
| 2463 | /* |
| 2464 | * Analog capture |
| 2465 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2466 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2467 | struct hda_codec *codec, |
| 2468 | unsigned int stream_tag, |
| 2469 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2470 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2471 | { |
| 2472 | struct alc_spec *spec = codec->spec; |
| 2473 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2474 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2475 | stream_tag, 0, format); |
| 2476 | return 0; |
| 2477 | } |
| 2478 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2479 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2480 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2481 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2482 | { |
| 2483 | struct alc_spec *spec = codec->spec; |
| 2484 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2485 | snd_hda_codec_cleanup_stream(codec, |
| 2486 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2487 | return 0; |
| 2488 | } |
| 2489 | |
| 2490 | |
| 2491 | /* |
| 2492 | */ |
| 2493 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2494 | .substreams = 1, |
| 2495 | .channels_min = 2, |
| 2496 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2497 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | .ops = { |
| 2499 | .open = alc880_playback_pcm_open, |
| 2500 | .prepare = alc880_playback_pcm_prepare, |
| 2501 | .cleanup = alc880_playback_pcm_cleanup |
| 2502 | }, |
| 2503 | }; |
| 2504 | |
| 2505 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2506 | .substreams = 1, |
| 2507 | .channels_min = 2, |
| 2508 | .channels_max = 2, |
| 2509 | /* NID is set in alc_build_pcms */ |
| 2510 | }; |
| 2511 | |
| 2512 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2513 | .substreams = 1, |
| 2514 | .channels_min = 2, |
| 2515 | .channels_max = 2, |
| 2516 | /* NID is set in alc_build_pcms */ |
| 2517 | }; |
| 2518 | |
| 2519 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2520 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2521 | .channels_min = 2, |
| 2522 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2523 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2524 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2525 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2526 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2527 | }, |
| 2528 | }; |
| 2529 | |
| 2530 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2531 | .substreams = 1, |
| 2532 | .channels_min = 2, |
| 2533 | .channels_max = 2, |
| 2534 | /* NID is set in alc_build_pcms */ |
| 2535 | .ops = { |
| 2536 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2537 | .close = alc880_dig_playback_pcm_close, |
| 2538 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2539 | }, |
| 2540 | }; |
| 2541 | |
| 2542 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2543 | .substreams = 1, |
| 2544 | .channels_min = 2, |
| 2545 | .channels_max = 2, |
| 2546 | /* NID is set in alc_build_pcms */ |
| 2547 | }; |
| 2548 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2549 | /* Used by alc_build_pcms to flag that a PCM has no playback stream */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2550 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2551 | .substreams = 0, |
| 2552 | .channels_min = 0, |
| 2553 | .channels_max = 0, |
| 2554 | }; |
| 2555 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2556 | static int alc_build_pcms(struct hda_codec *codec) |
| 2557 | { |
| 2558 | struct alc_spec *spec = codec->spec; |
| 2559 | struct hda_pcm *info = spec->pcm_rec; |
| 2560 | int i; |
| 2561 | |
| 2562 | codec->num_pcms = 1; |
| 2563 | codec->pcm_info = info; |
| 2564 | |
| 2565 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2566 | if (spec->stream_analog_playback) { |
| 2567 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2568 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2569 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2570 | } |
| 2571 | if (spec->stream_analog_capture) { |
| 2572 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2573 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2574 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2575 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2576 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2577 | if (spec->channel_mode) { |
| 2578 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2579 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2580 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2581 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2582 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2583 | } |
| 2584 | } |
| 2585 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2586 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2587 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2588 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2589 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2590 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2591 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2592 | if (spec->multiout.dig_out_nid && |
| 2593 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2594 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2595 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2596 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2597 | if (spec->dig_in_nid && |
| 2598 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2599 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2600 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2601 | } |
| 2602 | } |
| 2603 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2604 | /* If the use of more than one ADC is requested for the current |
| 2605 | * model, configure a second analog capture-only PCM. |
| 2606 | */ |
| 2607 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2608 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2609 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2610 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2611 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2612 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2613 | if (spec->alt_dac_nid) { |
| 2614 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2615 | *spec->stream_analog_alt_playback; |
| 2616 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2617 | spec->alt_dac_nid; |
| 2618 | } else { |
| 2619 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2620 | alc_pcm_null_stream; |
| 2621 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2622 | } |
| 2623 | if (spec->num_adc_nids > 1) { |
| 2624 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2625 | *spec->stream_analog_alt_capture; |
| 2626 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2627 | spec->adc_nids[1]; |
| 2628 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2629 | spec->num_adc_nids - 1; |
| 2630 | } else { |
| 2631 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2632 | alc_pcm_null_stream; |
| 2633 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2634 | } |
| 2635 | } |
| 2636 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2637 | return 0; |
| 2638 | } |
| 2639 | |
| 2640 | static void alc_free(struct hda_codec *codec) |
| 2641 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2642 | struct alc_spec *spec = codec->spec; |
| 2643 | unsigned int i; |
| 2644 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2645 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2646 | return; |
| 2647 | |
| 2648 | if (spec->kctl_alloc) { |
| 2649 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2650 | kfree(spec->kctl_alloc[i].name); |
| 2651 | kfree(spec->kctl_alloc); |
| 2652 | } |
| 2653 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2654 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2655 | } |
| 2656 | |
| 2657 | /* |
| 2658 | */ |
| 2659 | static struct hda_codec_ops alc_patch_ops = { |
| 2660 | .build_controls = alc_build_controls, |
| 2661 | .build_pcms = alc_build_pcms, |
| 2662 | .init = alc_init, |
| 2663 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2664 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2665 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2666 | .check_power_status = alc_check_power_status, |
| 2667 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2668 | }; |
| 2669 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2670 | |
| 2671 | /* |
| 2672 | * Test configuration for debugging |
| 2673 | * |
| 2674 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2675 | * enum controls. |
| 2676 | */ |
| 2677 | #ifdef CONFIG_SND_DEBUG |
| 2678 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2679 | 0x02, 0x03, 0x04, 0x05 |
| 2680 | }; |
| 2681 | |
| 2682 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2683 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2684 | .items = { |
| 2685 | { "In-1", 0x0 }, |
| 2686 | { "In-2", 0x1 }, |
| 2687 | { "In-3", 0x2 }, |
| 2688 | { "In-4", 0x3 }, |
| 2689 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2690 | { "Front", 0x5 }, |
| 2691 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2692 | }, |
| 2693 | }; |
| 2694 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2695 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2696 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2697 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2698 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2699 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2700 | }; |
| 2701 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2702 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2703 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2704 | { |
| 2705 | static char *texts[] = { |
| 2706 | "N/A", "Line Out", "HP Out", |
| 2707 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2708 | }; |
| 2709 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2710 | uinfo->count = 1; |
| 2711 | uinfo->value.enumerated.items = 8; |
| 2712 | if (uinfo->value.enumerated.item >= 8) |
| 2713 | uinfo->value.enumerated.item = 7; |
| 2714 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2715 | return 0; |
| 2716 | } |
| 2717 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2718 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2719 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2720 | { |
| 2721 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2722 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2723 | unsigned int pin_ctl, item = 0; |
| 2724 | |
| 2725 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2726 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2727 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2728 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2729 | item = 2; |
| 2730 | else |
| 2731 | item = 1; |
| 2732 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2733 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2734 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2735 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2736 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2737 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2738 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2739 | } |
| 2740 | } |
| 2741 | ucontrol->value.enumerated.item[0] = item; |
| 2742 | return 0; |
| 2743 | } |
| 2744 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2745 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2746 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2747 | { |
| 2748 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2749 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2750 | static unsigned int ctls[] = { |
| 2751 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2752 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2753 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2754 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2755 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2756 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2757 | }; |
| 2758 | unsigned int old_ctl, new_ctl; |
| 2759 | |
| 2760 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2761 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2762 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2763 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2764 | int val; |
| 2765 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2766 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2767 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2768 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2769 | HDA_AMP_MUTE : 0; |
| 2770 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2771 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2772 | return 1; |
| 2773 | } |
| 2774 | return 0; |
| 2775 | } |
| 2776 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2777 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2778 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2779 | { |
| 2780 | static char *texts[] = { |
| 2781 | "Front", "Surround", "CLFE", "Side" |
| 2782 | }; |
| 2783 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2784 | uinfo->count = 1; |
| 2785 | uinfo->value.enumerated.items = 4; |
| 2786 | if (uinfo->value.enumerated.item >= 4) |
| 2787 | uinfo->value.enumerated.item = 3; |
| 2788 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2789 | return 0; |
| 2790 | } |
| 2791 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2792 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2793 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2794 | { |
| 2795 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2796 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2797 | unsigned int sel; |
| 2798 | |
| 2799 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2800 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2801 | return 0; |
| 2802 | } |
| 2803 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2804 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2805 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2806 | { |
| 2807 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2808 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2809 | unsigned int sel; |
| 2810 | |
| 2811 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2812 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2813 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2814 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2815 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2816 | return 1; |
| 2817 | } |
| 2818 | return 0; |
| 2819 | } |
| 2820 | |
| 2821 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2822 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2823 | .name = xname, \ |
| 2824 | .info = alc_test_pin_ctl_info, \ |
| 2825 | .get = alc_test_pin_ctl_get, \ |
| 2826 | .put = alc_test_pin_ctl_put, \ |
| 2827 | .private_value = nid \ |
| 2828 | } |
| 2829 | |
| 2830 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2831 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2832 | .name = xname, \ |
| 2833 | .info = alc_test_pin_src_info, \ |
| 2834 | .get = alc_test_pin_src_get, \ |
| 2835 | .put = alc_test_pin_src_put, \ |
| 2836 | .private_value = nid \ |
| 2837 | } |
| 2838 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2839 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2840 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2841 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2842 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2843 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2844 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2845 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2846 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2847 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2848 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2849 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2850 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2851 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2852 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2853 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2854 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2855 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2856 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2857 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2858 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2859 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2860 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2861 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2862 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2863 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2864 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2865 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2866 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2867 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2868 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2869 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2870 | { |
| 2871 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2872 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2873 | .info = alc_ch_mode_info, |
| 2874 | .get = alc_ch_mode_get, |
| 2875 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2876 | }, |
| 2877 | { } /* end */ |
| 2878 | }; |
| 2879 | |
| 2880 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2881 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2883 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2884 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2885 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2886 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2887 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2888 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2889 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2890 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2891 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2892 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2893 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2894 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2895 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2896 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2897 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2898 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2899 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2900 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2901 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2902 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2903 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2904 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2905 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2906 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2907 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2908 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2909 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2910 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2911 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2912 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2913 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2914 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2915 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2916 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2917 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2918 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2919 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2920 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2921 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2922 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2923 | /* Analog input/passthru */ |
| 2924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2928 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2929 | { } |
| 2930 | }; |
| 2931 | #endif |
| 2932 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2933 | /* |
| 2934 | */ |
| 2935 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2936 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2937 | [ALC880_3ST] = "3stack", |
| 2938 | [ALC880_TCL_S700] = "tcl", |
| 2939 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2940 | [ALC880_CLEVO] = "clevo", |
| 2941 | [ALC880_5ST] = "5stack", |
| 2942 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2943 | [ALC880_W810] = "w810", |
| 2944 | [ALC880_Z71V] = "z71v", |
| 2945 | [ALC880_6ST] = "6stack", |
| 2946 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2947 | [ALC880_ASUS] = "asus", |
| 2948 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2949 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2950 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2951 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2952 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2953 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2954 | [ALC880_F1734] = "F1734", |
| 2955 | [ALC880_LG] = "lg", |
| 2956 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2957 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2958 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2959 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2960 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2961 | [ALC880_AUTO] = "auto", |
| 2962 | }; |
| 2963 | |
| 2964 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2965 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2966 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2967 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2968 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2969 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2970 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2971 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2972 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2973 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2974 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2975 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2976 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2977 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2978 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2979 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2980 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2981 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2982 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2983 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2984 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2985 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 2986 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2987 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2988 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2989 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2990 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2991 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2992 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2993 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2994 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2995 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2996 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2997 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2998 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2999 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3000 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3001 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3002 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3003 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3004 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3005 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3006 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3007 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3008 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3009 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3010 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3011 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3012 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3013 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3014 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3015 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3016 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3017 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3018 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3019 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3020 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3021 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3022 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3023 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3024 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3025 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3026 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3027 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3028 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3029 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3030 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3031 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3032 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3033 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3034 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3035 | {} |
| 3036 | }; |
| 3037 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3038 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3039 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3040 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3041 | static struct alc_config_preset alc880_presets[] = { |
| 3042 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3043 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3044 | .init_verbs = { alc880_volume_init_verbs, |
| 3045 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3046 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3047 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3048 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3049 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3050 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3051 | .input_mux = &alc880_capture_source, |
| 3052 | }, |
| 3053 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3055 | .init_verbs = { alc880_volume_init_verbs, |
| 3056 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3057 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3058 | .dac_nids = alc880_dac_nids, |
| 3059 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3060 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3061 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3062 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3063 | .input_mux = &alc880_capture_source, |
| 3064 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3065 | [ALC880_TCL_S700] = { |
| 3066 | .mixers = { alc880_tcl_s700_mixer }, |
| 3067 | .init_verbs = { alc880_volume_init_verbs, |
| 3068 | alc880_pin_tcl_S700_init_verbs, |
| 3069 | alc880_gpio2_init_verbs }, |
| 3070 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3071 | .dac_nids = alc880_dac_nids, |
| 3072 | .hp_nid = 0x03, |
| 3073 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3074 | .channel_mode = alc880_2_jack_modes, |
| 3075 | .input_mux = &alc880_capture_source, |
| 3076 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3077 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3078 | .mixers = { alc880_three_stack_mixer, |
| 3079 | alc880_five_stack_mixer}, |
| 3080 | .init_verbs = { alc880_volume_init_verbs, |
| 3081 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3082 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3083 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3084 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3085 | .channel_mode = alc880_fivestack_modes, |
| 3086 | .input_mux = &alc880_capture_source, |
| 3087 | }, |
| 3088 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3089 | .mixers = { alc880_three_stack_mixer, |
| 3090 | alc880_five_stack_mixer }, |
| 3091 | .init_verbs = { alc880_volume_init_verbs, |
| 3092 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3093 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3094 | .dac_nids = alc880_dac_nids, |
| 3095 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3096 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3097 | .channel_mode = alc880_fivestack_modes, |
| 3098 | .input_mux = &alc880_capture_source, |
| 3099 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3100 | [ALC880_6ST] = { |
| 3101 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3102 | .init_verbs = { alc880_volume_init_verbs, |
| 3103 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3104 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3105 | .dac_nids = alc880_6st_dac_nids, |
| 3106 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3107 | .channel_mode = alc880_sixstack_modes, |
| 3108 | .input_mux = &alc880_6stack_capture_source, |
| 3109 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3110 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3111 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3112 | .init_verbs = { alc880_volume_init_verbs, |
| 3113 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3114 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3115 | .dac_nids = alc880_6st_dac_nids, |
| 3116 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3117 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3118 | .channel_mode = alc880_sixstack_modes, |
| 3119 | .input_mux = &alc880_6stack_capture_source, |
| 3120 | }, |
| 3121 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3122 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3123 | .init_verbs = { alc880_volume_init_verbs, |
| 3124 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3125 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3126 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3127 | .dac_nids = alc880_w810_dac_nids, |
| 3128 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3129 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3130 | .channel_mode = alc880_w810_modes, |
| 3131 | .input_mux = &alc880_capture_source, |
| 3132 | }, |
| 3133 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3134 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3135 | .init_verbs = { alc880_volume_init_verbs, |
| 3136 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3137 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3138 | .dac_nids = alc880_z71v_dac_nids, |
| 3139 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3140 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3141 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3142 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3143 | .input_mux = &alc880_capture_source, |
| 3144 | }, |
| 3145 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3146 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3147 | .init_verbs = { alc880_volume_init_verbs, |
| 3148 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3149 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3150 | .dac_nids = alc880_f1734_dac_nids, |
| 3151 | .hp_nid = 0x02, |
| 3152 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3153 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3154 | .input_mux = &alc880_f1734_capture_source, |
| 3155 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3156 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3157 | }, |
| 3158 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3159 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3160 | .init_verbs = { alc880_volume_init_verbs, |
| 3161 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3162 | alc880_gpio1_init_verbs }, |
| 3163 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3164 | .dac_nids = alc880_asus_dac_nids, |
| 3165 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3166 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3167 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3168 | .input_mux = &alc880_capture_source, |
| 3169 | }, |
| 3170 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3171 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3172 | .init_verbs = { alc880_volume_init_verbs, |
| 3173 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3174 | alc880_gpio1_init_verbs }, |
| 3175 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3176 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3177 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3178 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3179 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3180 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3181 | .input_mux = &alc880_capture_source, |
| 3182 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3183 | [ALC880_ASUS_DIG2] = { |
| 3184 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3185 | .init_verbs = { alc880_volume_init_verbs, |
| 3186 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3187 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3188 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3189 | .dac_nids = alc880_asus_dac_nids, |
| 3190 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3191 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3192 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3193 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3194 | .input_mux = &alc880_capture_source, |
| 3195 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3196 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3197 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3198 | .init_verbs = { alc880_volume_init_verbs, |
| 3199 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3200 | alc880_gpio1_init_verbs }, |
| 3201 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3202 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3203 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3204 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3205 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3206 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3207 | .input_mux = &alc880_capture_source, |
| 3208 | }, |
| 3209 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3210 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3211 | .init_verbs = { alc880_volume_init_verbs, |
| 3212 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3213 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3214 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3215 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3216 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3217 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3218 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3219 | .input_mux = &alc880_capture_source, |
| 3220 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3221 | [ALC880_UNIWILL] = { |
| 3222 | .mixers = { alc880_uniwill_mixer }, |
| 3223 | .init_verbs = { alc880_volume_init_verbs, |
| 3224 | alc880_uniwill_init_verbs }, |
| 3225 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3226 | .dac_nids = alc880_asus_dac_nids, |
| 3227 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3228 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3229 | .channel_mode = alc880_threestack_modes, |
| 3230 | .need_dac_fix = 1, |
| 3231 | .input_mux = &alc880_capture_source, |
| 3232 | .unsol_event = alc880_uniwill_unsol_event, |
| 3233 | .init_hook = alc880_uniwill_automute, |
| 3234 | }, |
| 3235 | [ALC880_UNIWILL_P53] = { |
| 3236 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3237 | .init_verbs = { alc880_volume_init_verbs, |
| 3238 | alc880_uniwill_p53_init_verbs }, |
| 3239 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3240 | .dac_nids = alc880_asus_dac_nids, |
| 3241 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3242 | .channel_mode = alc880_threestack_modes, |
| 3243 | .input_mux = &alc880_capture_source, |
| 3244 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3245 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3246 | }, |
| 3247 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3248 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3249 | alc880_pcbeep_mixer, }, |
| 3250 | .init_verbs = { alc880_volume_init_verbs, |
| 3251 | alc880_uniwill_p53_init_verbs, |
| 3252 | alc880_beep_init_verbs }, |
| 3253 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3254 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3255 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3256 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3257 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3258 | .input_mux = &alc880_capture_source, |
| 3259 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3260 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3261 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3262 | [ALC880_CLEVO] = { |
| 3263 | .mixers = { alc880_three_stack_mixer }, |
| 3264 | .init_verbs = { alc880_volume_init_verbs, |
| 3265 | alc880_pin_clevo_init_verbs }, |
| 3266 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3267 | .dac_nids = alc880_dac_nids, |
| 3268 | .hp_nid = 0x03, |
| 3269 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3270 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3271 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3272 | .input_mux = &alc880_capture_source, |
| 3273 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3274 | [ALC880_LG] = { |
| 3275 | .mixers = { alc880_lg_mixer }, |
| 3276 | .init_verbs = { alc880_volume_init_verbs, |
| 3277 | alc880_lg_init_verbs }, |
| 3278 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3279 | .dac_nids = alc880_lg_dac_nids, |
| 3280 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3281 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3282 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3283 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3284 | .input_mux = &alc880_lg_capture_source, |
| 3285 | .unsol_event = alc880_lg_unsol_event, |
| 3286 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3287 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3288 | .loopbacks = alc880_lg_loopbacks, |
| 3289 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3290 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3291 | [ALC880_LG_LW] = { |
| 3292 | .mixers = { alc880_lg_lw_mixer }, |
| 3293 | .init_verbs = { alc880_volume_init_verbs, |
| 3294 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3295 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3296 | .dac_nids = alc880_dac_nids, |
| 3297 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3298 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3299 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3300 | .input_mux = &alc880_lg_lw_capture_source, |
| 3301 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3302 | .init_hook = alc880_lg_lw_automute, |
| 3303 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3304 | [ALC880_MEDION_RIM] = { |
| 3305 | .mixers = { alc880_medion_rim_mixer }, |
| 3306 | .init_verbs = { alc880_volume_init_verbs, |
| 3307 | alc880_medion_rim_init_verbs, |
| 3308 | alc_gpio2_init_verbs }, |
| 3309 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3310 | .dac_nids = alc880_dac_nids, |
| 3311 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3312 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3313 | .channel_mode = alc880_2_jack_modes, |
| 3314 | .input_mux = &alc880_medion_rim_capture_source, |
| 3315 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3316 | .init_hook = alc880_medion_rim_automute, |
| 3317 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3318 | #ifdef CONFIG_SND_DEBUG |
| 3319 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3320 | .mixers = { alc880_test_mixer }, |
| 3321 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3322 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3323 | .dac_nids = alc880_test_dac_nids, |
| 3324 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3325 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3326 | .channel_mode = alc880_test_modes, |
| 3327 | .input_mux = &alc880_test_capture_source, |
| 3328 | }, |
| 3329 | #endif |
| 3330 | }; |
| 3331 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3332 | /* |
| 3333 | * Automatic parse of I/O pins from the BIOS configuration |
| 3334 | */ |
| 3335 | |
| 3336 | #define NUM_CONTROL_ALLOC 32 |
| 3337 | #define NUM_VERB_ALLOC 32 |
| 3338 | |
| 3339 | enum { |
| 3340 | ALC_CTL_WIDGET_VOL, |
| 3341 | ALC_CTL_WIDGET_MUTE, |
| 3342 | ALC_CTL_BIND_MUTE, |
| 3343 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3344 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3345 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3346 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3347 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3348 | }; |
| 3349 | |
| 3350 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3351 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3352 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3353 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3354 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3355 | |
| 3356 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3357 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3358 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3359 | /* array + terminator */ |
| 3360 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3361 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3362 | return -ENOMEM; |
| 3363 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3364 | memcpy(knew, spec->kctl_alloc, |
| 3365 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3366 | kfree(spec->kctl_alloc); |
| 3367 | } |
| 3368 | spec->kctl_alloc = knew; |
| 3369 | spec->num_kctl_alloc = num; |
| 3370 | } |
| 3371 | |
| 3372 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3373 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3374 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3375 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3376 | return -ENOMEM; |
| 3377 | knew->private_value = val; |
| 3378 | spec->num_kctl_used++; |
| 3379 | return 0; |
| 3380 | } |
| 3381 | |
| 3382 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3383 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3384 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3385 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3386 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3387 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3388 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3389 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3390 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3391 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3392 | #define ALC880_PIN_CD_NID 0x1c |
| 3393 | |
| 3394 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3395 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3396 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3397 | { |
| 3398 | hda_nid_t nid; |
| 3399 | int assigned[4]; |
| 3400 | int i, j; |
| 3401 | |
| 3402 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3403 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | |
| 3405 | /* check the pins hardwired to audio widget */ |
| 3406 | for (i = 0; i < cfg->line_outs; i++) { |
| 3407 | nid = cfg->line_out_pins[i]; |
| 3408 | if (alc880_is_fixed_pin(nid)) { |
| 3409 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3410 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3411 | assigned[idx] = 1; |
| 3412 | } |
| 3413 | } |
| 3414 | /* left pins can be connect to any audio widget */ |
| 3415 | for (i = 0; i < cfg->line_outs; i++) { |
| 3416 | nid = cfg->line_out_pins[i]; |
| 3417 | if (alc880_is_fixed_pin(nid)) |
| 3418 | continue; |
| 3419 | /* search for an empty channel */ |
| 3420 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3421 | if (!assigned[j]) { |
| 3422 | spec->multiout.dac_nids[i] = |
| 3423 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3424 | assigned[j] = 1; |
| 3425 | break; |
| 3426 | } |
| 3427 | } |
| 3428 | } |
| 3429 | spec->multiout.num_dacs = cfg->line_outs; |
| 3430 | return 0; |
| 3431 | } |
| 3432 | |
| 3433 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3434 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3435 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3436 | { |
| 3437 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3438 | static const char *chname[4] = { |
| 3439 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3440 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3441 | hda_nid_t nid; |
| 3442 | int i, err; |
| 3443 | |
| 3444 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3445 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3446 | continue; |
| 3447 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3448 | if (i == 2) { |
| 3449 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3450 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3451 | "Center Playback Volume", |
| 3452 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3453 | HDA_OUTPUT)); |
| 3454 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3455 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3456 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3457 | "LFE Playback Volume", |
| 3458 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3459 | HDA_OUTPUT)); |
| 3460 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3461 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3462 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3463 | "Center Playback Switch", |
| 3464 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3465 | HDA_INPUT)); |
| 3466 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3467 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3468 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3469 | "LFE Playback Switch", |
| 3470 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3471 | HDA_INPUT)); |
| 3472 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3473 | return err; |
| 3474 | } else { |
| 3475 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3476 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3477 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3478 | HDA_OUTPUT)); |
| 3479 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3480 | return err; |
| 3481 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3482 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3483 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3484 | HDA_INPUT)); |
| 3485 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3486 | return err; |
| 3487 | } |
| 3488 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3489 | return 0; |
| 3490 | } |
| 3491 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3492 | /* add playback controls for speaker and HP outputs */ |
| 3493 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3494 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3495 | { |
| 3496 | hda_nid_t nid; |
| 3497 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3498 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3499 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3500 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | return 0; |
| 3502 | |
| 3503 | if (alc880_is_fixed_pin(pin)) { |
| 3504 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3505 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3506 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3507 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3508 | else |
| 3509 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3510 | /* control HP volume/switch on the output mixer amp */ |
| 3511 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3512 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3513 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3514 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3515 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3516 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3517 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3518 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3519 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3520 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3521 | return err; |
| 3522 | } else if (alc880_is_multi_pin(pin)) { |
| 3523 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3524 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3525 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3526 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3527 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3528 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3529 | return err; |
| 3530 | } |
| 3531 | return 0; |
| 3532 | } |
| 3533 | |
| 3534 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3535 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3536 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3537 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | { |
| 3539 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3540 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3541 | |
| 3542 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3543 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3544 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3545 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3546 | return err; |
| 3547 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3548 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3549 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3550 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | return err; |
| 3552 | return 0; |
| 3553 | } |
| 3554 | |
| 3555 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3556 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3557 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3558 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3559 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3560 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3561 | |
| 3562 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3563 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3564 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3565 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3566 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3567 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3568 | if (err < 0) |
| 3569 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3570 | imux->items[imux->num_items].label = |
| 3571 | auto_pin_cfg_labels[i]; |
| 3572 | imux->items[imux->num_items].index = |
| 3573 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3574 | imux->num_items++; |
| 3575 | } |
| 3576 | } |
| 3577 | return 0; |
| 3578 | } |
| 3579 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3580 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3581 | unsigned int pin_type) |
| 3582 | { |
| 3583 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3584 | pin_type); |
| 3585 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3586 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3587 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3588 | } |
| 3589 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3590 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3591 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3592 | int dac_idx) |
| 3593 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3594 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3595 | /* need the manual connection? */ |
| 3596 | if (alc880_is_multi_pin(nid)) { |
| 3597 | struct alc_spec *spec = codec->spec; |
| 3598 | int idx = alc880_multi_pin_idx(nid); |
| 3599 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3600 | AC_VERB_SET_CONNECT_SEL, |
| 3601 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3602 | } |
| 3603 | } |
| 3604 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3605 | static int get_pin_type(int line_out_type) |
| 3606 | { |
| 3607 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3608 | return PIN_HP; |
| 3609 | else |
| 3610 | return PIN_OUT; |
| 3611 | } |
| 3612 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3613 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3614 | { |
| 3615 | struct alc_spec *spec = codec->spec; |
| 3616 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3617 | |
| 3618 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3619 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3620 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3621 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3622 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3623 | } |
| 3624 | } |
| 3625 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3626 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3627 | { |
| 3628 | struct alc_spec *spec = codec->spec; |
| 3629 | hda_nid_t pin; |
| 3630 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3631 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3632 | if (pin) /* connect to front */ |
| 3633 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3634 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3635 | if (pin) /* connect to front */ |
| 3636 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3637 | } |
| 3638 | |
| 3639 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3640 | { |
| 3641 | struct alc_spec *spec = codec->spec; |
| 3642 | int i; |
| 3643 | |
| 3644 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3645 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3646 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3647 | snd_hda_codec_write(codec, nid, 0, |
| 3648 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3649 | i <= AUTO_PIN_FRONT_MIC ? |
| 3650 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3651 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3652 | snd_hda_codec_write(codec, nid, 0, |
| 3653 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3654 | AMP_OUT_MUTE); |
| 3655 | } |
| 3656 | } |
| 3657 | } |
| 3658 | |
| 3659 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3660 | /* return 1 if successful, 0 if the proper config is not found, |
| 3661 | * or a negative error code |
| 3662 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3663 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3664 | { |
| 3665 | struct alc_spec *spec = codec->spec; |
| 3666 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3667 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3668 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3669 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3670 | alc880_ignore); |
| 3671 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3672 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3673 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3674 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3675 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3676 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3677 | if (err < 0) |
| 3678 | return err; |
| 3679 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3680 | if (err < 0) |
| 3681 | return err; |
| 3682 | err = alc880_auto_create_extra_out(spec, |
| 3683 | spec->autocfg.speaker_pins[0], |
| 3684 | "Speaker"); |
| 3685 | if (err < 0) |
| 3686 | return err; |
| 3687 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3688 | "Headphone"); |
| 3689 | if (err < 0) |
| 3690 | return err; |
| 3691 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3692 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3693 | return err; |
| 3694 | |
| 3695 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3696 | |
| 3697 | if (spec->autocfg.dig_out_pin) |
| 3698 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3699 | if (spec->autocfg.dig_in_pin) |
| 3700 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3701 | |
| 3702 | if (spec->kctl_alloc) |
| 3703 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3704 | |
| 3705 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3706 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3707 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3708 | spec->input_mux = &spec->private_imux; |
| 3709 | |
| 3710 | return 1; |
| 3711 | } |
| 3712 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3713 | /* additional initialization for auto-configuration model */ |
| 3714 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3715 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3716 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3717 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3718 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3719 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3720 | if (spec->unsol_event) |
| 3721 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3722 | } |
| 3723 | |
| 3724 | /* |
| 3725 | * OK, here we have finally the patch for ALC880 |
| 3726 | */ |
| 3727 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3728 | static int patch_alc880(struct hda_codec *codec) |
| 3729 | { |
| 3730 | struct alc_spec *spec; |
| 3731 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3732 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3733 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3734 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3735 | if (spec == NULL) |
| 3736 | return -ENOMEM; |
| 3737 | |
| 3738 | codec->spec = spec; |
| 3739 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3740 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3741 | alc880_models, |
| 3742 | alc880_cfg_tbl); |
| 3743 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3744 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3745 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3746 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3747 | } |
| 3748 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3749 | if (board_config == ALC880_AUTO) { |
| 3750 | /* automatic parse from the BIOS config */ |
| 3751 | err = alc880_parse_auto_config(codec); |
| 3752 | if (err < 0) { |
| 3753 | alc_free(codec); |
| 3754 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3755 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3756 | printk(KERN_INFO |
| 3757 | "hda_codec: Cannot set up configuration " |
| 3758 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3759 | board_config = ALC880_3ST; |
| 3760 | } |
| 3761 | } |
| 3762 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3763 | if (board_config != ALC880_AUTO) |
| 3764 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3765 | |
| 3766 | spec->stream_name_analog = "ALC880 Analog"; |
| 3767 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3768 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3769 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3770 | |
| 3771 | spec->stream_name_digital = "ALC880 Digital"; |
| 3772 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3773 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3774 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3775 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3776 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3777 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3778 | /* get type */ |
| 3779 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3780 | if (wcap != AC_WID_AUD_IN) { |
| 3781 | spec->adc_nids = alc880_adc_nids_alt; |
| 3782 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3783 | spec->mixers[spec->num_mixers] = |
| 3784 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3785 | spec->num_mixers++; |
| 3786 | } else { |
| 3787 | spec->adc_nids = alc880_adc_nids; |
| 3788 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3789 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3790 | spec->num_mixers++; |
| 3791 | } |
| 3792 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3793 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3794 | spec->vmaster_nid = 0x0c; |
| 3795 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3796 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3797 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3798 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3799 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3800 | if (!spec->loopback.amplist) |
| 3801 | spec->loopback.amplist = alc880_loopbacks; |
| 3802 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3803 | |
| 3804 | return 0; |
| 3805 | } |
| 3806 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3807 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3808 | /* |
| 3809 | * ALC260 support |
| 3810 | */ |
| 3811 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3812 | static hda_nid_t alc260_dac_nids[1] = { |
| 3813 | /* front */ |
| 3814 | 0x02, |
| 3815 | }; |
| 3816 | |
| 3817 | static hda_nid_t alc260_adc_nids[1] = { |
| 3818 | /* ADC0 */ |
| 3819 | 0x04, |
| 3820 | }; |
| 3821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3822 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3823 | /* ADC1 */ |
| 3824 | 0x05, |
| 3825 | }; |
| 3826 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3827 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3828 | /* ADC1, 0 */ |
| 3829 | 0x05, 0x04 |
| 3830 | }; |
| 3831 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3832 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3833 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3834 | */ |
| 3835 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3836 | /* ADC0, ADC1 */ |
| 3837 | 0x04, 0x05 |
| 3838 | }; |
| 3839 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3840 | #define ALC260_DIGOUT_NID 0x03 |
| 3841 | #define ALC260_DIGIN_NID 0x06 |
| 3842 | |
| 3843 | static struct hda_input_mux alc260_capture_source = { |
| 3844 | .num_items = 4, |
| 3845 | .items = { |
| 3846 | { "Mic", 0x0 }, |
| 3847 | { "Front Mic", 0x1 }, |
| 3848 | { "Line", 0x2 }, |
| 3849 | { "CD", 0x4 }, |
| 3850 | }, |
| 3851 | }; |
| 3852 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3853 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3854 | * headphone jack and the internal CD lines since these are the only pins at |
| 3855 | * which audio can appear. For flexibility, also allow the option of |
| 3856 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3857 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3858 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3859 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3860 | { |
| 3861 | .num_items = 3, |
| 3862 | .items = { |
| 3863 | { "Mic/Line", 0x0 }, |
| 3864 | { "CD", 0x4 }, |
| 3865 | { "Headphone", 0x2 }, |
| 3866 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3867 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3868 | { |
| 3869 | .num_items = 4, |
| 3870 | .items = { |
| 3871 | { "Mic/Line", 0x0 }, |
| 3872 | { "CD", 0x4 }, |
| 3873 | { "Headphone", 0x2 }, |
| 3874 | { "Mixer", 0x5 }, |
| 3875 | }, |
| 3876 | }, |
| 3877 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3878 | }; |
| 3879 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3880 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3881 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3882 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3883 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3884 | { |
| 3885 | .num_items = 4, |
| 3886 | .items = { |
| 3887 | { "Mic", 0x0 }, |
| 3888 | { "Line", 0x2 }, |
| 3889 | { "CD", 0x4 }, |
| 3890 | { "Headphone", 0x5 }, |
| 3891 | }, |
| 3892 | }, |
| 3893 | { |
| 3894 | .num_items = 5, |
| 3895 | .items = { |
| 3896 | { "Mic", 0x0 }, |
| 3897 | { "Line", 0x2 }, |
| 3898 | { "CD", 0x4 }, |
| 3899 | { "Headphone", 0x6 }, |
| 3900 | { "Mixer", 0x5 }, |
| 3901 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3902 | }, |
| 3903 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3904 | /* |
| 3905 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3906 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3907 | * element which allows changing the channel mode, so the verb list is |
| 3908 | * never used. |
| 3909 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3910 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3911 | { 2, NULL }, |
| 3912 | }; |
| 3913 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3914 | |
| 3915 | /* Mixer combinations |
| 3916 | * |
| 3917 | * basic: base_output + input + pc_beep + capture |
| 3918 | * HP: base_output + input + capture_alt |
| 3919 | * HP_3013: hp_3013 + input + capture |
| 3920 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3921 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3922 | */ |
| 3923 | |
| 3924 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3925 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3926 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3927 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3928 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3929 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3930 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3931 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3932 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3933 | |
| 3934 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3935 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3936 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3937 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3938 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3939 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3940 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3941 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3942 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3943 | { } /* end */ |
| 3944 | }; |
| 3945 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3946 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3947 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3948 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3949 | { } /* end */ |
| 3950 | }; |
| 3951 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3952 | /* update HP, line and mono out pins according to the master switch */ |
| 3953 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3954 | hda_nid_t hp, hda_nid_t line, |
| 3955 | hda_nid_t mono) |
| 3956 | { |
| 3957 | struct alc_spec *spec = codec->spec; |
| 3958 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3959 | /* change HP and line-out pins */ |
| 3960 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3961 | val); |
| 3962 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3963 | val); |
| 3964 | /* mono (speaker) depending on the HP jack sense */ |
| 3965 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3966 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3967 | val); |
| 3968 | } |
| 3969 | |
| 3970 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3971 | struct snd_ctl_elem_value *ucontrol) |
| 3972 | { |
| 3973 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3974 | struct alc_spec *spec = codec->spec; |
| 3975 | *ucontrol->value.integer.value = spec->master_sw; |
| 3976 | return 0; |
| 3977 | } |
| 3978 | |
| 3979 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3980 | struct snd_ctl_elem_value *ucontrol) |
| 3981 | { |
| 3982 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3983 | struct alc_spec *spec = codec->spec; |
| 3984 | int val = !!*ucontrol->value.integer.value; |
| 3985 | hda_nid_t hp, line, mono; |
| 3986 | |
| 3987 | if (val == spec->master_sw) |
| 3988 | return 0; |
| 3989 | spec->master_sw = val; |
| 3990 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3991 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3992 | mono = kcontrol->private_value & 0xff; |
| 3993 | alc260_hp_master_update(codec, hp, line, mono); |
| 3994 | return 1; |
| 3995 | } |
| 3996 | |
| 3997 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3998 | { |
| 3999 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4000 | .name = "Master Playback Switch", |
| 4001 | .info = snd_ctl_boolean_mono_info, |
| 4002 | .get = alc260_hp_master_sw_get, |
| 4003 | .put = alc260_hp_master_sw_put, |
| 4004 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4005 | }, |
| 4006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4007 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4008 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4009 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4010 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4011 | HDA_OUTPUT), |
| 4012 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4013 | { } /* end */ |
| 4014 | }; |
| 4015 | |
| 4016 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4017 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4018 | {}, |
| 4019 | }; |
| 4020 | |
| 4021 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4022 | { |
| 4023 | struct alc_spec *spec = codec->spec; |
| 4024 | unsigned int present; |
| 4025 | |
| 4026 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4027 | AC_VERB_GET_PIN_SENSE, 0); |
| 4028 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4029 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4030 | } |
| 4031 | |
| 4032 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4033 | { |
| 4034 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4035 | alc260_hp_automute(codec); |
| 4036 | } |
| 4037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4038 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4039 | { |
| 4040 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4041 | .name = "Master Playback Switch", |
| 4042 | .info = snd_ctl_boolean_mono_info, |
| 4043 | .get = alc260_hp_master_sw_get, |
| 4044 | .put = alc260_hp_master_sw_put, |
| 4045 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4046 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4047 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4048 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4049 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4050 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4051 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4052 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4053 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4054 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4055 | { } /* end */ |
| 4056 | }; |
| 4057 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4058 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4059 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4060 | {}, |
| 4061 | }; |
| 4062 | |
| 4063 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4064 | { |
| 4065 | struct alc_spec *spec = codec->spec; |
| 4066 | unsigned int present; |
| 4067 | |
| 4068 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4069 | AC_VERB_GET_PIN_SENSE, 0); |
| 4070 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4071 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4072 | } |
| 4073 | |
| 4074 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4075 | unsigned int res) |
| 4076 | { |
| 4077 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4078 | alc260_hp_3013_automute(codec); |
| 4079 | } |
| 4080 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4081 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 4082 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4083 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4084 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4085 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4086 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4087 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4089 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4090 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4091 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4092 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4093 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4094 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4095 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4096 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4097 | { } /* end */ |
| 4098 | }; |
| 4099 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4100 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4101 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4102 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4103 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4104 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4105 | * revisions available in early 2006. Therefore for now allow the |
| 4106 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4107 | * that the lack of mic bias for this NID is intentional we could change the |
| 4108 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4109 | * |
| 4110 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4111 | * don't appear to make the mic bias available from the "line" jack, even |
| 4112 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4113 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4114 | * and the output jack. If this turns out to be the case for all such |
| 4115 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4116 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4117 | * |
| 4118 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4119 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4120 | * controls for such models. On models without a "mono speaker" the control |
| 4121 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4122 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4123 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4124 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4125 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4126 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4127 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4128 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4129 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4130 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4131 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4132 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4133 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4134 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4135 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4136 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4137 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4138 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4139 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4140 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4141 | { } /* end */ |
| 4142 | }; |
| 4143 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4144 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4145 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4146 | */ |
| 4147 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4148 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4149 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4150 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4151 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4152 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4153 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4154 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4155 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4156 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4157 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4158 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4159 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4160 | { } /* end */ |
| 4161 | }; |
| 4162 | |
| 4163 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4164 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4165 | */ |
| 4166 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4167 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4168 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4169 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4170 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4171 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4172 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4173 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4174 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4175 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4176 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4177 | { } /* end */ |
| 4178 | }; |
| 4179 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4180 | /* capture mixer elements */ |
| 4181 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4182 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4183 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4184 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4185 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4186 | { |
| 4187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4188 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4189 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4190 | */ |
| 4191 | /* .name = "Capture Source", */ |
| 4192 | .name = "Input Source", |
| 4193 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4194 | .info = alc_mux_enum_info, |
| 4195 | .get = alc_mux_enum_get, |
| 4196 | .put = alc_mux_enum_put, |
| 4197 | }, |
| 4198 | { } /* end */ |
| 4199 | }; |
| 4200 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4201 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4202 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4203 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4204 | { |
| 4205 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4206 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4207 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4208 | */ |
| 4209 | /* .name = "Capture Source", */ |
| 4210 | .name = "Input Source", |
| 4211 | .count = 1, |
| 4212 | .info = alc_mux_enum_info, |
| 4213 | .get = alc_mux_enum_get, |
| 4214 | .put = alc_mux_enum_put, |
| 4215 | }, |
| 4216 | { } /* end */ |
| 4217 | }; |
| 4218 | |
| 4219 | /* |
| 4220 | * initialization verbs |
| 4221 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4222 | static struct hda_verb alc260_init_verbs[] = { |
| 4223 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4224 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4225 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4226 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4227 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4228 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4229 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4230 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4231 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4232 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4233 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4234 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4235 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4236 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4237 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4238 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4239 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4240 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4241 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4242 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4243 | /* set connection select to line in (default select for this ADC) */ |
| 4244 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4245 | /* mute capture amp left and right */ |
| 4246 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4247 | /* set connection select to line in (default select for this ADC) */ |
| 4248 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4249 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4250 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4251 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4252 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4253 | /* set vol=0 HP mixer amp left and right */ |
| 4254 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4255 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4256 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4257 | /* set vol=0 Mono mixer amp left and right */ |
| 4258 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4259 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4260 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4261 | /* unmute LINE-2 out pin */ |
| 4262 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4263 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4264 | * Line In 2 = 0x03 |
| 4265 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4266 | /* mute analog inputs */ |
| 4267 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4268 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4269 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4271 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4272 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4273 | /* mute Front out path */ |
| 4274 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4275 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4276 | /* mute Headphone out path */ |
| 4277 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4278 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4279 | /* mute Mono out path */ |
| 4280 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4281 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4282 | { } |
| 4283 | }; |
| 4284 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4285 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4286 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4287 | /* Headphone and output */ |
| 4288 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4289 | /* mono output */ |
| 4290 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4291 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4292 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4293 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4294 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4295 | /* Line In pin widget for input */ |
| 4296 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4297 | /* Line-2 pin widget for output */ |
| 4298 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4299 | /* CD pin widget for input */ |
| 4300 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4301 | /* unmute amp left and right */ |
| 4302 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4303 | /* set connection select to line in (default select for this ADC) */ |
| 4304 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4305 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4306 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4307 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4308 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4309 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4310 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4311 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4312 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4313 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4314 | * Line In 2 = 0x03 |
| 4315 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4316 | /* mute analog inputs */ |
| 4317 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4318 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4320 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4321 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4322 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4323 | /* Unmute Front out path */ |
| 4324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4326 | /* Unmute Headphone out path */ |
| 4327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4328 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4329 | /* Unmute Mono out path */ |
| 4330 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4331 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4332 | { } |
| 4333 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4334 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4335 | |
| 4336 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4337 | /* Line out and output */ |
| 4338 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4339 | /* mono output */ |
| 4340 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4341 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4342 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4343 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4344 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4345 | /* Line In pin widget for input */ |
| 4346 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4347 | /* Headphone pin widget for output */ |
| 4348 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4349 | /* CD pin widget for input */ |
| 4350 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4351 | /* unmute amp left and right */ |
| 4352 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4353 | /* set connection select to line in (default select for this ADC) */ |
| 4354 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4355 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4356 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4357 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4359 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4360 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4361 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4362 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4363 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4364 | * Line In 2 = 0x03 |
| 4365 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4366 | /* mute analog inputs */ |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4371 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4372 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4373 | /* Unmute Front out path */ |
| 4374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4375 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4376 | /* Unmute Headphone out path */ |
| 4377 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4378 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4379 | /* Unmute Mono out path */ |
| 4380 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4381 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4382 | { } |
| 4383 | }; |
| 4384 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4385 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4386 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4387 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4388 | */ |
| 4389 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4390 | /* Disable all GPIOs */ |
| 4391 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4392 | /* Internal speaker is connected to headphone pin */ |
| 4393 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4394 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4395 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4396 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4397 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4398 | /* Ensure all other unused pins are disabled and muted. */ |
| 4399 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4400 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4401 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4402 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4403 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4404 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4405 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4406 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4407 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4408 | /* Disable digital (SPDIF) pins */ |
| 4409 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4410 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4411 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4412 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4413 | * when acting as an output. |
| 4414 | */ |
| 4415 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4416 | |
| 4417 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4419 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4420 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4422 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4423 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4424 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4425 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4426 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4427 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4428 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4429 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4430 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4431 | * If the pin mode is changed by the user the pin mode control will |
| 4432 | * take care of enabling the pin's input/output buffers as needed. |
| 4433 | * Therefore there's no need to enable the input buffer at this |
| 4434 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4435 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4436 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4437 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4438 | * mixer ctrl) |
| 4439 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4440 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4441 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4442 | /* Mute capture amp left and right */ |
| 4443 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4444 | /* Set ADC connection select to match default mixer setting - line |
| 4445 | * in (on mic1 pin) |
| 4446 | */ |
| 4447 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4448 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4449 | /* Do the same for the second ADC: mute capture input amp and |
| 4450 | * set ADC connection to line in (on mic1 pin) |
| 4451 | */ |
| 4452 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4453 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4454 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4455 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4462 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4463 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4464 | |
| 4465 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4466 | }; |
| 4467 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4468 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4469 | * similar laptops (adapted from Fujitsu init verbs). |
| 4470 | */ |
| 4471 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4472 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4473 | * the headphone jack. Turn this on and rely on the standard mute |
| 4474 | * methods whenever the user wants to turn these outputs off. |
| 4475 | */ |
| 4476 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4477 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4478 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4479 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4480 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4481 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4482 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4483 | /* Line In jack is connected to Line1 pin */ |
| 4484 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4485 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4486 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4487 | /* Ensure all other unused pins are disabled and muted. */ |
| 4488 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4489 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4490 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4491 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4492 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4493 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4494 | /* Disable digital (SPDIF) pins */ |
| 4495 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4496 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4497 | |
| 4498 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4499 | * bus when acting as outputs. |
| 4500 | */ |
| 4501 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4502 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4503 | |
| 4504 | /* Start with output sum widgets muted and their output gains at min */ |
| 4505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4507 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4510 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4511 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4512 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4513 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4514 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4515 | /* Unmute Line-out pin widget amp left and right |
| 4516 | * (no equiv mixer ctrl) |
| 4517 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4518 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4519 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4520 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4521 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4522 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4523 | * will take care of enabling the pin's input/output buffers as needed. |
| 4524 | * Therefore there's no need to enable the input buffer at this |
| 4525 | * stage. |
| 4526 | */ |
| 4527 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4528 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4529 | |
| 4530 | /* Mute capture amp left and right */ |
| 4531 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4532 | /* Set ADC connection select to match default mixer setting - mic |
| 4533 | * (on mic1 pin) |
| 4534 | */ |
| 4535 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4536 | |
| 4537 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4538 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4539 | */ |
| 4540 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4541 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4542 | |
| 4543 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4552 | |
| 4553 | { } |
| 4554 | }; |
| 4555 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4556 | static struct hda_verb alc260_will_verbs[] = { |
| 4557 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4558 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4559 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4560 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4561 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4562 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4563 | {} |
| 4564 | }; |
| 4565 | |
| 4566 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4567 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4568 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4569 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4570 | |
| 4571 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4572 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4573 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4574 | |
| 4575 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4576 | {} |
| 4577 | }; |
| 4578 | |
| 4579 | /* toggle speaker-output according to the hp-jack state */ |
| 4580 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4581 | { |
| 4582 | unsigned int present; |
| 4583 | |
| 4584 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4585 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4586 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4587 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4588 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4589 | AC_VERB_SET_GPIO_DATA, 1); |
| 4590 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4591 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4592 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4593 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4594 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4595 | AC_VERB_SET_GPIO_DATA, 0); |
| 4596 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4597 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4598 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4599 | } |
| 4600 | } |
| 4601 | |
| 4602 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4603 | unsigned int res) |
| 4604 | { |
| 4605 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4606 | alc260_replacer_672v_automute(codec); |
| 4607 | } |
| 4608 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4609 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4610 | * configuration. |
| 4611 | */ |
| 4612 | #ifdef CONFIG_SND_DEBUG |
| 4613 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4614 | 0x02, |
| 4615 | }; |
| 4616 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4617 | 0x04, 0x05, |
| 4618 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4619 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4620 | * the signal assignments are different. This assumes that the first ADC |
| 4621 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4622 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4623 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4624 | { |
| 4625 | .num_items = 7, |
| 4626 | .items = { |
| 4627 | { "MIC1 pin", 0x0 }, |
| 4628 | { "MIC2 pin", 0x1 }, |
| 4629 | { "LINE1 pin", 0x2 }, |
| 4630 | { "LINE2 pin", 0x3 }, |
| 4631 | { "CD pin", 0x4 }, |
| 4632 | { "LINE-OUT pin", 0x5 }, |
| 4633 | { "HP-OUT pin", 0x6 }, |
| 4634 | }, |
| 4635 | }, |
| 4636 | { |
| 4637 | .num_items = 8, |
| 4638 | .items = { |
| 4639 | { "MIC1 pin", 0x0 }, |
| 4640 | { "MIC2 pin", 0x1 }, |
| 4641 | { "LINE1 pin", 0x2 }, |
| 4642 | { "LINE2 pin", 0x3 }, |
| 4643 | { "CD pin", 0x4 }, |
| 4644 | { "Mixer", 0x5 }, |
| 4645 | { "LINE-OUT pin", 0x6 }, |
| 4646 | { "HP-OUT pin", 0x7 }, |
| 4647 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4648 | }, |
| 4649 | }; |
| 4650 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4651 | /* Output driver widgets */ |
| 4652 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4653 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4654 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4655 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4656 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4657 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4658 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4659 | /* Modes for retasking pin widgets |
| 4660 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4661 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4662 | * mention this restriction. At this stage it's not clear whether |
| 4663 | * this behaviour is intentional or is a hardware bug in chip |
| 4664 | * revisions available at least up until early 2006. Therefore for |
| 4665 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4666 | * choices, but if it turns out that the lack of mic bias for these |
| 4667 | * NIDs is intentional we could change their modes from |
| 4668 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4669 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4670 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4671 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4672 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4673 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4674 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4675 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4676 | |
| 4677 | /* Loopback mixer controls */ |
| 4678 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4679 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4680 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4681 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4682 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4683 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4684 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4685 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4686 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4687 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4688 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4689 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4690 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4691 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4692 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4693 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4694 | |
| 4695 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4696 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4697 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4698 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4699 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4700 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4701 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4702 | * is ambigious as to which NID is which; testing on laptops which |
| 4703 | * make this output available should provide clarification. |
| 4704 | */ |
| 4705 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4706 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4707 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4708 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4709 | * this output to turn on an external amplifier. |
| 4710 | */ |
| 4711 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4712 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4713 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4714 | { } /* end */ |
| 4715 | }; |
| 4716 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4717 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4718 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4719 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4720 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4721 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4722 | /* Enable retasking pins as output, initially without power amp */ |
| 4723 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4724 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4725 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4726 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4727 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4728 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4729 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4730 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4731 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4732 | * payload also sets the generation to 0, output to be in "consumer" |
| 4733 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4734 | * control. |
| 4735 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4736 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4737 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4738 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4739 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4740 | * OUT1 sum bus when acting as an output. |
| 4741 | */ |
| 4742 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4743 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4744 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4745 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4746 | |
| 4747 | /* Start with output sum widgets muted and their output gains at min */ |
| 4748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4749 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4750 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4752 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4753 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4754 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4755 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4756 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4757 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4758 | /* Unmute retasking pin widget output buffers since the default |
| 4759 | * state appears to be output. As the pin mode is changed by the |
| 4760 | * user the pin mode control will take care of enabling the pin's |
| 4761 | * input/output buffers as needed. |
| 4762 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4763 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4764 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4765 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4766 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4767 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4768 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4769 | /* Also unmute the mono-out pin widget */ |
| 4770 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4771 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4772 | /* Mute capture amp left and right */ |
| 4773 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4774 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4775 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4776 | */ |
| 4777 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4778 | |
| 4779 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4780 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4781 | */ |
| 4782 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4783 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4784 | |
| 4785 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4793 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4794 | |
| 4795 | { } |
| 4796 | }; |
| 4797 | #endif |
| 4798 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4799 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4800 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4801 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4802 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4803 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4804 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4805 | /* |
| 4806 | * for BIOS auto-configuration |
| 4807 | */ |
| 4808 | |
| 4809 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4810 | const char *pfx) |
| 4811 | { |
| 4812 | hda_nid_t nid_vol; |
| 4813 | unsigned long vol_val, sw_val; |
| 4814 | char name[32]; |
| 4815 | int err; |
| 4816 | |
| 4817 | if (nid >= 0x0f && nid < 0x11) { |
| 4818 | nid_vol = nid - 0x7; |
| 4819 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4820 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4821 | } else if (nid == 0x11) { |
| 4822 | nid_vol = nid - 0x7; |
| 4823 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4824 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4825 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4826 | nid_vol = 0x08; |
| 4827 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4828 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4829 | } else |
| 4830 | return 0; /* N/A */ |
| 4831 | |
| 4832 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4833 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4834 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4835 | return err; |
| 4836 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4837 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4838 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4839 | return err; |
| 4840 | return 1; |
| 4841 | } |
| 4842 | |
| 4843 | /* add playback controls from the parsed DAC table */ |
| 4844 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4845 | const struct auto_pin_cfg *cfg) |
| 4846 | { |
| 4847 | hda_nid_t nid; |
| 4848 | int err; |
| 4849 | |
| 4850 | spec->multiout.num_dacs = 1; |
| 4851 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4852 | spec->multiout.dac_nids[0] = 0x02; |
| 4853 | |
| 4854 | nid = cfg->line_out_pins[0]; |
| 4855 | if (nid) { |
| 4856 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4857 | if (err < 0) |
| 4858 | return err; |
| 4859 | } |
| 4860 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4861 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4862 | if (nid) { |
| 4863 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4864 | if (err < 0) |
| 4865 | return err; |
| 4866 | } |
| 4867 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4868 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4869 | if (nid) { |
| 4870 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4871 | if (err < 0) |
| 4872 | return err; |
| 4873 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4874 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4875 | } |
| 4876 | |
| 4877 | /* create playback/capture controls for input pins */ |
| 4878 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4879 | const struct auto_pin_cfg *cfg) |
| 4880 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4881 | struct hda_input_mux *imux = &spec->private_imux; |
| 4882 | int i, err, idx; |
| 4883 | |
| 4884 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4885 | if (cfg->input_pins[i] >= 0x12) { |
| 4886 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4887 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4888 | auto_pin_cfg_labels[i], idx, |
| 4889 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4890 | if (err < 0) |
| 4891 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4892 | imux->items[imux->num_items].label = |
| 4893 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4894 | imux->items[imux->num_items].index = idx; |
| 4895 | imux->num_items++; |
| 4896 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4897 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4898 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4899 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4900 | auto_pin_cfg_labels[i], idx, |
| 4901 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4902 | if (err < 0) |
| 4903 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4904 | imux->items[imux->num_items].label = |
| 4905 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4906 | imux->items[imux->num_items].index = idx; |
| 4907 | imux->num_items++; |
| 4908 | } |
| 4909 | } |
| 4910 | return 0; |
| 4911 | } |
| 4912 | |
| 4913 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4914 | hda_nid_t nid, int pin_type, |
| 4915 | int sel_idx) |
| 4916 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4917 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4918 | /* need the manual connection? */ |
| 4919 | if (nid >= 0x12) { |
| 4920 | int idx = nid - 0x12; |
| 4921 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4922 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4923 | } |
| 4924 | } |
| 4925 | |
| 4926 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4927 | { |
| 4928 | struct alc_spec *spec = codec->spec; |
| 4929 | hda_nid_t nid; |
| 4930 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4931 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4932 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4933 | if (nid) { |
| 4934 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4935 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4936 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4937 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4938 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4939 | if (nid) |
| 4940 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4941 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4942 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4943 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4944 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4945 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | |
| 4947 | #define ALC260_PIN_CD_NID 0x16 |
| 4948 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4949 | { |
| 4950 | struct alc_spec *spec = codec->spec; |
| 4951 | int i; |
| 4952 | |
| 4953 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4954 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4955 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4956 | snd_hda_codec_write(codec, nid, 0, |
| 4957 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4958 | i <= AUTO_PIN_FRONT_MIC ? |
| 4959 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4960 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4961 | snd_hda_codec_write(codec, nid, 0, |
| 4962 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | AMP_OUT_MUTE); |
| 4964 | } |
| 4965 | } |
| 4966 | } |
| 4967 | |
| 4968 | /* |
| 4969 | * generic initialization of ADC, input mixers and output mixers |
| 4970 | */ |
| 4971 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4972 | /* |
| 4973 | * Unmute ADC0-1 and set the default input to mic-in |
| 4974 | */ |
| 4975 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4976 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4977 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4978 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4979 | |
| 4980 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4981 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4982 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4983 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4984 | */ |
| 4985 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4986 | /* mute analog inputs */ |
| 4987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4990 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4992 | |
| 4993 | /* |
| 4994 | * Set up output mixers (0x08 - 0x0a) |
| 4995 | */ |
| 4996 | /* set vol=0 to output mixers */ |
| 4997 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4998 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4999 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5000 | /* set up input amps for analog loopback */ |
| 5001 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5003 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5004 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5005 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5006 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5007 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5008 | |
| 5009 | { } |
| 5010 | }; |
| 5011 | |
| 5012 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5013 | { |
| 5014 | struct alc_spec *spec = codec->spec; |
| 5015 | unsigned int wcap; |
| 5016 | int err; |
| 5017 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5018 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5019 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5020 | alc260_ignore); |
| 5021 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5022 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5023 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5024 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5025 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5027 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5028 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5029 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | return err; |
| 5031 | |
| 5032 | spec->multiout.max_channels = 2; |
| 5033 | |
| 5034 | if (spec->autocfg.dig_out_pin) |
| 5035 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5036 | if (spec->kctl_alloc) |
| 5037 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5038 | |
| 5039 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5040 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5041 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5042 | spec->input_mux = &spec->private_imux; |
| 5043 | |
| 5044 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5045 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5046 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5047 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | spec->adc_nids = alc260_adc_nids_alt; |
| 5049 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5050 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5051 | } else { |
| 5052 | spec->adc_nids = alc260_adc_nids; |
| 5053 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5054 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5055 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5056 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5057 | |
| 5058 | return 1; |
| 5059 | } |
| 5060 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5061 | /* additional initialization for auto-configuration model */ |
| 5062 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5063 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5064 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5065 | alc260_auto_init_multi_out(codec); |
| 5066 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5067 | if (spec->unsol_event) |
| 5068 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5069 | } |
| 5070 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5071 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5072 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5073 | { 0x07, HDA_INPUT, 0 }, |
| 5074 | { 0x07, HDA_INPUT, 1 }, |
| 5075 | { 0x07, HDA_INPUT, 2 }, |
| 5076 | { 0x07, HDA_INPUT, 3 }, |
| 5077 | { 0x07, HDA_INPUT, 4 }, |
| 5078 | { } /* end */ |
| 5079 | }; |
| 5080 | #endif |
| 5081 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5082 | /* |
| 5083 | * ALC260 configurations |
| 5084 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5085 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5086 | [ALC260_BASIC] = "basic", |
| 5087 | [ALC260_HP] = "hp", |
| 5088 | [ALC260_HP_3013] = "hp-3013", |
| 5089 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5090 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5091 | [ALC260_WILL] = "will", |
| 5092 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5093 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5094 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5095 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5096 | [ALC260_AUTO] = "auto", |
| 5097 | }; |
| 5098 | |
| 5099 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5100 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5101 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5102 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5103 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5104 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5105 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5106 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5107 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5108 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5109 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5110 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5111 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5112 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5113 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5114 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5115 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5116 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5117 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5118 | {} |
| 5119 | }; |
| 5120 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5121 | static struct alc_config_preset alc260_presets[] = { |
| 5122 | [ALC260_BASIC] = { |
| 5123 | .mixers = { alc260_base_output_mixer, |
| 5124 | alc260_input_mixer, |
| 5125 | alc260_pc_beep_mixer, |
| 5126 | alc260_capture_mixer }, |
| 5127 | .init_verbs = { alc260_init_verbs }, |
| 5128 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5129 | .dac_nids = alc260_dac_nids, |
| 5130 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5131 | .adc_nids = alc260_adc_nids, |
| 5132 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5133 | .channel_mode = alc260_modes, |
| 5134 | .input_mux = &alc260_capture_source, |
| 5135 | }, |
| 5136 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5137 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5138 | alc260_input_mixer, |
| 5139 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5140 | .init_verbs = { alc260_init_verbs, |
| 5141 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5142 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5143 | .dac_nids = alc260_dac_nids, |
| 5144 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5145 | .adc_nids = alc260_hp_adc_nids, |
| 5146 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5147 | .channel_mode = alc260_modes, |
| 5148 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5149 | .unsol_event = alc260_hp_unsol_event, |
| 5150 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5151 | }, |
| 5152 | [ALC260_HP_3013] = { |
| 5153 | .mixers = { alc260_hp_3013_mixer, |
| 5154 | alc260_input_mixer, |
| 5155 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5156 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5157 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5158 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5159 | .dac_nids = alc260_dac_nids, |
| 5160 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5161 | .adc_nids = alc260_hp_adc_nids, |
| 5162 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5163 | .channel_mode = alc260_modes, |
| 5164 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5165 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5166 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5167 | }, |
| 5168 | [ALC260_FUJITSU_S702X] = { |
| 5169 | .mixers = { alc260_fujitsu_mixer, |
| 5170 | alc260_capture_mixer }, |
| 5171 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5172 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5173 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5174 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5175 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5176 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5177 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5178 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5179 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5180 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5181 | [ALC260_ACER] = { |
| 5182 | .mixers = { alc260_acer_mixer, |
| 5183 | alc260_capture_mixer }, |
| 5184 | .init_verbs = { alc260_acer_init_verbs }, |
| 5185 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5186 | .dac_nids = alc260_dac_nids, |
| 5187 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5188 | .adc_nids = alc260_dual_adc_nids, |
| 5189 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5190 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5191 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5192 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5193 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5194 | [ALC260_WILL] = { |
| 5195 | .mixers = { alc260_will_mixer, |
| 5196 | alc260_capture_mixer }, |
| 5197 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5198 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5199 | .dac_nids = alc260_dac_nids, |
| 5200 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5201 | .adc_nids = alc260_adc_nids, |
| 5202 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5203 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5204 | .channel_mode = alc260_modes, |
| 5205 | .input_mux = &alc260_capture_source, |
| 5206 | }, |
| 5207 | [ALC260_REPLACER_672V] = { |
| 5208 | .mixers = { alc260_replacer_672v_mixer, |
| 5209 | alc260_capture_mixer }, |
| 5210 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5211 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5212 | .dac_nids = alc260_dac_nids, |
| 5213 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5214 | .adc_nids = alc260_adc_nids, |
| 5215 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5216 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5217 | .channel_mode = alc260_modes, |
| 5218 | .input_mux = &alc260_capture_source, |
| 5219 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5220 | .init_hook = alc260_replacer_672v_automute, |
| 5221 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5222 | #ifdef CONFIG_SND_DEBUG |
| 5223 | [ALC260_TEST] = { |
| 5224 | .mixers = { alc260_test_mixer, |
| 5225 | alc260_capture_mixer }, |
| 5226 | .init_verbs = { alc260_test_init_verbs }, |
| 5227 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5228 | .dac_nids = alc260_test_dac_nids, |
| 5229 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5230 | .adc_nids = alc260_test_adc_nids, |
| 5231 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5232 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5233 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5234 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5235 | }, |
| 5236 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5237 | }; |
| 5238 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5239 | static int patch_alc260(struct hda_codec *codec) |
| 5240 | { |
| 5241 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5242 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5243 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5244 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5245 | if (spec == NULL) |
| 5246 | return -ENOMEM; |
| 5247 | |
| 5248 | codec->spec = spec; |
| 5249 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5250 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5251 | alc260_models, |
| 5252 | alc260_cfg_tbl); |
| 5253 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5254 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5255 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5256 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5257 | } |
| 5258 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5259 | if (board_config == ALC260_AUTO) { |
| 5260 | /* automatic parse from the BIOS config */ |
| 5261 | err = alc260_parse_auto_config(codec); |
| 5262 | if (err < 0) { |
| 5263 | alc_free(codec); |
| 5264 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5265 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5266 | printk(KERN_INFO |
| 5267 | "hda_codec: Cannot set up configuration " |
| 5268 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5269 | board_config = ALC260_BASIC; |
| 5270 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5271 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5272 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5273 | if (board_config != ALC260_AUTO) |
| 5274 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5275 | |
| 5276 | spec->stream_name_analog = "ALC260 Analog"; |
| 5277 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5278 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5279 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5280 | spec->stream_name_digital = "ALC260 Digital"; |
| 5281 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5282 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5283 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5284 | spec->vmaster_nid = 0x08; |
| 5285 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5286 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5287 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5288 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5289 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5290 | if (!spec->loopback.amplist) |
| 5291 | spec->loopback.amplist = alc260_loopbacks; |
| 5292 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5293 | |
| 5294 | return 0; |
| 5295 | } |
| 5296 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5297 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5298 | /* |
| 5299 | * ALC882 support |
| 5300 | * |
| 5301 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5302 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5303 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5304 | * 6-channel independent captures. |
| 5305 | * |
| 5306 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5307 | * driver yet). |
| 5308 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5309 | #define ALC882_DIGOUT_NID 0x06 |
| 5310 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5311 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5312 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5313 | { 8, NULL } |
| 5314 | }; |
| 5315 | |
| 5316 | static hda_nid_t alc882_dac_nids[4] = { |
| 5317 | /* front, rear, clfe, rear_surr */ |
| 5318 | 0x02, 0x03, 0x04, 0x05 |
| 5319 | }; |
| 5320 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5321 | /* identical with ALC880 */ |
| 5322 | #define alc882_adc_nids alc880_adc_nids |
| 5323 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5324 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5325 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5326 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5327 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5328 | /* input MUX */ |
| 5329 | /* FIXME: should be a matrix-type input source selection */ |
| 5330 | |
| 5331 | static struct hda_input_mux alc882_capture_source = { |
| 5332 | .num_items = 4, |
| 5333 | .items = { |
| 5334 | { "Mic", 0x0 }, |
| 5335 | { "Front Mic", 0x1 }, |
| 5336 | { "Line", 0x2 }, |
| 5337 | { "CD", 0x4 }, |
| 5338 | }, |
| 5339 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5340 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5341 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5342 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5343 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5344 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5345 | { |
| 5346 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5347 | struct alc_spec *spec = codec->spec; |
| 5348 | const struct hda_input_mux *imux = spec->input_mux; |
| 5349 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5350 | hda_nid_t nid = spec->capsrc_nids ? |
| 5351 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5352 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5353 | unsigned int i, idx; |
| 5354 | |
| 5355 | idx = ucontrol->value.enumerated.item[0]; |
| 5356 | if (idx >= imux->num_items) |
| 5357 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5358 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5359 | return 0; |
| 5360 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5361 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5362 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5363 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5364 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5365 | } |
| 5366 | *cur_val = idx; |
| 5367 | return 1; |
| 5368 | } |
| 5369 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5370 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5371 | * 2ch mode |
| 5372 | */ |
| 5373 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5374 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5375 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5376 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5377 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5378 | { } /* end */ |
| 5379 | }; |
| 5380 | |
| 5381 | /* |
| 5382 | * 6ch mode |
| 5383 | */ |
| 5384 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5385 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5386 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5387 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5388 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5389 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5390 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5391 | { } /* end */ |
| 5392 | }; |
| 5393 | |
| 5394 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5395 | { 2, alc882_3ST_ch2_init }, |
| 5396 | { 6, alc882_3ST_ch6_init }, |
| 5397 | }; |
| 5398 | |
| 5399 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5400 | * 6ch mode |
| 5401 | */ |
| 5402 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5403 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5404 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5405 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5406 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5407 | { } /* end */ |
| 5408 | }; |
| 5409 | |
| 5410 | /* |
| 5411 | * 8ch mode |
| 5412 | */ |
| 5413 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5414 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5415 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5416 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5417 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5418 | { } /* end */ |
| 5419 | }; |
| 5420 | |
| 5421 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5422 | { 6, alc882_sixstack_ch6_init }, |
| 5423 | { 8, alc882_sixstack_ch8_init }, |
| 5424 | }; |
| 5425 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5426 | /* |
| 5427 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5428 | */ |
| 5429 | |
| 5430 | /* |
| 5431 | * 2ch mode |
| 5432 | */ |
| 5433 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5434 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5435 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5436 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5437 | { } /* end */ |
| 5438 | }; |
| 5439 | |
| 5440 | /* |
| 5441 | * 6ch mode |
| 5442 | */ |
| 5443 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5444 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5445 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5446 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5447 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5448 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5449 | { } /* end */ |
| 5450 | }; |
| 5451 | |
| 5452 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5453 | { 2, alc885_mbp_ch2_init }, |
| 5454 | { 6, alc885_mbp_ch6_init }, |
| 5455 | }; |
| 5456 | |
| 5457 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5458 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5459 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5460 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5461 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5462 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5463 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5464 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5465 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5466 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5467 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5468 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5469 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5470 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5471 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5472 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5473 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5474 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5475 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5476 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5477 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5478 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5479 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5480 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5481 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5482 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5483 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5484 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5485 | { } /* end */ |
| 5486 | }; |
| 5487 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5488 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5489 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5490 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5491 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5492 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5493 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5494 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5495 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5496 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5497 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5498 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5499 | { } /* end */ |
| 5500 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5501 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5502 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5503 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5504 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5505 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5506 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5507 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5508 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5509 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5510 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5511 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5512 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5513 | { } /* end */ |
| 5514 | }; |
| 5515 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5516 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5517 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5518 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5519 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5520 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5521 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5522 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5523 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5524 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5525 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5526 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5527 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5528 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5529 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5530 | { } /* end */ |
| 5531 | }; |
| 5532 | |
| 5533 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5534 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5535 | */ |
| 5536 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5537 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5538 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5539 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5540 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5541 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5542 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5543 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5544 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5545 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5546 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5547 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5548 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5549 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5550 | { } /* end */ |
| 5551 | }; |
| 5552 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5553 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5554 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5555 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5556 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5558 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5560 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5562 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5563 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5564 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5565 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5566 | { } /* end */ |
| 5567 | }; |
| 5568 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5569 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5570 | { |
| 5571 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5572 | .name = "Channel Mode", |
| 5573 | .info = alc_ch_mode_info, |
| 5574 | .get = alc_ch_mode_get, |
| 5575 | .put = alc_ch_mode_put, |
| 5576 | }, |
| 5577 | { } /* end */ |
| 5578 | }; |
| 5579 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5580 | static struct hda_verb alc882_init_verbs[] = { |
| 5581 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5584 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5585 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5589 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5592 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5593 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5595 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5596 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5597 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5598 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5599 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5600 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5601 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5602 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5603 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5604 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5605 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5606 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5607 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5608 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5609 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5610 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5611 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5612 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5613 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5614 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5615 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5616 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5617 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5618 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5619 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5620 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5621 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5622 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5623 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5624 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5625 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5626 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5627 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5628 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5629 | |
| 5630 | /* FIXME: use matrix-type input source selection */ |
| 5631 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5632 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5633 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5634 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5635 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5636 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5637 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5638 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5639 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5640 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5641 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5642 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5646 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5647 | /* ADC1: mute amp left and right */ |
| 5648 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5649 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5650 | /* ADC2: mute amp left and right */ |
| 5651 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5652 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5653 | /* ADC3: mute amp left and right */ |
| 5654 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5655 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5656 | |
| 5657 | { } |
| 5658 | }; |
| 5659 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5660 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5661 | /* change to EAPD mode */ |
| 5662 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5663 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5664 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5665 | }; |
| 5666 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5667 | /* Mac Pro test */ |
| 5668 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5669 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5670 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5671 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5672 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5673 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5674 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5675 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5676 | { } /* end */ |
| 5677 | }; |
| 5678 | |
| 5679 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5680 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5682 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5683 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5684 | /* Front Pin: output 0 (0x0c) */ |
| 5685 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5686 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5687 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5688 | /* Front Mic pin: input vref at 80% */ |
| 5689 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5690 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5691 | /* Speaker: output */ |
| 5692 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5693 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5694 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5695 | /* Headphone output (output 0 - 0x0c) */ |
| 5696 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5697 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5698 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5699 | |
| 5700 | /* FIXME: use matrix-type input source selection */ |
| 5701 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5702 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5706 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5707 | /* Input mixer2 */ |
| 5708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5712 | /* Input mixer3 */ |
| 5713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5714 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5716 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5717 | /* ADC1: mute amp left and right */ |
| 5718 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5719 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5720 | /* ADC2: mute amp left and right */ |
| 5721 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5722 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5723 | /* ADC3: mute amp left and right */ |
| 5724 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5725 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5726 | |
| 5727 | { } |
| 5728 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5729 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5730 | /* Macbook Pro rev3 */ |
| 5731 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5732 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5735 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5736 | /* Rear mixer */ |
| 5737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5738 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5739 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5740 | /* Front Pin: output 0 (0x0c) */ |
| 5741 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5742 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5743 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5744 | /* HP Pin: output 0 (0x0d) */ |
| 5745 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5747 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5748 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5749 | /* Mic (rear) pin: input vref at 80% */ |
| 5750 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5751 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5752 | /* Front Mic pin: input vref at 80% */ |
| 5753 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5754 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5755 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5756 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5757 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5758 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5759 | |
| 5760 | /* FIXME: use matrix-type input source selection */ |
| 5761 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5762 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5765 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5766 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5767 | /* Input mixer2 */ |
| 5768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5769 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5770 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5771 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5772 | /* Input mixer3 */ |
| 5773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5777 | /* ADC1: mute amp left and right */ |
| 5778 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5779 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5780 | /* ADC2: mute amp left and right */ |
| 5781 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5782 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5783 | /* ADC3: mute amp left and right */ |
| 5784 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5785 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5786 | |
| 5787 | { } |
| 5788 | }; |
| 5789 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5790 | /* iMac 24 mixer. */ |
| 5791 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5792 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5793 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5794 | { } /* end */ |
| 5795 | }; |
| 5796 | |
| 5797 | /* iMac 24 init verbs. */ |
| 5798 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5799 | /* Internal speakers: output 0 (0x0c) */ |
| 5800 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5801 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5802 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5803 | /* Internal speakers: output 0 (0x0c) */ |
| 5804 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5805 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5806 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5807 | /* Headphone: output 0 (0x0c) */ |
| 5808 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5809 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5810 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5811 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5812 | /* Front Mic: input vref at 80% */ |
| 5813 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5814 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5815 | { } |
| 5816 | }; |
| 5817 | |
| 5818 | /* Toggle speaker-output according to the hp-jack state */ |
| 5819 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5820 | { |
| 5821 | unsigned int present; |
| 5822 | |
| 5823 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5824 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5825 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5826 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5827 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5828 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5829 | } |
| 5830 | |
| 5831 | /* Processes unsolicited events. */ |
| 5832 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5833 | unsigned int res) |
| 5834 | { |
| 5835 | /* Headphone insertion or removal. */ |
| 5836 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5837 | alc885_imac24_automute(codec); |
| 5838 | } |
| 5839 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5840 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5841 | { |
| 5842 | unsigned int present; |
| 5843 | |
| 5844 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5845 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5846 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5847 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5848 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5849 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5850 | |
| 5851 | } |
| 5852 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5853 | unsigned int res) |
| 5854 | { |
| 5855 | /* Headphone insertion or removal. */ |
| 5856 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5857 | alc885_mbp3_automute(codec); |
| 5858 | } |
| 5859 | |
| 5860 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5861 | static struct hda_verb alc882_targa_verbs[] = { |
| 5862 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5863 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5864 | |
| 5865 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5866 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5867 | |
| 5868 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5869 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5870 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5871 | |
| 5872 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5873 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5874 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5875 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5876 | { } /* end */ |
| 5877 | }; |
| 5878 | |
| 5879 | /* toggle speaker-output according to the hp-jack state */ |
| 5880 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5881 | { |
| 5882 | unsigned int present; |
| 5883 | |
| 5884 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5885 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5886 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5887 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5888 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5889 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5890 | } |
| 5891 | |
| 5892 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5893 | { |
| 5894 | /* Looks like the unsol event is incompatible with the standard |
| 5895 | * definition. 4bit tag is placed at 26 bit! |
| 5896 | */ |
| 5897 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5898 | alc882_targa_automute(codec); |
| 5899 | } |
| 5900 | } |
| 5901 | |
| 5902 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5904 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5905 | |
| 5906 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5907 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5908 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5909 | |
| 5910 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5911 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5912 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5913 | |
| 5914 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5915 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5916 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5917 | { } /* end */ |
| 5918 | }; |
| 5919 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5920 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5922 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5923 | |
| 5924 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5925 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5926 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5927 | |
| 5928 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5929 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5930 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5931 | |
| 5932 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5933 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5934 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5935 | { } /* end */ |
| 5936 | }; |
| 5937 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5938 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5939 | { |
| 5940 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5941 | |
| 5942 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5943 | AC_VERB_GET_GPIO_DATA, 0); |
| 5944 | |
| 5945 | if (!muted) |
| 5946 | gpiostate |= (1 << pin); |
| 5947 | else |
| 5948 | gpiostate &= ~(1 << pin); |
| 5949 | |
| 5950 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5951 | AC_VERB_GET_GPIO_MASK, 0); |
| 5952 | gpiomask |= (1 << pin); |
| 5953 | |
| 5954 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5955 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5956 | gpiodir |= (1 << pin); |
| 5957 | |
| 5958 | |
| 5959 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5960 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5961 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5962 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5963 | |
| 5964 | msleep(1); |
| 5965 | |
| 5966 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5967 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5968 | } |
| 5969 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5970 | /* set up GPIO at initialization */ |
| 5971 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5972 | { |
| 5973 | alc882_gpio_mute(codec, 0, 0); |
| 5974 | alc882_gpio_mute(codec, 1, 0); |
| 5975 | } |
| 5976 | |
| 5977 | /* set up GPIO and update auto-muting at initialization */ |
| 5978 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5979 | { |
| 5980 | alc885_macpro_init_hook(codec); |
| 5981 | alc885_imac24_automute(codec); |
| 5982 | } |
| 5983 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5984 | /* |
| 5985 | * generic initialization of ADC, input mixers and output mixers |
| 5986 | */ |
| 5987 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5988 | /* |
| 5989 | * Unmute ADC0-2 and set the default input to mic-in |
| 5990 | */ |
| 5991 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5992 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5993 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5994 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5995 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5996 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5997 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5998 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5999 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6000 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6001 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6002 | */ |
| 6003 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6009 | |
| 6010 | /* |
| 6011 | * Set up output mixers (0x0c - 0x0f) |
| 6012 | */ |
| 6013 | /* set vol=0 to output mixers */ |
| 6014 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6015 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6016 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6017 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6018 | /* set up input amps for analog loopback */ |
| 6019 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6021 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6023 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6026 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6027 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6028 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6029 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6030 | |
| 6031 | /* FIXME: use matrix-type input source selection */ |
| 6032 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6033 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6034 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6035 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6036 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6037 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6038 | /* Input mixer2 */ |
| 6039 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6040 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6041 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6042 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6043 | /* Input mixer3 */ |
| 6044 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6047 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6048 | |
| 6049 | { } |
| 6050 | }; |
| 6051 | |
| 6052 | /* capture mixer elements */ |
| 6053 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6054 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6055 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6056 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6057 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6058 | { |
| 6059 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6060 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6061 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6062 | */ |
| 6063 | /* .name = "Capture Source", */ |
| 6064 | .name = "Input Source", |
| 6065 | .count = 2, |
| 6066 | .info = alc882_mux_enum_info, |
| 6067 | .get = alc882_mux_enum_get, |
| 6068 | .put = alc882_mux_enum_put, |
| 6069 | }, |
| 6070 | { } /* end */ |
| 6071 | }; |
| 6072 | |
| 6073 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6074 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6075 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6076 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6077 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6078 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6079 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6080 | { |
| 6081 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6082 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6083 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6084 | */ |
| 6085 | /* .name = "Capture Source", */ |
| 6086 | .name = "Input Source", |
| 6087 | .count = 3, |
| 6088 | .info = alc882_mux_enum_info, |
| 6089 | .get = alc882_mux_enum_get, |
| 6090 | .put = alc882_mux_enum_put, |
| 6091 | }, |
| 6092 | { } /* end */ |
| 6093 | }; |
| 6094 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6095 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6096 | #define alc882_loopbacks alc880_loopbacks |
| 6097 | #endif |
| 6098 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6099 | /* pcm configuration: identiacal with ALC880 */ |
| 6100 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6101 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6102 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6103 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6104 | |
| 6105 | /* |
| 6106 | * configuration and preset |
| 6107 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6108 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6109 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6110 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6111 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6112 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6113 | [ALC882_TARGA] = "targa", |
| 6114 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6115 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6116 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6117 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6118 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6119 | [ALC882_AUTO] = "auto", |
| 6120 | }; |
| 6121 | |
| 6122 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6123 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6124 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6125 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6126 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6127 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6128 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6129 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6130 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6131 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6132 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6133 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6134 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6135 | {} |
| 6136 | }; |
| 6137 | |
| 6138 | static struct alc_config_preset alc882_presets[] = { |
| 6139 | [ALC882_3ST_DIG] = { |
| 6140 | .mixers = { alc882_base_mixer }, |
| 6141 | .init_verbs = { alc882_init_verbs }, |
| 6142 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6143 | .dac_nids = alc882_dac_nids, |
| 6144 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6145 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6146 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6147 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6148 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | .input_mux = &alc882_capture_source, |
| 6150 | }, |
| 6151 | [ALC882_6ST_DIG] = { |
| 6152 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6153 | .init_verbs = { alc882_init_verbs }, |
| 6154 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6155 | .dac_nids = alc882_dac_nids, |
| 6156 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6157 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6158 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6159 | .channel_mode = alc882_sixstack_modes, |
| 6160 | .input_mux = &alc882_capture_source, |
| 6161 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6162 | [ALC882_ARIMA] = { |
| 6163 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6164 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6166 | .dac_nids = alc882_dac_nids, |
| 6167 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6168 | .channel_mode = alc882_sixstack_modes, |
| 6169 | .input_mux = &alc882_capture_source, |
| 6170 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6171 | [ALC882_W2JC] = { |
| 6172 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6173 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6174 | alc880_gpio1_init_verbs }, |
| 6175 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6176 | .dac_nids = alc882_dac_nids, |
| 6177 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6178 | .channel_mode = alc880_threestack_modes, |
| 6179 | .need_dac_fix = 1, |
| 6180 | .input_mux = &alc882_capture_source, |
| 6181 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6182 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6183 | [ALC885_MBP3] = { |
| 6184 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6185 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6186 | alc880_gpio1_init_verbs }, |
| 6187 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6188 | .dac_nids = alc882_dac_nids, |
| 6189 | .channel_mode = alc885_mbp_6ch_modes, |
| 6190 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6191 | .input_mux = &alc882_capture_source, |
| 6192 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6193 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6194 | .unsol_event = alc885_mbp3_unsol_event, |
| 6195 | .init_hook = alc885_mbp3_automute, |
| 6196 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6197 | [ALC885_MACPRO] = { |
| 6198 | .mixers = { alc882_macpro_mixer }, |
| 6199 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6200 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6201 | .dac_nids = alc882_dac_nids, |
| 6202 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6203 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6204 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6205 | .channel_mode = alc882_ch_modes, |
| 6206 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6207 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6208 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6209 | [ALC885_IMAC24] = { |
| 6210 | .mixers = { alc885_imac24_mixer }, |
| 6211 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6212 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6213 | .dac_nids = alc882_dac_nids, |
| 6214 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6215 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6216 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6217 | .channel_mode = alc882_ch_modes, |
| 6218 | .input_mux = &alc882_capture_source, |
| 6219 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6220 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6221 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6222 | [ALC882_TARGA] = { |
| 6223 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6224 | alc882_capture_mixer }, |
| 6225 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6226 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6227 | .dac_nids = alc882_dac_nids, |
| 6228 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6229 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6230 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6231 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6232 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6233 | .channel_mode = alc882_3ST_6ch_modes, |
| 6234 | .need_dac_fix = 1, |
| 6235 | .input_mux = &alc882_capture_source, |
| 6236 | .unsol_event = alc882_targa_unsol_event, |
| 6237 | .init_hook = alc882_targa_automute, |
| 6238 | }, |
| 6239 | [ALC882_ASUS_A7J] = { |
| 6240 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6241 | alc882_capture_mixer }, |
| 6242 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6243 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6244 | .dac_nids = alc882_dac_nids, |
| 6245 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6246 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6247 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6248 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6249 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6250 | .channel_mode = alc882_3ST_6ch_modes, |
| 6251 | .need_dac_fix = 1, |
| 6252 | .input_mux = &alc882_capture_source, |
| 6253 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6254 | [ALC882_ASUS_A7M] = { |
| 6255 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6256 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6257 | alc880_gpio1_init_verbs, |
| 6258 | alc882_asus_a7m_verbs }, |
| 6259 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6260 | .dac_nids = alc882_dac_nids, |
| 6261 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6262 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6263 | .channel_mode = alc880_threestack_modes, |
| 6264 | .need_dac_fix = 1, |
| 6265 | .input_mux = &alc882_capture_source, |
| 6266 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6267 | }; |
| 6268 | |
| 6269 | |
| 6270 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6271 | * Pin config fixes |
| 6272 | */ |
| 6273 | enum { |
| 6274 | PINFIX_ABIT_AW9D_MAX |
| 6275 | }; |
| 6276 | |
| 6277 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6278 | { 0x15, 0x01080104 }, /* side */ |
| 6279 | { 0x16, 0x01011012 }, /* rear */ |
| 6280 | { 0x17, 0x01016011 }, /* clfe */ |
| 6281 | { } |
| 6282 | }; |
| 6283 | |
| 6284 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6285 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6286 | }; |
| 6287 | |
| 6288 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6289 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6290 | {} |
| 6291 | }; |
| 6292 | |
| 6293 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6294 | * BIOS auto configuration |
| 6295 | */ |
| 6296 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6297 | hda_nid_t nid, int pin_type, |
| 6298 | int dac_idx) |
| 6299 | { |
| 6300 | /* set as output */ |
| 6301 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6302 | int idx; |
| 6303 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6304 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6305 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6306 | idx = 4; |
| 6307 | else |
| 6308 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6309 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6310 | |
| 6311 | } |
| 6312 | |
| 6313 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6314 | { |
| 6315 | struct alc_spec *spec = codec->spec; |
| 6316 | int i; |
| 6317 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6318 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6319 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6320 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6321 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6322 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6323 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6324 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6325 | } |
| 6326 | } |
| 6327 | |
| 6328 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6329 | { |
| 6330 | struct alc_spec *spec = codec->spec; |
| 6331 | hda_nid_t pin; |
| 6332 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6333 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6334 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6335 | /* use dac 0 */ |
| 6336 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6337 | pin = spec->autocfg.speaker_pins[0]; |
| 6338 | if (pin) |
| 6339 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6340 | } |
| 6341 | |
| 6342 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6343 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6344 | |
| 6345 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6346 | { |
| 6347 | struct alc_spec *spec = codec->spec; |
| 6348 | int i; |
| 6349 | |
| 6350 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6351 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6352 | unsigned int vref; |
| 6353 | if (!nid) |
| 6354 | continue; |
| 6355 | vref = PIN_IN; |
| 6356 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
| 6357 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
| 6358 | AC_PINCAP_VREF_80) |
| 6359 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6360 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6361 | snd_hda_codec_write(codec, nid, 0, |
| 6362 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6363 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6364 | snd_hda_codec_write(codec, nid, 0, |
| 6365 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6366 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6367 | } |
| 6368 | } |
| 6369 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6370 | /* add mic boosts if needed */ |
| 6371 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6372 | { |
| 6373 | struct alc_spec *spec = codec->spec; |
| 6374 | int err; |
| 6375 | hda_nid_t nid; |
| 6376 | |
| 6377 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6378 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6379 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6380 | "Mic Boost", |
| 6381 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6382 | if (err < 0) |
| 6383 | return err; |
| 6384 | } |
| 6385 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6386 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6387 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6388 | "Front Mic Boost", |
| 6389 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6390 | if (err < 0) |
| 6391 | return err; |
| 6392 | } |
| 6393 | return 0; |
| 6394 | } |
| 6395 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6396 | /* almost identical with ALC880 parser... */ |
| 6397 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6398 | { |
| 6399 | struct alc_spec *spec = codec->spec; |
| 6400 | int err = alc880_parse_auto_config(codec); |
| 6401 | |
| 6402 | if (err < 0) |
| 6403 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6404 | else if (!err) |
| 6405 | return 0; /* no config found */ |
| 6406 | |
| 6407 | err = alc_auto_add_mic_boost(codec); |
| 6408 | if (err < 0) |
| 6409 | return err; |
| 6410 | |
| 6411 | /* hack - override the init verbs */ |
| 6412 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6413 | |
| 6414 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6415 | } |
| 6416 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6417 | /* additional initialization for auto-configuration model */ |
| 6418 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6419 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6420 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6421 | alc882_auto_init_multi_out(codec); |
| 6422 | alc882_auto_init_hp_out(codec); |
| 6423 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6424 | if (spec->unsol_event) |
| 6425 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6426 | } |
| 6427 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6428 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6429 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6430 | static int patch_alc882(struct hda_codec *codec) |
| 6431 | { |
| 6432 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6433 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6434 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6435 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6436 | if (spec == NULL) |
| 6437 | return -ENOMEM; |
| 6438 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6439 | codec->spec = spec; |
| 6440 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6441 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6442 | alc882_models, |
| 6443 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6444 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6445 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6446 | /* Pick up systems that don't supply PCI SSID */ |
| 6447 | switch (codec->subsystem_id) { |
| 6448 | case 0x106b0c00: /* Mac Pro */ |
| 6449 | board_config = ALC885_MACPRO; |
| 6450 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6451 | case 0x106b1000: /* iMac 24 */ |
| 6452 | board_config = ALC885_IMAC24; |
| 6453 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6454 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6455 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6456 | board_config = ALC885_MBP3; |
| 6457 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6458 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6459 | /* ALC889A is handled better as ALC888-compatible */ |
| 6460 | if (codec->revision_id == 0x100103) { |
| 6461 | alc_free(codec); |
| 6462 | return patch_alc883(codec); |
| 6463 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6464 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6465 | "trying auto-probe from BIOS...\n"); |
| 6466 | board_config = ALC882_AUTO; |
| 6467 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6468 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6469 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6470 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6471 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6472 | if (board_config == ALC882_AUTO) { |
| 6473 | /* automatic parse from the BIOS config */ |
| 6474 | err = alc882_parse_auto_config(codec); |
| 6475 | if (err < 0) { |
| 6476 | alc_free(codec); |
| 6477 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6478 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6479 | printk(KERN_INFO |
| 6480 | "hda_codec: Cannot set up configuration " |
| 6481 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6482 | board_config = ALC882_3ST_DIG; |
| 6483 | } |
| 6484 | } |
| 6485 | |
| 6486 | if (board_config != ALC882_AUTO) |
| 6487 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6488 | |
| 6489 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6490 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6491 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6492 | /* FIXME: setup DAC5 */ |
| 6493 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6494 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6495 | |
| 6496 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6497 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6498 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6499 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6500 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6501 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6502 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6503 | /* get type */ |
| 6504 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6505 | if (wcap != AC_WID_AUD_IN) { |
| 6506 | spec->adc_nids = alc882_adc_nids_alt; |
| 6507 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6508 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6509 | spec->mixers[spec->num_mixers] = |
| 6510 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6511 | spec->num_mixers++; |
| 6512 | } else { |
| 6513 | spec->adc_nids = alc882_adc_nids; |
| 6514 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6515 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6516 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6517 | spec->num_mixers++; |
| 6518 | } |
| 6519 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6520 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6521 | spec->vmaster_nid = 0x0c; |
| 6522 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6523 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6524 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6525 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6526 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6527 | if (!spec->loopback.amplist) |
| 6528 | spec->loopback.amplist = alc882_loopbacks; |
| 6529 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6530 | |
| 6531 | return 0; |
| 6532 | } |
| 6533 | |
| 6534 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6535 | * ALC883 support |
| 6536 | * |
| 6537 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6538 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6539 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6540 | * 6-channel independent captures. |
| 6541 | * |
| 6542 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6543 | * driver yet). |
| 6544 | */ |
| 6545 | #define ALC883_DIGOUT_NID 0x06 |
| 6546 | #define ALC883_DIGIN_NID 0x0a |
| 6547 | |
| 6548 | static hda_nid_t alc883_dac_nids[4] = { |
| 6549 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6550 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6551 | }; |
| 6552 | |
| 6553 | static hda_nid_t alc883_adc_nids[2] = { |
| 6554 | /* ADC1-2 */ |
| 6555 | 0x08, 0x09, |
| 6556 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6557 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6558 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6559 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6560 | /* input MUX */ |
| 6561 | /* FIXME: should be a matrix-type input source selection */ |
| 6562 | |
| 6563 | static struct hda_input_mux alc883_capture_source = { |
| 6564 | .num_items = 4, |
| 6565 | .items = { |
| 6566 | { "Mic", 0x0 }, |
| 6567 | { "Front Mic", 0x1 }, |
| 6568 | { "Line", 0x2 }, |
| 6569 | { "CD", 0x4 }, |
| 6570 | }, |
| 6571 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6572 | |
| 6573 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6574 | .num_items = 2, |
| 6575 | .items = { |
| 6576 | { "Mic", 0x1 }, |
| 6577 | { "Line", 0x2 }, |
| 6578 | }, |
| 6579 | }; |
| 6580 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6581 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6582 | .num_items = 4, |
| 6583 | .items = { |
| 6584 | { "Mic", 0x0 }, |
| 6585 | { "iMic", 0x1 }, |
| 6586 | { "Line", 0x2 }, |
| 6587 | { "CD", 0x4 }, |
| 6588 | }, |
| 6589 | }; |
| 6590 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6591 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6592 | .num_items = 2, |
| 6593 | .items = { |
| 6594 | { "Mic", 0x0 }, |
| 6595 | { "Int Mic", 0x1 }, |
| 6596 | }, |
| 6597 | }; |
| 6598 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6599 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6600 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6601 | /* ALC883 has the ALC882-type input selection */ |
| 6602 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6603 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6604 | /* |
| 6605 | * 2ch mode |
| 6606 | */ |
| 6607 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6608 | { 2, NULL } |
| 6609 | }; |
| 6610 | |
| 6611 | /* |
| 6612 | * 2ch mode |
| 6613 | */ |
| 6614 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6615 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6616 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6617 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6618 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6619 | { } /* end */ |
| 6620 | }; |
| 6621 | |
| 6622 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6623 | * 4ch mode |
| 6624 | */ |
| 6625 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6626 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6627 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6628 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6629 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6630 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6631 | { } /* end */ |
| 6632 | }; |
| 6633 | |
| 6634 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6635 | * 6ch mode |
| 6636 | */ |
| 6637 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6638 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6639 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6640 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6641 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6642 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6643 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6644 | { } /* end */ |
| 6645 | }; |
| 6646 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6647 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6648 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6649 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6650 | { 6, alc883_3ST_ch6_init }, |
| 6651 | }; |
| 6652 | |
| 6653 | /* |
| 6654 | * 6ch mode |
| 6655 | */ |
| 6656 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6657 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6658 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6659 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6660 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6661 | { } /* end */ |
| 6662 | }; |
| 6663 | |
| 6664 | /* |
| 6665 | * 8ch mode |
| 6666 | */ |
| 6667 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6668 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6669 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6670 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6671 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6672 | { } /* end */ |
| 6673 | }; |
| 6674 | |
| 6675 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6676 | { 6, alc883_sixstack_ch6_init }, |
| 6677 | { 8, alc883_sixstack_ch8_init }, |
| 6678 | }; |
| 6679 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6680 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6681 | /* eanable EAPD on medion laptop */ |
| 6682 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6683 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6684 | { } |
| 6685 | }; |
| 6686 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6687 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6688 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6689 | */ |
| 6690 | |
| 6691 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6692 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6693 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6694 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6695 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6697 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6698 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6699 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6700 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6701 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6702 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6703 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6704 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6708 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6709 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6710 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6711 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6712 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6713 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6714 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6715 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6716 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6717 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6718 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6719 | { |
| 6720 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6721 | /* .name = "Capture Source", */ |
| 6722 | .name = "Input Source", |
| 6723 | .count = 2, |
| 6724 | .info = alc883_mux_enum_info, |
| 6725 | .get = alc883_mux_enum_get, |
| 6726 | .put = alc883_mux_enum_put, |
| 6727 | }, |
| 6728 | { } /* end */ |
| 6729 | }; |
| 6730 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6731 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6732 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6733 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6734 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6735 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6736 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6737 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6738 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6739 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6740 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6741 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6742 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6743 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6744 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6745 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6746 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6747 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6748 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6749 | { |
| 6750 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6751 | /* .name = "Capture Source", */ |
| 6752 | .name = "Input Source", |
| 6753 | .count = 2, |
| 6754 | .info = alc883_mux_enum_info, |
| 6755 | .get = alc883_mux_enum_get, |
| 6756 | .put = alc883_mux_enum_put, |
| 6757 | }, |
| 6758 | { } /* end */ |
| 6759 | }; |
| 6760 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 6761 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6762 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6763 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6764 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6765 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6767 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6768 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6770 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6771 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6772 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6776 | { |
| 6777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6778 | /* .name = "Capture Source", */ |
| 6779 | .name = "Input Source", |
| 6780 | .count = 2, |
| 6781 | .info = alc883_mux_enum_info, |
| 6782 | .get = alc883_mux_enum_get, |
| 6783 | .put = alc883_mux_enum_put, |
| 6784 | }, |
| 6785 | { } /* end */ |
| 6786 | }; |
| 6787 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6788 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6789 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6790 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6791 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6792 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6794 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6797 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6798 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6799 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6800 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6801 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6802 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6803 | { |
| 6804 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6805 | /* .name = "Capture Source", */ |
| 6806 | .name = "Input Source", |
| 6807 | .count = 2, |
| 6808 | .info = alc883_mux_enum_info, |
| 6809 | .get = alc883_mux_enum_get, |
| 6810 | .put = alc883_mux_enum_put, |
| 6811 | }, |
| 6812 | { } /* end */ |
| 6813 | }; |
| 6814 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6815 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6816 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6817 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6818 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6819 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6820 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6821 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6822 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6823 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6824 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6825 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6827 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6828 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6829 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6830 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6831 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6832 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6833 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6834 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6835 | { |
| 6836 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6837 | /* .name = "Capture Source", */ |
| 6838 | .name = "Input Source", |
| 6839 | .count = 2, |
| 6840 | .info = alc883_mux_enum_info, |
| 6841 | .get = alc883_mux_enum_get, |
| 6842 | .put = alc883_mux_enum_put, |
| 6843 | }, |
| 6844 | { } /* end */ |
| 6845 | }; |
| 6846 | |
| 6847 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6848 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6849 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6850 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6851 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6853 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6854 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6855 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6856 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6857 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6858 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6859 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6860 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6861 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6862 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6863 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6864 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6865 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6866 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6868 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6870 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6871 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6872 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6873 | { |
| 6874 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6875 | /* .name = "Capture Source", */ |
| 6876 | .name = "Input Source", |
| 6877 | .count = 2, |
| 6878 | .info = alc883_mux_enum_info, |
| 6879 | .get = alc883_mux_enum_get, |
| 6880 | .put = alc883_mux_enum_put, |
| 6881 | }, |
| 6882 | { } /* end */ |
| 6883 | }; |
| 6884 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6885 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6886 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6887 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6888 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6889 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6890 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6891 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6892 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6893 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6894 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6895 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6896 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6897 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6898 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6899 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6900 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6901 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6902 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6903 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6904 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6905 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6906 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6907 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6908 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6909 | |
| 6910 | { |
| 6911 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6912 | /* .name = "Capture Source", */ |
| 6913 | .name = "Input Source", |
| 6914 | .count = 1, |
| 6915 | .info = alc883_mux_enum_info, |
| 6916 | .get = alc883_mux_enum_get, |
| 6917 | .put = alc883_mux_enum_put, |
| 6918 | }, |
| 6919 | { } /* end */ |
| 6920 | }; |
| 6921 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6922 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6923 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6924 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6925 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6926 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6927 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6928 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6929 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6930 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6931 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6932 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6933 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6934 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6935 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6936 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6937 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6942 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6943 | { |
| 6944 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6945 | /* .name = "Capture Source", */ |
| 6946 | .name = "Input Source", |
| 6947 | .count = 2, |
| 6948 | .info = alc883_mux_enum_info, |
| 6949 | .get = alc883_mux_enum_get, |
| 6950 | .put = alc883_mux_enum_put, |
| 6951 | }, |
| 6952 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6953 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6954 | |
| 6955 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6957 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6958 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6959 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6960 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6961 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6962 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 6964 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6965 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6966 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6967 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6968 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6969 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6970 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6971 | { |
| 6972 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6973 | /* .name = "Capture Source", */ |
| 6974 | .name = "Input Source", |
| 6975 | .count = 2, |
| 6976 | .info = alc883_mux_enum_info, |
| 6977 | .get = alc883_mux_enum_get, |
| 6978 | .put = alc883_mux_enum_put, |
| 6979 | }, |
| 6980 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6981 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6982 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6983 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6984 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6985 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6986 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6987 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6988 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6989 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6990 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6992 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6993 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6994 | { |
| 6995 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6996 | /* .name = "Capture Source", */ |
| 6997 | .name = "Input Source", |
| 6998 | .count = 1, |
| 6999 | .info = alc883_mux_enum_info, |
| 7000 | .get = alc883_mux_enum_get, |
| 7001 | .put = alc883_mux_enum_put, |
| 7002 | }, |
| 7003 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7004 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7005 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7006 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7007 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7008 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7009 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7010 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7011 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7012 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7014 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7015 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7017 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7018 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7019 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7020 | { |
| 7021 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7022 | /* .name = "Capture Source", */ |
| 7023 | .name = "Input Source", |
| 7024 | .count = 2, |
| 7025 | .info = alc883_mux_enum_info, |
| 7026 | .get = alc883_mux_enum_get, |
| 7027 | .put = alc883_mux_enum_put, |
| 7028 | }, |
| 7029 | { } /* end */ |
| 7030 | }; |
| 7031 | |
| 7032 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7033 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7034 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7035 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7036 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7037 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7038 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7039 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7040 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7041 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7042 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7043 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7044 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7045 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7046 | { |
| 7047 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7048 | /* .name = "Capture Source", */ |
| 7049 | .name = "Input Source", |
| 7050 | .count = 2, |
| 7051 | .info = alc883_mux_enum_info, |
| 7052 | .get = alc883_mux_enum_get, |
| 7053 | .put = alc883_mux_enum_put, |
| 7054 | }, |
| 7055 | { } /* end */ |
| 7056 | }; |
| 7057 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7058 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7059 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7060 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7061 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7065 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7066 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7067 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7068 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7069 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7070 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7071 | { |
| 7072 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7073 | /* .name = "Capture Source", */ |
| 7074 | .name = "Input Source", |
| 7075 | .count = 2, |
| 7076 | .info = alc883_mux_enum_info, |
| 7077 | .get = alc883_mux_enum_get, |
| 7078 | .put = alc883_mux_enum_put, |
| 7079 | }, |
| 7080 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7081 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7082 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7083 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7084 | { |
| 7085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7086 | .name = "Channel Mode", |
| 7087 | .info = alc_ch_mode_info, |
| 7088 | .get = alc_ch_mode_get, |
| 7089 | .put = alc_ch_mode_put, |
| 7090 | }, |
| 7091 | { } /* end */ |
| 7092 | }; |
| 7093 | |
| 7094 | static struct hda_verb alc883_init_verbs[] = { |
| 7095 | /* ADC1: mute amp left and right */ |
| 7096 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7097 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7098 | /* ADC2: mute amp left and right */ |
| 7099 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7100 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7101 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7104 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7105 | /* Rear mixer */ |
| 7106 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7108 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7109 | /* CLFE mixer */ |
| 7110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7112 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7113 | /* Side mixer */ |
| 7114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7115 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7116 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7117 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7118 | /* mute analog input loopbacks */ |
| 7119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7123 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7124 | |
| 7125 | /* Front Pin: output 0 (0x0c) */ |
| 7126 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7127 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7128 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7129 | /* Rear Pin: output 1 (0x0d) */ |
| 7130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7133 | /* CLFE Pin: output 2 (0x0e) */ |
| 7134 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7135 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7136 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7137 | /* Side Pin: output 3 (0x0f) */ |
| 7138 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7140 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7141 | /* Mic (rear) pin: input vref at 80% */ |
| 7142 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7143 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7144 | /* Front Mic pin: input vref at 80% */ |
| 7145 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7146 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7147 | /* Line In pin: input */ |
| 7148 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7149 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7150 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7151 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7152 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7153 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7154 | /* CD pin widget for input */ |
| 7155 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7156 | |
| 7157 | /* FIXME: use matrix-type input source selection */ |
| 7158 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7159 | /* Input mixer2 */ |
| 7160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7161 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7162 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7163 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7164 | /* Input mixer3 */ |
| 7165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7167 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7168 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7169 | { } |
| 7170 | }; |
| 7171 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7172 | /* toggle speaker-output according to the hp-jack state */ |
| 7173 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7174 | { |
| 7175 | unsigned int present; |
| 7176 | |
| 7177 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7178 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7179 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7180 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7181 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7182 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7183 | } |
| 7184 | |
| 7185 | /* auto-toggle front mic */ |
| 7186 | /* |
| 7187 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7188 | { |
| 7189 | unsigned int present; |
| 7190 | unsigned char bits; |
| 7191 | |
| 7192 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7193 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7194 | bits = present ? HDA_AMP_MUTE : 0; |
| 7195 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7196 | } |
| 7197 | */ |
| 7198 | |
| 7199 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7200 | { |
| 7201 | alc883_mitac_hp_automute(codec); |
| 7202 | /* alc883_mitac_mic_automute(codec); */ |
| 7203 | } |
| 7204 | |
| 7205 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7206 | unsigned int res) |
| 7207 | { |
| 7208 | switch (res >> 26) { |
| 7209 | case ALC880_HP_EVENT: |
| 7210 | alc883_mitac_hp_automute(codec); |
| 7211 | break; |
| 7212 | case ALC880_MIC_EVENT: |
| 7213 | /* alc883_mitac_mic_automute(codec); */ |
| 7214 | break; |
| 7215 | } |
| 7216 | } |
| 7217 | |
| 7218 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7219 | /* HP */ |
| 7220 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7221 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7222 | /* Subwoofer */ |
| 7223 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7224 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7225 | |
| 7226 | /* enable unsolicited event */ |
| 7227 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7228 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7229 | |
| 7230 | { } /* end */ |
| 7231 | }; |
| 7232 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7233 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7234 | /* HP */ |
| 7235 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7237 | /* Int speaker */ |
| 7238 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7239 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7240 | |
| 7241 | /* enable unsolicited event */ |
| 7242 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7243 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7244 | |
| 7245 | { } /* end */ |
| 7246 | }; |
| 7247 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7248 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7249 | /* HP */ |
| 7250 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7251 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7252 | /* Subwoofer */ |
| 7253 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7255 | |
| 7256 | /* enable unsolicited event */ |
| 7257 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7258 | |
| 7259 | { } /* end */ |
| 7260 | }; |
| 7261 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7262 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7264 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7265 | |
| 7266 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7267 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7268 | |
| 7269 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7270 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7271 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7272 | |
| 7273 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7274 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7275 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7276 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7277 | |
| 7278 | { } /* end */ |
| 7279 | }; |
| 7280 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7281 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7282 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7283 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7284 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7285 | { } /* end */ |
| 7286 | }; |
| 7287 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7288 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7289 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7290 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7291 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7293 | { } /* end */ |
| 7294 | }; |
| 7295 | |
| 7296 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7298 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7299 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7300 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7301 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7302 | { } /* end */ |
| 7303 | }; |
| 7304 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7305 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7307 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7308 | |
| 7309 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7310 | |
| 7311 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7312 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7313 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7314 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7315 | { } /* end */ |
| 7316 | }; |
| 7317 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7318 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7319 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7320 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7321 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7322 | { } |
| 7323 | }; |
| 7324 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7325 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7326 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7327 | { } |
| 7328 | }; |
| 7329 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7330 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7331 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7332 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7333 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7334 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7335 | { } |
| 7336 | }; |
| 7337 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7338 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7339 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7340 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7341 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7342 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7343 | { } |
| 7344 | }; |
| 7345 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7346 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7347 | { 2, alc888_3st_hp_2ch_init }, |
| 7348 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7349 | }; |
| 7350 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7351 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7352 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7353 | { |
| 7354 | unsigned int present; |
| 7355 | |
| 7356 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7357 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7358 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7359 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7360 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7361 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7362 | } |
| 7363 | |
| 7364 | /* toggle RCA according to the front-jack state */ |
| 7365 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7366 | { |
| 7367 | unsigned int present; |
| 7368 | |
| 7369 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7370 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7371 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7372 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7373 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7374 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7375 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7376 | unsigned int res) |
| 7377 | { |
| 7378 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7379 | alc888_lenovo_ms7195_front_automute(codec); |
| 7380 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7381 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7382 | } |
| 7383 | |
| 7384 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7386 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7387 | |
| 7388 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7389 | |
| 7390 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7391 | { } /* end */ |
| 7392 | }; |
| 7393 | |
| 7394 | /* toggle speaker-output according to the hp-jack state */ |
| 7395 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7396 | { |
| 7397 | unsigned int present; |
| 7398 | |
| 7399 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7400 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7401 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7402 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7403 | } |
| 7404 | |
| 7405 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7406 | unsigned int res) |
| 7407 | { |
| 7408 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7409 | alc883_medion_md2_automute(codec); |
| 7410 | } |
| 7411 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7412 | /* toggle speaker-output according to the hp-jack state */ |
| 7413 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7414 | { |
| 7415 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7416 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7417 | |
| 7418 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7419 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7420 | bits = present ? HDA_AMP_MUTE : 0; |
| 7421 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7422 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7423 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7424 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7425 | } |
| 7426 | |
| 7427 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7428 | { |
| 7429 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7430 | alc883_tagra_automute(codec); |
| 7431 | } |
| 7432 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7433 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7434 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7435 | { |
| 7436 | unsigned int present; |
| 7437 | unsigned char bits; |
| 7438 | |
| 7439 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7440 | & AC_PINSENSE_PRESENCE; |
| 7441 | bits = present ? HDA_AMP_MUTE : 0; |
| 7442 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7443 | HDA_AMP_MUTE, bits); |
| 7444 | } |
| 7445 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7446 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7447 | { |
| 7448 | unsigned int present; |
| 7449 | |
| 7450 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7451 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7452 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7453 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7454 | } |
| 7455 | |
| 7456 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7457 | { |
| 7458 | alc883_clevo_m720_hp_automute(codec); |
| 7459 | alc883_clevo_m720_mic_automute(codec); |
| 7460 | } |
| 7461 | |
| 7462 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7463 | unsigned int res) |
| 7464 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7465 | switch (res >> 26) { |
| 7466 | case ALC880_HP_EVENT: |
| 7467 | alc883_clevo_m720_hp_automute(codec); |
| 7468 | break; |
| 7469 | case ALC880_MIC_EVENT: |
| 7470 | alc883_clevo_m720_mic_automute(codec); |
| 7471 | break; |
| 7472 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7473 | } |
| 7474 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7475 | /* toggle speaker-output according to the hp-jack state */ |
| 7476 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7477 | { |
| 7478 | unsigned int present; |
| 7479 | unsigned char bits; |
| 7480 | |
| 7481 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7482 | & AC_PINSENSE_PRESENCE; |
| 7483 | bits = present ? HDA_AMP_MUTE : 0; |
| 7484 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7485 | HDA_AMP_MUTE, bits); |
| 7486 | } |
| 7487 | |
| 7488 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7489 | unsigned int res) |
| 7490 | { |
| 7491 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7492 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7493 | } |
| 7494 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7495 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7496 | { |
| 7497 | unsigned int present; |
| 7498 | unsigned char bits; |
| 7499 | |
| 7500 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7501 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7502 | bits = present ? 0x80 : 0; |
| 7503 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7504 | 0x80, bits); |
| 7505 | } |
| 7506 | |
| 7507 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7508 | unsigned int res) |
| 7509 | { |
| 7510 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7511 | alc883_haier_w66_automute(codec); |
| 7512 | } |
| 7513 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7514 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7515 | { |
| 7516 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7517 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7518 | |
| 7519 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7520 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7521 | bits = present ? HDA_AMP_MUTE : 0; |
| 7522 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7523 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7524 | } |
| 7525 | |
| 7526 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7527 | { |
| 7528 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7529 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7530 | |
| 7531 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7532 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7533 | bits = present ? HDA_AMP_MUTE : 0; |
| 7534 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7535 | HDA_AMP_MUTE, bits); |
| 7536 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7537 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7538 | } |
| 7539 | |
| 7540 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7541 | unsigned int res) |
| 7542 | { |
| 7543 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7544 | alc883_lenovo_101e_all_automute(codec); |
| 7545 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7546 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7547 | } |
| 7548 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7549 | /* toggle speaker-output according to the hp-jack state */ |
| 7550 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7551 | { |
| 7552 | unsigned int present; |
| 7553 | |
| 7554 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7555 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7556 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7557 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7558 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7559 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7560 | } |
| 7561 | |
| 7562 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7563 | unsigned int res) |
| 7564 | { |
| 7565 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7566 | alc883_acer_aspire_automute(codec); |
| 7567 | } |
| 7568 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7569 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7570 | /* HP Pin: output 0 (0x0c) */ |
| 7571 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7572 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7573 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7574 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7575 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7576 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7577 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7578 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7579 | /* eanable EAPD on medion laptop */ |
| 7580 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7581 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7582 | /* enable unsolicited event */ |
| 7583 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7584 | { } |
| 7585 | }; |
| 7586 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7587 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7588 | { |
| 7589 | unsigned int present; |
| 7590 | |
| 7591 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7592 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7593 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7594 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7595 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7596 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7597 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7598 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7599 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7600 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7601 | } |
| 7602 | |
| 7603 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7604 | unsigned int res) |
| 7605 | { |
| 7606 | switch (res >> 26) { |
| 7607 | case ALC880_HP_EVENT: |
| 7608 | printk("hp_event\n"); |
| 7609 | alc888_6st_dell_front_automute(codec); |
| 7610 | break; |
| 7611 | } |
| 7612 | } |
| 7613 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7614 | /* |
| 7615 | * generic initialization of ADC, input mixers and output mixers |
| 7616 | */ |
| 7617 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7618 | /* |
| 7619 | * Unmute ADC0-2 and set the default input to mic-in |
| 7620 | */ |
| 7621 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7622 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7623 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7624 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7625 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7626 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7627 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7628 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7629 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7630 | */ |
| 7631 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7632 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7633 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7634 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7636 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7637 | |
| 7638 | /* |
| 7639 | * Set up output mixers (0x0c - 0x0f) |
| 7640 | */ |
| 7641 | /* set vol=0 to output mixers */ |
| 7642 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7643 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7644 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7645 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7646 | /* set up input amps for analog loopback */ |
| 7647 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7651 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7652 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7653 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7654 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7655 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7656 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7657 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7658 | |
| 7659 | /* FIXME: use matrix-type input source selection */ |
| 7660 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7661 | /* Input mixer1 */ |
| 7662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7664 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7665 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7666 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7667 | /* Input mixer2 */ |
| 7668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7670 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7671 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7672 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7673 | |
| 7674 | { } |
| 7675 | }; |
| 7676 | |
| 7677 | /* capture mixer elements */ |
| 7678 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7679 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7680 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7681 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7682 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7683 | { |
| 7684 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7685 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7686 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7687 | */ |
| 7688 | /* .name = "Capture Source", */ |
| 7689 | .name = "Input Source", |
| 7690 | .count = 2, |
| 7691 | .info = alc882_mux_enum_info, |
| 7692 | .get = alc882_mux_enum_get, |
| 7693 | .put = alc882_mux_enum_put, |
| 7694 | }, |
| 7695 | { } /* end */ |
| 7696 | }; |
| 7697 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7698 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7699 | #define alc883_loopbacks alc880_loopbacks |
| 7700 | #endif |
| 7701 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7702 | /* pcm configuration: identiacal with ALC880 */ |
| 7703 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7704 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7705 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7706 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7707 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7708 | |
| 7709 | /* |
| 7710 | * configuration and preset |
| 7711 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7712 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7713 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7714 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7715 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7716 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7717 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7718 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7719 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7720 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7721 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7722 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7723 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7724 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7725 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7726 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7727 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7728 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7729 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7730 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7731 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7732 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7733 | [ALC883_AUTO] = "auto", |
| 7734 | }; |
| 7735 | |
| 7736 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7737 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7738 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7739 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7740 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7741 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7742 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7743 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7744 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7745 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 7746 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7747 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7748 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7749 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7750 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7751 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7752 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7753 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7754 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7755 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7756 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7757 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7758 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7759 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7760 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7761 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7762 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7763 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7764 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7765 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7766 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7767 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7768 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7769 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7770 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7771 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7772 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7773 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7774 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7775 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7776 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 7777 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7778 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7779 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7780 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7781 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7782 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7784 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7785 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7786 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7787 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7788 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7789 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7790 | {} |
| 7791 | }; |
| 7792 | |
| 7793 | static struct alc_config_preset alc883_presets[] = { |
| 7794 | [ALC883_3ST_2ch_DIG] = { |
| 7795 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7796 | .init_verbs = { alc883_init_verbs }, |
| 7797 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7798 | .dac_nids = alc883_dac_nids, |
| 7799 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7800 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7801 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7802 | .channel_mode = alc883_3ST_2ch_modes, |
| 7803 | .input_mux = &alc883_capture_source, |
| 7804 | }, |
| 7805 | [ALC883_3ST_6ch_DIG] = { |
| 7806 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7807 | .init_verbs = { alc883_init_verbs }, |
| 7808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7809 | .dac_nids = alc883_dac_nids, |
| 7810 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7811 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7813 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7814 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7815 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7816 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7817 | [ALC883_3ST_6ch] = { |
| 7818 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7819 | .init_verbs = { alc883_init_verbs }, |
| 7820 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7821 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7823 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7824 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7825 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7826 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7827 | [ALC883_6ST_DIG] = { |
| 7828 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7829 | .init_verbs = { alc883_init_verbs }, |
| 7830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7831 | .dac_nids = alc883_dac_nids, |
| 7832 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7833 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7834 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7835 | .channel_mode = alc883_sixstack_modes, |
| 7836 | .input_mux = &alc883_capture_source, |
| 7837 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7838 | [ALC883_TARGA_DIG] = { |
| 7839 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7840 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7841 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7842 | .dac_nids = alc883_dac_nids, |
| 7843 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7844 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7845 | .channel_mode = alc883_3ST_6ch_modes, |
| 7846 | .need_dac_fix = 1, |
| 7847 | .input_mux = &alc883_capture_source, |
| 7848 | .unsol_event = alc883_tagra_unsol_event, |
| 7849 | .init_hook = alc883_tagra_automute, |
| 7850 | }, |
| 7851 | [ALC883_TARGA_2ch_DIG] = { |
| 7852 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7853 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7855 | .dac_nids = alc883_dac_nids, |
| 7856 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7857 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7858 | .channel_mode = alc883_3ST_2ch_modes, |
| 7859 | .input_mux = &alc883_capture_source, |
| 7860 | .unsol_event = alc883_tagra_unsol_event, |
| 7861 | .init_hook = alc883_tagra_automute, |
| 7862 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7863 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7864 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7865 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7866 | * and the headphone jack. Turn this on and rely on the |
| 7867 | * standard mute methods whenever the user wants to turn |
| 7868 | * these outputs off. |
| 7869 | */ |
| 7870 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7871 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7872 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7873 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7874 | .channel_mode = alc883_3ST_2ch_modes, |
| 7875 | .input_mux = &alc883_capture_source, |
| 7876 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7877 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7878 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7879 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7880 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7881 | .dac_nids = alc883_dac_nids, |
| 7882 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7883 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7884 | .channel_mode = alc883_3ST_2ch_modes, |
| 7885 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7886 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7887 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7888 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7889 | [ALC883_MEDION] = { |
| 7890 | .mixers = { alc883_fivestack_mixer, |
| 7891 | alc883_chmode_mixer }, |
| 7892 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7893 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7895 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7896 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7897 | .channel_mode = alc883_sixstack_modes, |
| 7898 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7899 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7900 | [ALC883_MEDION_MD2] = { |
| 7901 | .mixers = { alc883_medion_md2_mixer}, |
| 7902 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7903 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7904 | .dac_nids = alc883_dac_nids, |
| 7905 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7906 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7907 | .channel_mode = alc883_3ST_2ch_modes, |
| 7908 | .input_mux = &alc883_capture_source, |
| 7909 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7910 | .init_hook = alc883_medion_md2_automute, |
| 7911 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7912 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7913 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7914 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7915 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7916 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7917 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7918 | .channel_mode = alc883_3ST_2ch_modes, |
| 7919 | .input_mux = &alc883_capture_source, |
| 7920 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7921 | [ALC883_CLEVO_M720] = { |
| 7922 | .mixers = { alc883_clevo_m720_mixer }, |
| 7923 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7925 | .dac_nids = alc883_dac_nids, |
| 7926 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7927 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7928 | .channel_mode = alc883_3ST_2ch_modes, |
| 7929 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7930 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 7931 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7932 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7933 | [ALC883_LENOVO_101E_2ch] = { |
| 7934 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7935 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7936 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7937 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7938 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7939 | .channel_mode = alc883_3ST_2ch_modes, |
| 7940 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7941 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7942 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7943 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7944 | [ALC883_LENOVO_NB0763] = { |
| 7945 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7946 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7947 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7948 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7949 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7950 | .channel_mode = alc883_3ST_2ch_modes, |
| 7951 | .need_dac_fix = 1, |
| 7952 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7953 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7954 | .init_hook = alc883_medion_md2_automute, |
| 7955 | }, |
| 7956 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7957 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7958 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7959 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7960 | .dac_nids = alc883_dac_nids, |
| 7961 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7962 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7963 | .channel_mode = alc883_3ST_6ch_modes, |
| 7964 | .need_dac_fix = 1, |
| 7965 | .input_mux = &alc883_capture_source, |
| 7966 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7967 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7968 | }, |
| 7969 | [ALC883_HAIER_W66] = { |
| 7970 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7971 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7972 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7973 | .dac_nids = alc883_dac_nids, |
| 7974 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7975 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7976 | .channel_mode = alc883_3ST_2ch_modes, |
| 7977 | .input_mux = &alc883_capture_source, |
| 7978 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7979 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7980 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7981 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7982 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7983 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7984 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7985 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7986 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7987 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7988 | .need_dac_fix = 1, |
| 7989 | .input_mux = &alc883_capture_source, |
| 7990 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7991 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 7992 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7993 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7994 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7995 | .dac_nids = alc883_dac_nids, |
| 7996 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7997 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7998 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7999 | .channel_mode = alc883_sixstack_modes, |
| 8000 | .input_mux = &alc883_capture_source, |
| 8001 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8002 | .init_hook = alc888_6st_dell_front_automute, |
| 8003 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8004 | [ALC883_MITAC] = { |
| 8005 | .mixers = { alc883_mitac_mixer }, |
| 8006 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8007 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8008 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8009 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8010 | .channel_mode = alc883_3ST_2ch_modes, |
| 8011 | .input_mux = &alc883_capture_source, |
| 8012 | .unsol_event = alc883_mitac_unsol_event, |
| 8013 | .init_hook = alc883_mitac_automute, |
| 8014 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8015 | [ALC883_FUJITSU_PI2515] = { |
| 8016 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8017 | .init_verbs = { alc883_init_verbs, |
| 8018 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8019 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8020 | .dac_nids = alc883_dac_nids, |
| 8021 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8022 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8023 | .channel_mode = alc883_3ST_2ch_modes, |
| 8024 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8025 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8026 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8027 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8028 | }; |
| 8029 | |
| 8030 | |
| 8031 | /* |
| 8032 | * BIOS auto configuration |
| 8033 | */ |
| 8034 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8035 | hda_nid_t nid, int pin_type, |
| 8036 | int dac_idx) |
| 8037 | { |
| 8038 | /* set as output */ |
| 8039 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8040 | int idx; |
| 8041 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8042 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8043 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8044 | idx = 4; |
| 8045 | else |
| 8046 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8047 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8048 | |
| 8049 | } |
| 8050 | |
| 8051 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8052 | { |
| 8053 | struct alc_spec *spec = codec->spec; |
| 8054 | int i; |
| 8055 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8056 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8057 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8058 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8059 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8060 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8061 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8062 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8063 | } |
| 8064 | } |
| 8065 | |
| 8066 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8067 | { |
| 8068 | struct alc_spec *spec = codec->spec; |
| 8069 | hda_nid_t pin; |
| 8070 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8071 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8072 | if (pin) /* connect to front */ |
| 8073 | /* use dac 0 */ |
| 8074 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8075 | pin = spec->autocfg.speaker_pins[0]; |
| 8076 | if (pin) |
| 8077 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8078 | } |
| 8079 | |
| 8080 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8081 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8082 | |
| 8083 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8084 | { |
| 8085 | struct alc_spec *spec = codec->spec; |
| 8086 | int i; |
| 8087 | |
| 8088 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8089 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8090 | if (alc883_is_input_pin(nid)) { |
| 8091 | snd_hda_codec_write(codec, nid, 0, |
| 8092 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8093 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8094 | PIN_VREF80 : PIN_IN)); |
| 8095 | if (nid != ALC883_PIN_CD_NID) |
| 8096 | snd_hda_codec_write(codec, nid, 0, |
| 8097 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8098 | AMP_OUT_MUTE); |
| 8099 | } |
| 8100 | } |
| 8101 | } |
| 8102 | |
| 8103 | /* almost identical with ALC880 parser... */ |
| 8104 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8105 | { |
| 8106 | struct alc_spec *spec = codec->spec; |
| 8107 | int err = alc880_parse_auto_config(codec); |
| 8108 | |
| 8109 | if (err < 0) |
| 8110 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8111 | else if (!err) |
| 8112 | return 0; /* no config found */ |
| 8113 | |
| 8114 | err = alc_auto_add_mic_boost(codec); |
| 8115 | if (err < 0) |
| 8116 | return err; |
| 8117 | |
| 8118 | /* hack - override the init verbs */ |
| 8119 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8120 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8121 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8122 | |
| 8123 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8124 | } |
| 8125 | |
| 8126 | /* additional initialization for auto-configuration model */ |
| 8127 | static void alc883_auto_init(struct hda_codec *codec) |
| 8128 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8129 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8130 | alc883_auto_init_multi_out(codec); |
| 8131 | alc883_auto_init_hp_out(codec); |
| 8132 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8133 | if (spec->unsol_event) |
| 8134 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8135 | } |
| 8136 | |
| 8137 | static int patch_alc883(struct hda_codec *codec) |
| 8138 | { |
| 8139 | struct alc_spec *spec; |
| 8140 | int err, board_config; |
| 8141 | |
| 8142 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8143 | if (spec == NULL) |
| 8144 | return -ENOMEM; |
| 8145 | |
| 8146 | codec->spec = spec; |
| 8147 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8148 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8149 | alc883_models, |
| 8150 | alc883_cfg_tbl); |
| 8151 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8152 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8153 | "trying auto-probe from BIOS...\n"); |
| 8154 | board_config = ALC883_AUTO; |
| 8155 | } |
| 8156 | |
| 8157 | if (board_config == ALC883_AUTO) { |
| 8158 | /* automatic parse from the BIOS config */ |
| 8159 | err = alc883_parse_auto_config(codec); |
| 8160 | if (err < 0) { |
| 8161 | alc_free(codec); |
| 8162 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8163 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8164 | printk(KERN_INFO |
| 8165 | "hda_codec: Cannot set up configuration " |
| 8166 | "from BIOS. Using base mode...\n"); |
| 8167 | board_config = ALC883_3ST_2ch_DIG; |
| 8168 | } |
| 8169 | } |
| 8170 | |
| 8171 | if (board_config != ALC883_AUTO) |
| 8172 | setup_preset(spec, &alc883_presets[board_config]); |
| 8173 | |
| 8174 | spec->stream_name_analog = "ALC883 Analog"; |
| 8175 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8176 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8177 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8178 | |
| 8179 | spec->stream_name_digital = "ALC883 Digital"; |
| 8180 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8181 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8182 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8183 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8184 | spec->adc_nids = alc883_adc_nids; |
| 8185 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8186 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8187 | spec->vmaster_nid = 0x0c; |
| 8188 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8189 | codec->patch_ops = alc_patch_ops; |
| 8190 | if (board_config == ALC883_AUTO) |
| 8191 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8192 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8193 | if (!spec->loopback.amplist) |
| 8194 | spec->loopback.amplist = alc883_loopbacks; |
| 8195 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8196 | |
| 8197 | return 0; |
| 8198 | } |
| 8199 | |
| 8200 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8201 | * ALC262 support |
| 8202 | */ |
| 8203 | |
| 8204 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8205 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8206 | |
| 8207 | #define alc262_dac_nids alc260_dac_nids |
| 8208 | #define alc262_adc_nids alc882_adc_nids |
| 8209 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8210 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8211 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8212 | |
| 8213 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8214 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8215 | |
| 8216 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8217 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8218 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8228 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8229 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8230 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8233 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8234 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8235 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8236 | }; |
| 8237 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8238 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8240 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8241 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8246 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8247 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8248 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8249 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8250 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8251 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8252 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8253 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8255 | { } /* end */ |
| 8256 | }; |
| 8257 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8258 | /* update HP, line and mono-out pins according to the master switch */ |
| 8259 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8260 | { |
| 8261 | struct alc_spec *spec = codec->spec; |
| 8262 | int val = spec->master_sw; |
| 8263 | |
| 8264 | /* HP & line-out */ |
| 8265 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8266 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8267 | val ? PIN_HP : 0); |
| 8268 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8269 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8270 | val ? PIN_HP : 0); |
| 8271 | /* mono (speaker) depending on the HP jack sense */ |
| 8272 | val = val && !spec->jack_present; |
| 8273 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8274 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8275 | val ? PIN_OUT : 0); |
| 8276 | } |
| 8277 | |
| 8278 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8279 | { |
| 8280 | struct alc_spec *spec = codec->spec; |
| 8281 | unsigned int presence; |
| 8282 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8283 | AC_VERB_GET_PIN_SENSE, 0); |
| 8284 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8285 | alc262_hp_master_update(codec); |
| 8286 | } |
| 8287 | |
| 8288 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8289 | { |
| 8290 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8291 | return; |
| 8292 | alc262_hp_bpc_automute(codec); |
| 8293 | } |
| 8294 | |
| 8295 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8296 | { |
| 8297 | struct alc_spec *spec = codec->spec; |
| 8298 | unsigned int presence; |
| 8299 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8300 | AC_VERB_GET_PIN_SENSE, 0); |
| 8301 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8302 | alc262_hp_master_update(codec); |
| 8303 | } |
| 8304 | |
| 8305 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8306 | unsigned int res) |
| 8307 | { |
| 8308 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8309 | return; |
| 8310 | alc262_hp_wildwest_automute(codec); |
| 8311 | } |
| 8312 | |
| 8313 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8314 | struct snd_ctl_elem_value *ucontrol) |
| 8315 | { |
| 8316 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8317 | struct alc_spec *spec = codec->spec; |
| 8318 | *ucontrol->value.integer.value = spec->master_sw; |
| 8319 | return 0; |
| 8320 | } |
| 8321 | |
| 8322 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8323 | struct snd_ctl_elem_value *ucontrol) |
| 8324 | { |
| 8325 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8326 | struct alc_spec *spec = codec->spec; |
| 8327 | int val = !!*ucontrol->value.integer.value; |
| 8328 | |
| 8329 | if (val == spec->master_sw) |
| 8330 | return 0; |
| 8331 | spec->master_sw = val; |
| 8332 | alc262_hp_master_update(codec); |
| 8333 | return 1; |
| 8334 | } |
| 8335 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8336 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8337 | { |
| 8338 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8339 | .name = "Master Playback Switch", |
| 8340 | .info = snd_ctl_boolean_mono_info, |
| 8341 | .get = alc262_hp_master_sw_get, |
| 8342 | .put = alc262_hp_master_sw_put, |
| 8343 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8344 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8345 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8347 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8348 | HDA_OUTPUT), |
| 8349 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8350 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8353 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8354 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8355 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8356 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8359 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8360 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8361 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8362 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8363 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8364 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8365 | { } /* end */ |
| 8366 | }; |
| 8367 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8368 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8369 | { |
| 8370 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8371 | .name = "Master Playback Switch", |
| 8372 | .info = snd_ctl_boolean_mono_info, |
| 8373 | .get = alc262_hp_master_sw_get, |
| 8374 | .put = alc262_hp_master_sw_put, |
| 8375 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8377 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8378 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8379 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8380 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8381 | HDA_OUTPUT), |
| 8382 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8383 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8384 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8385 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8386 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8387 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8388 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8389 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8390 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8391 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8392 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8393 | { } /* end */ |
| 8394 | }; |
| 8395 | |
| 8396 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8397 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8398 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8399 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8400 | { } /* end */ |
| 8401 | }; |
| 8402 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8403 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8404 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8405 | { |
| 8406 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8407 | |
| 8408 | if (force || !spec->sense_updated) { |
| 8409 | unsigned int present; |
| 8410 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8411 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8412 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8413 | spec->sense_updated = 1; |
| 8414 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8415 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8416 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8417 | } |
| 8418 | |
| 8419 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8420 | unsigned int res) |
| 8421 | { |
| 8422 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8423 | return; |
| 8424 | alc262_hp_t5735_automute(codec, 1); |
| 8425 | } |
| 8426 | |
| 8427 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8428 | { |
| 8429 | alc262_hp_t5735_automute(codec, 1); |
| 8430 | } |
| 8431 | |
| 8432 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8433 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8434 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8435 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8439 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8440 | { } /* end */ |
| 8441 | }; |
| 8442 | |
| 8443 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8446 | |
| 8447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8448 | { } |
| 8449 | }; |
| 8450 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8451 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8454 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8455 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8458 | { } /* end */ |
| 8459 | }; |
| 8460 | |
| 8461 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8462 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8464 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8465 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8466 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8467 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8468 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8469 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8472 | {} |
| 8473 | }; |
| 8474 | |
| 8475 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8476 | .num_items = 1, |
| 8477 | .items = { |
| 8478 | { "Line", 0x1 }, |
| 8479 | }, |
| 8480 | }; |
| 8481 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8482 | /* bind hp and internal speaker mute (with plug check) */ |
| 8483 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8484 | struct snd_ctl_elem_value *ucontrol) |
| 8485 | { |
| 8486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8487 | long *valp = ucontrol->value.integer.value; |
| 8488 | int change; |
| 8489 | |
| 8490 | /* change hp mute */ |
| 8491 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8492 | HDA_AMP_MUTE, |
| 8493 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8494 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8495 | HDA_AMP_MUTE, |
| 8496 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8497 | if (change) { |
| 8498 | /* change speaker according to HP jack state */ |
| 8499 | struct alc_spec *spec = codec->spec; |
| 8500 | unsigned int mute; |
| 8501 | if (spec->jack_present) |
| 8502 | mute = HDA_AMP_MUTE; |
| 8503 | else |
| 8504 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8505 | HDA_OUTPUT, 0); |
| 8506 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8507 | HDA_AMP_MUTE, mute); |
| 8508 | } |
| 8509 | return change; |
| 8510 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8511 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8512 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8513 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8514 | { |
| 8515 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8516 | .name = "Master Playback Switch", |
| 8517 | .info = snd_hda_mixer_amp_switch_info, |
| 8518 | .get = snd_hda_mixer_amp_switch_get, |
| 8519 | .put = alc262_sony_master_sw_put, |
| 8520 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8521 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8522 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8523 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8524 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8525 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8526 | { } /* end */ |
| 8527 | }; |
| 8528 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8529 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8530 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8531 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8532 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8535 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8536 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8537 | { } /* end */ |
| 8538 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8540 | #define alc262_capture_mixer alc882_capture_mixer |
| 8541 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8542 | |
| 8543 | /* |
| 8544 | * generic initialization of ADC, input mixers and output mixers |
| 8545 | */ |
| 8546 | static struct hda_verb alc262_init_verbs[] = { |
| 8547 | /* |
| 8548 | * Unmute ADC0-2 and set the default input to mic-in |
| 8549 | */ |
| 8550 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8552 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8553 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8554 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8555 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8556 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8557 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8558 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8559 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8560 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8561 | */ |
| 8562 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8568 | |
| 8569 | /* |
| 8570 | * Set up output mixers (0x0c - 0x0e) |
| 8571 | */ |
| 8572 | /* set vol=0 to output mixers */ |
| 8573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8574 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8575 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8576 | /* set up input amps for analog loopback */ |
| 8577 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8584 | |
| 8585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8587 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8590 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8591 | |
| 8592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8593 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8594 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8597 | |
| 8598 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8600 | |
| 8601 | /* FIXME: use matrix-type input source selection */ |
| 8602 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8603 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8606 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8608 | /* Input mixer2 */ |
| 8609 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8610 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8611 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8613 | /* Input mixer3 */ |
| 8614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8616 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8618 | |
| 8619 | { } |
| 8620 | }; |
| 8621 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8622 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8623 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8625 | {} |
| 8626 | }; |
| 8627 | |
| 8628 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8630 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8631 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8632 | |
| 8633 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8635 | {} |
| 8636 | }; |
| 8637 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8638 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8640 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8641 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8642 | |
| 8643 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8645 | }; |
| 8646 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8647 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8648 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8649 | { |
| 8650 | struct alc_spec *spec = codec->spec; |
| 8651 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8652 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8653 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8654 | /* need to execute and sync at first */ |
| 8655 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8656 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8657 | AC_VERB_GET_PIN_SENSE, 0); |
| 8658 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8659 | if (spec->jack_present) { |
| 8660 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8661 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8662 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8663 | } else { |
| 8664 | /* unmute internal speaker if necessary */ |
| 8665 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8666 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8667 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8668 | } |
| 8669 | } |
| 8670 | |
| 8671 | /* unsolicited event for HP jack sensing */ |
| 8672 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8673 | unsigned int res) |
| 8674 | { |
| 8675 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8676 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8677 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8678 | } |
| 8679 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8680 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8681 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8682 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8683 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8684 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8685 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8686 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8687 | AC_VERB_GET_PIN_SENSE, 0); |
| 8688 | present = (present & 0x80000000) != 0; |
| 8689 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8690 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8691 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8692 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8693 | } else { |
| 8694 | /* unmute internal speaker if necessary */ |
| 8695 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8696 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8697 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8698 | } |
| 8699 | } |
| 8700 | |
| 8701 | /* unsolicited event for HP jack sensing */ |
| 8702 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8703 | unsigned int res) |
| 8704 | { |
| 8705 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8706 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8707 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8708 | } |
| 8709 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8710 | /* |
| 8711 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8712 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8713 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8714 | */ |
| 8715 | |
| 8716 | #define ALC_HP_EVENT 0x37 |
| 8717 | |
| 8718 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8719 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8720 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8721 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8722 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8723 | {} |
| 8724 | }; |
| 8725 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8726 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8727 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8728 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8729 | {} |
| 8730 | }; |
| 8731 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8732 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8733 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8734 | .items = { |
| 8735 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8736 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8737 | { "CD", 0x4 }, |
| 8738 | }, |
| 8739 | }; |
| 8740 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8741 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8742 | .num_items = 5, |
| 8743 | .items = { |
| 8744 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8745 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8746 | { "Line", 0x2 }, |
| 8747 | { "CD", 0x4 }, |
| 8748 | { "AUX IN", 0x6 }, |
| 8749 | }, |
| 8750 | }; |
| 8751 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8752 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8753 | .num_items = 4, |
| 8754 | .items = { |
| 8755 | { "Mic", 0x0 }, |
| 8756 | { "Front Mic", 0x2 }, |
| 8757 | { "Line", 0x1 }, |
| 8758 | { "CD", 0x4 }, |
| 8759 | }, |
| 8760 | }; |
| 8761 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8762 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8763 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8764 | { |
| 8765 | struct alc_spec *spec = codec->spec; |
| 8766 | unsigned int mute; |
| 8767 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8768 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8769 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8770 | /* need to execute and sync at first */ |
| 8771 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8772 | /* check laptop HP jack */ |
| 8773 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8774 | AC_VERB_GET_PIN_SENSE, 0); |
| 8775 | /* need to execute and sync at first */ |
| 8776 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8777 | /* check docking HP jack */ |
| 8778 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 8779 | AC_VERB_GET_PIN_SENSE, 0); |
| 8780 | if (present & AC_PINSENSE_PRESENCE) |
| 8781 | spec->jack_present = 1; |
| 8782 | else |
| 8783 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8784 | spec->sense_updated = 1; |
| 8785 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8786 | /* unmute internal speaker only if both HPs are unplugged and |
| 8787 | * master switch is on |
| 8788 | */ |
| 8789 | if (spec->jack_present) |
| 8790 | mute = HDA_AMP_MUTE; |
| 8791 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8792 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8793 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8794 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8795 | } |
| 8796 | |
| 8797 | /* unsolicited event for HP jack sensing */ |
| 8798 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8799 | unsigned int res) |
| 8800 | { |
| 8801 | if ((res >> 26) != ALC_HP_EVENT) |
| 8802 | return; |
| 8803 | alc262_fujitsu_automute(codec, 1); |
| 8804 | } |
| 8805 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8806 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 8807 | { |
| 8808 | alc262_fujitsu_automute(codec, 1); |
| 8809 | } |
| 8810 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8811 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8812 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8813 | .ops = &snd_hda_bind_vol, |
| 8814 | .values = { |
| 8815 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8816 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8817 | 0 |
| 8818 | }, |
| 8819 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8820 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8821 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8822 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 8823 | { |
| 8824 | struct alc_spec *spec = codec->spec; |
| 8825 | unsigned int mute; |
| 8826 | |
| 8827 | if (force || !spec->sense_updated) { |
| 8828 | unsigned int present_int_hp; |
| 8829 | /* need to execute and sync at first */ |
| 8830 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8831 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8832 | AC_VERB_GET_PIN_SENSE, 0); |
| 8833 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8834 | spec->sense_updated = 1; |
| 8835 | } |
| 8836 | if (spec->jack_present) { |
| 8837 | /* mute internal speaker */ |
| 8838 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8839 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8840 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8841 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8842 | } else { |
| 8843 | /* unmute internal speaker if necessary */ |
| 8844 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8845 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8846 | HDA_AMP_MUTE, mute); |
| 8847 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8848 | HDA_AMP_MUTE, mute); |
| 8849 | } |
| 8850 | } |
| 8851 | |
| 8852 | /* unsolicited event for HP jack sensing */ |
| 8853 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 8854 | unsigned int res) |
| 8855 | { |
| 8856 | if ((res >> 26) != ALC_HP_EVENT) |
| 8857 | return; |
| 8858 | alc262_lenovo_3000_automute(codec, 1); |
| 8859 | } |
| 8860 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8861 | /* bind hp and internal speaker mute (with plug check) */ |
| 8862 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8863 | struct snd_ctl_elem_value *ucontrol) |
| 8864 | { |
| 8865 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8866 | long *valp = ucontrol->value.integer.value; |
| 8867 | int change; |
| 8868 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8869 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8870 | HDA_AMP_MUTE, |
| 8871 | valp ? 0 : HDA_AMP_MUTE); |
| 8872 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8873 | HDA_AMP_MUTE, |
| 8874 | valp ? 0 : HDA_AMP_MUTE); |
| 8875 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8876 | if (change) |
| 8877 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8878 | return change; |
| 8879 | } |
| 8880 | |
| 8881 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8882 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8883 | { |
| 8884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8885 | .name = "Master Playback Switch", |
| 8886 | .info = snd_hda_mixer_amp_switch_info, |
| 8887 | .get = snd_hda_mixer_amp_switch_get, |
| 8888 | .put = alc262_fujitsu_master_sw_put, |
| 8889 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8890 | }, |
| 8891 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8892 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 8893 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 8894 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8895 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8896 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8897 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8898 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8899 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8900 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8901 | { } /* end */ |
| 8902 | }; |
| 8903 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8904 | /* bind hp and internal speaker mute (with plug check) */ |
| 8905 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8906 | struct snd_ctl_elem_value *ucontrol) |
| 8907 | { |
| 8908 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8909 | long *valp = ucontrol->value.integer.value; |
| 8910 | int change; |
| 8911 | |
| 8912 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8913 | HDA_AMP_MUTE, |
| 8914 | valp ? 0 : HDA_AMP_MUTE); |
| 8915 | |
| 8916 | if (change) |
| 8917 | alc262_lenovo_3000_automute(codec, 0); |
| 8918 | return change; |
| 8919 | } |
| 8920 | |
| 8921 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 8922 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 8923 | { |
| 8924 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8925 | .name = "Master Playback Switch", |
| 8926 | .info = snd_hda_mixer_amp_switch_info, |
| 8927 | .get = snd_hda_mixer_amp_switch_get, |
| 8928 | .put = alc262_lenovo_3000_master_sw_put, |
| 8929 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8930 | }, |
| 8931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8933 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8934 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8935 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8936 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8937 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8938 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8939 | { } /* end */ |
| 8940 | }; |
| 8941 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8942 | /* additional init verbs for Benq laptops */ |
| 8943 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8944 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8945 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8946 | {} |
| 8947 | }; |
| 8948 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8949 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8950 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8951 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8952 | |
| 8953 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8954 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8955 | {} |
| 8956 | }; |
| 8957 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8958 | /* Samsung Q1 Ultra Vista model setup */ |
| 8959 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8960 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8961 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8962 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8963 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8964 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8965 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8966 | { } /* end */ |
| 8967 | }; |
| 8968 | |
| 8969 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8970 | /* output mixer */ |
| 8971 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8973 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8974 | /* speaker */ |
| 8975 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8976 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8978 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8979 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8980 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8981 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8982 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8983 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8985 | /* internal mic */ |
| 8986 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8988 | /* ADC, choose mic */ |
| 8989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8990 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8996 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 8998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8999 | {} |
| 9000 | }; |
| 9001 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9002 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9003 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9004 | { |
| 9005 | struct alc_spec *spec = codec->spec; |
| 9006 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9007 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9008 | mute = 0; |
| 9009 | /* auto-mute only when HP is used as HP */ |
| 9010 | if (!spec->cur_mux[0]) { |
| 9011 | unsigned int present; |
| 9012 | /* need to execute and sync at first */ |
| 9013 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9014 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9015 | AC_VERB_GET_PIN_SENSE, 0); |
| 9016 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9017 | if (spec->jack_present) |
| 9018 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9019 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9020 | /* mute/unmute internal speaker */ |
| 9021 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9022 | HDA_AMP_MUTE, mute); |
| 9023 | /* mute/unmute HP */ |
| 9024 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9025 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9026 | } |
| 9027 | |
| 9028 | /* unsolicited event for HP jack sensing */ |
| 9029 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9030 | unsigned int res) |
| 9031 | { |
| 9032 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9033 | return; |
| 9034 | alc262_ultra_automute(codec); |
| 9035 | } |
| 9036 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9037 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9038 | .num_items = 2, |
| 9039 | .items = { |
| 9040 | { "Mic", 0x1 }, |
| 9041 | { "Headphone", 0x7 }, |
| 9042 | }, |
| 9043 | }; |
| 9044 | |
| 9045 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9046 | struct snd_ctl_elem_value *ucontrol) |
| 9047 | { |
| 9048 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9049 | struct alc_spec *spec = codec->spec; |
| 9050 | int ret; |
| 9051 | |
| 9052 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9053 | if (!ret) |
| 9054 | return 0; |
| 9055 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9056 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9057 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9058 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9059 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9060 | return ret; |
| 9061 | } |
| 9062 | |
| 9063 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9064 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9065 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9066 | { |
| 9067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9068 | .name = "Capture Source", |
| 9069 | .info = alc882_mux_enum_info, |
| 9070 | .get = alc882_mux_enum_get, |
| 9071 | .put = alc262_ultra_mux_enum_put, |
| 9072 | }, |
| 9073 | { } /* end */ |
| 9074 | }; |
| 9075 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9076 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9077 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9078 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9079 | { |
| 9080 | hda_nid_t nid; |
| 9081 | int err; |
| 9082 | |
| 9083 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9084 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9085 | spec->multiout.dac_nids[0] = 2; |
| 9086 | |
| 9087 | nid = cfg->line_out_pins[0]; |
| 9088 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9089 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9090 | "Front Playback Volume", |
| 9091 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9092 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9093 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9094 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9095 | "Front Playback Switch", |
| 9096 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9097 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9098 | return err; |
| 9099 | } |
| 9100 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9101 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9102 | if (nid) { |
| 9103 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9104 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9105 | "Speaker Playback Volume", |
| 9106 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9107 | HDA_OUTPUT)); |
| 9108 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9109 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9110 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9111 | "Speaker Playback Switch", |
| 9112 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9113 | HDA_OUTPUT)); |
| 9114 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9115 | return err; |
| 9116 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9117 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9118 | "Speaker Playback Switch", |
| 9119 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9120 | HDA_OUTPUT)); |
| 9121 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9122 | return err; |
| 9123 | } |
| 9124 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9125 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9126 | if (nid) { |
| 9127 | /* spec->multiout.hp_nid = 2; */ |
| 9128 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9129 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9130 | "Headphone Playback Volume", |
| 9131 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9132 | HDA_OUTPUT)); |
| 9133 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9134 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9135 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9136 | "Headphone Playback Switch", |
| 9137 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9138 | HDA_OUTPUT)); |
| 9139 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9140 | return err; |
| 9141 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9142 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9143 | "Headphone Playback Switch", |
| 9144 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9145 | HDA_OUTPUT)); |
| 9146 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9147 | return err; |
| 9148 | } |
| 9149 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9150 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9151 | } |
| 9152 | |
| 9153 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9154 | #define alc262_auto_create_analog_input_ctls \ |
| 9155 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9156 | |
| 9157 | /* |
| 9158 | * generic initialization of ADC, input mixers and output mixers |
| 9159 | */ |
| 9160 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9161 | /* |
| 9162 | * Unmute ADC0-2 and set the default input to mic-in |
| 9163 | */ |
| 9164 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9165 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9166 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9167 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9168 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9169 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9170 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9171 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9172 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9173 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9174 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9175 | */ |
| 9176 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9177 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9178 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9179 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9182 | |
| 9183 | /* |
| 9184 | * Set up output mixers (0x0c - 0x0f) |
| 9185 | */ |
| 9186 | /* set vol=0 to output mixers */ |
| 9187 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9188 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9189 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9190 | |
| 9191 | /* set up input amps for analog loopback */ |
| 9192 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9193 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9195 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9196 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9197 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9198 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9199 | |
| 9200 | /* FIXME: use matrix-type input source selection */ |
| 9201 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9202 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9203 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9204 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9206 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9207 | /* Input mixer2 */ |
| 9208 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9212 | /* Input mixer3 */ |
| 9213 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9217 | |
| 9218 | { } |
| 9219 | }; |
| 9220 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9221 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9222 | /* |
| 9223 | * Unmute ADC0-2 and set the default input to mic-in |
| 9224 | */ |
| 9225 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9227 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9228 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9229 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9230 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9231 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9232 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9233 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9234 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9235 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9236 | */ |
| 9237 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9238 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9245 | |
| 9246 | /* |
| 9247 | * Set up output mixers (0x0c - 0x0e) |
| 9248 | */ |
| 9249 | /* set vol=0 to output mixers */ |
| 9250 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9251 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9252 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9253 | |
| 9254 | /* set up input amps for analog loopback */ |
| 9255 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9256 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9258 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9259 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9260 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9262 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9263 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9264 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9265 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9266 | |
| 9267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9268 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9269 | |
| 9270 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9271 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9272 | |
| 9273 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9274 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9275 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9276 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9277 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9278 | |
| 9279 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9280 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9281 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9282 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9283 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9284 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9285 | |
| 9286 | |
| 9287 | /* FIXME: use matrix-type input source selection */ |
| 9288 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9289 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9290 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9294 | /* Input mixer2 */ |
| 9295 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9299 | /* Input mixer3 */ |
| 9300 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9304 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9305 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9306 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9307 | { } |
| 9308 | }; |
| 9309 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9310 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9311 | /* |
| 9312 | * Unmute ADC0-2 and set the default input to mic-in |
| 9313 | */ |
| 9314 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9315 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9316 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9317 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9318 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9320 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9321 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9322 | * mixer widget |
| 9323 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9324 | * panel mic (mic 2) |
| 9325 | */ |
| 9326 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9327 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9330 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9335 | /* |
| 9336 | * Set up output mixers (0x0c - 0x0e) |
| 9337 | */ |
| 9338 | /* set vol=0 to output mixers */ |
| 9339 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9341 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9342 | |
| 9343 | /* set up input amps for analog loopback */ |
| 9344 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9345 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9347 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9350 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9351 | |
| 9352 | |
| 9353 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9354 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9355 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9356 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9357 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9358 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9359 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9360 | |
| 9361 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9362 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9363 | |
| 9364 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9365 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9366 | |
| 9367 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9368 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9370 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9371 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9372 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9373 | |
| 9374 | /* FIXME: use matrix-type input source selection */ |
| 9375 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9376 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9382 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9383 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9384 | /* Input mixer2 */ |
| 9385 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9390 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9391 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9392 | /* Input mixer3 */ |
| 9393 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9394 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9398 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9400 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9401 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9402 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9403 | { } |
| 9404 | }; |
| 9405 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9406 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9407 | #define alc262_loopbacks alc880_loopbacks |
| 9408 | #endif |
| 9409 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9410 | /* pcm configuration: identiacal with ALC880 */ |
| 9411 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9412 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9413 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9414 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9415 | |
| 9416 | /* |
| 9417 | * BIOS auto configuration |
| 9418 | */ |
| 9419 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9420 | { |
| 9421 | struct alc_spec *spec = codec->spec; |
| 9422 | int err; |
| 9423 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9424 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9425 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9426 | alc262_ignore); |
| 9427 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9428 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9429 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9430 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9431 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9432 | if (err < 0) |
| 9433 | return err; |
| 9434 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9435 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9436 | return err; |
| 9437 | |
| 9438 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9439 | |
| 9440 | if (spec->autocfg.dig_out_pin) |
| 9441 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9442 | if (spec->autocfg.dig_in_pin) |
| 9443 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9444 | |
| 9445 | if (spec->kctl_alloc) |
| 9446 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9447 | |
| 9448 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9449 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9450 | spec->input_mux = &spec->private_imux; |
| 9451 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9452 | err = alc_auto_add_mic_boost(codec); |
| 9453 | if (err < 0) |
| 9454 | return err; |
| 9455 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9456 | return 1; |
| 9457 | } |
| 9458 | |
| 9459 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9460 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9461 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9462 | |
| 9463 | |
| 9464 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9465 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9466 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9467 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9468 | alc262_auto_init_multi_out(codec); |
| 9469 | alc262_auto_init_hp_out(codec); |
| 9470 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9471 | if (spec->unsol_event) |
| 9472 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9473 | } |
| 9474 | |
| 9475 | /* |
| 9476 | * configuration and preset |
| 9477 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9478 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9479 | [ALC262_BASIC] = "basic", |
| 9480 | [ALC262_HIPPO] = "hippo", |
| 9481 | [ALC262_HIPPO_1] = "hippo_1", |
| 9482 | [ALC262_FUJITSU] = "fujitsu", |
| 9483 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9484 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9485 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9486 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9487 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9488 | [ALC262_BENQ_T31] = "benq-t31", |
| 9489 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9490 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9491 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9492 | [ALC262_AUTO] = "auto", |
| 9493 | }; |
| 9494 | |
| 9495 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9496 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9497 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9498 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9499 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9500 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9501 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9502 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9503 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9504 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9506 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9507 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9508 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9509 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9510 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9512 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9514 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9515 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9516 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9517 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9518 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9519 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9520 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9521 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9522 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9523 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9524 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9525 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9527 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9528 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9529 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9530 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9531 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9532 | {} |
| 9533 | }; |
| 9534 | |
| 9535 | static struct alc_config_preset alc262_presets[] = { |
| 9536 | [ALC262_BASIC] = { |
| 9537 | .mixers = { alc262_base_mixer }, |
| 9538 | .init_verbs = { alc262_init_verbs }, |
| 9539 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9540 | .dac_nids = alc262_dac_nids, |
| 9541 | .hp_nid = 0x03, |
| 9542 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9543 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9544 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9545 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9546 | [ALC262_HIPPO] = { |
| 9547 | .mixers = { alc262_base_mixer }, |
| 9548 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9549 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9550 | .dac_nids = alc262_dac_nids, |
| 9551 | .hp_nid = 0x03, |
| 9552 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9553 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9554 | .channel_mode = alc262_modes, |
| 9555 | .input_mux = &alc262_capture_source, |
| 9556 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9557 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9558 | }, |
| 9559 | [ALC262_HIPPO_1] = { |
| 9560 | .mixers = { alc262_hippo1_mixer }, |
| 9561 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9562 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9563 | .dac_nids = alc262_dac_nids, |
| 9564 | .hp_nid = 0x02, |
| 9565 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9566 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9567 | .channel_mode = alc262_modes, |
| 9568 | .input_mux = &alc262_capture_source, |
| 9569 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9570 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9571 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9572 | [ALC262_FUJITSU] = { |
| 9573 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9574 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9575 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9576 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9577 | .dac_nids = alc262_dac_nids, |
| 9578 | .hp_nid = 0x03, |
| 9579 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9580 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9581 | .channel_mode = alc262_modes, |
| 9582 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9583 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9584 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9585 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9586 | [ALC262_HP_BPC] = { |
| 9587 | .mixers = { alc262_HP_BPC_mixer }, |
| 9588 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9589 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9590 | .dac_nids = alc262_dac_nids, |
| 9591 | .hp_nid = 0x03, |
| 9592 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9593 | .channel_mode = alc262_modes, |
| 9594 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9595 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9596 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9597 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9598 | [ALC262_HP_BPC_D7000_WF] = { |
| 9599 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9600 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9601 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9602 | .dac_nids = alc262_dac_nids, |
| 9603 | .hp_nid = 0x03, |
| 9604 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9605 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9606 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9607 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9608 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9609 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9610 | [ALC262_HP_BPC_D7000_WL] = { |
| 9611 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9612 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9613 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9614 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9615 | .dac_nids = alc262_dac_nids, |
| 9616 | .hp_nid = 0x03, |
| 9617 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9618 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9619 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9620 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9621 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9622 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9623 | [ALC262_HP_TC_T5735] = { |
| 9624 | .mixers = { alc262_hp_t5735_mixer }, |
| 9625 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9626 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9627 | .dac_nids = alc262_dac_nids, |
| 9628 | .hp_nid = 0x03, |
| 9629 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9630 | .channel_mode = alc262_modes, |
| 9631 | .input_mux = &alc262_capture_source, |
| 9632 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9633 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9634 | }, |
| 9635 | [ALC262_HP_RP5700] = { |
| 9636 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9637 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9638 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9639 | .dac_nids = alc262_dac_nids, |
| 9640 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9641 | .channel_mode = alc262_modes, |
| 9642 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9643 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9644 | [ALC262_BENQ_ED8] = { |
| 9645 | .mixers = { alc262_base_mixer }, |
| 9646 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9647 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9648 | .dac_nids = alc262_dac_nids, |
| 9649 | .hp_nid = 0x03, |
| 9650 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9651 | .channel_mode = alc262_modes, |
| 9652 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9653 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9654 | [ALC262_SONY_ASSAMD] = { |
| 9655 | .mixers = { alc262_sony_mixer }, |
| 9656 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9657 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9658 | .dac_nids = alc262_dac_nids, |
| 9659 | .hp_nid = 0x02, |
| 9660 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9661 | .channel_mode = alc262_modes, |
| 9662 | .input_mux = &alc262_capture_source, |
| 9663 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9664 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9665 | }, |
| 9666 | [ALC262_BENQ_T31] = { |
| 9667 | .mixers = { alc262_benq_t31_mixer }, |
| 9668 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9669 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9670 | .dac_nids = alc262_dac_nids, |
| 9671 | .hp_nid = 0x03, |
| 9672 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9673 | .channel_mode = alc262_modes, |
| 9674 | .input_mux = &alc262_capture_source, |
| 9675 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9676 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9677 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9678 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9679 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9680 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9681 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9682 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9683 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9684 | .channel_mode = alc262_modes, |
| 9685 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9686 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9687 | .capsrc_nids = alc262_capsrc_nids, |
| 9688 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9689 | .unsol_event = alc262_ultra_unsol_event, |
| 9690 | .init_hook = alc262_ultra_automute, |
| 9691 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9692 | [ALC262_LENOVO_3000] = { |
| 9693 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9694 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9695 | alc262_lenovo_3000_unsol_verbs }, |
| 9696 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9697 | .dac_nids = alc262_dac_nids, |
| 9698 | .hp_nid = 0x03, |
| 9699 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9700 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9701 | .channel_mode = alc262_modes, |
| 9702 | .input_mux = &alc262_fujitsu_capture_source, |
| 9703 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9704 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9705 | }; |
| 9706 | |
| 9707 | static int patch_alc262(struct hda_codec *codec) |
| 9708 | { |
| 9709 | struct alc_spec *spec; |
| 9710 | int board_config; |
| 9711 | int err; |
| 9712 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9713 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9714 | if (spec == NULL) |
| 9715 | return -ENOMEM; |
| 9716 | |
| 9717 | codec->spec = spec; |
| 9718 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9719 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9720 | * under-run |
| 9721 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9722 | { |
| 9723 | int tmp; |
| 9724 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9725 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9726 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9727 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9728 | } |
| 9729 | #endif |
| 9730 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9731 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9732 | alc262_models, |
| 9733 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9734 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9735 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9736 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9737 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9738 | board_config = ALC262_AUTO; |
| 9739 | } |
| 9740 | |
| 9741 | if (board_config == ALC262_AUTO) { |
| 9742 | /* automatic parse from the BIOS config */ |
| 9743 | err = alc262_parse_auto_config(codec); |
| 9744 | if (err < 0) { |
| 9745 | alc_free(codec); |
| 9746 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9747 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9748 | printk(KERN_INFO |
| 9749 | "hda_codec: Cannot set up configuration " |
| 9750 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9751 | board_config = ALC262_BASIC; |
| 9752 | } |
| 9753 | } |
| 9754 | |
| 9755 | if (board_config != ALC262_AUTO) |
| 9756 | setup_preset(spec, &alc262_presets[board_config]); |
| 9757 | |
| 9758 | spec->stream_name_analog = "ALC262 Analog"; |
| 9759 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9760 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9761 | |
| 9762 | spec->stream_name_digital = "ALC262 Digital"; |
| 9763 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9764 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9765 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9766 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9767 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9768 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9769 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9770 | /* get type */ |
| 9771 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9772 | if (wcap != AC_WID_AUD_IN) { |
| 9773 | spec->adc_nids = alc262_adc_nids_alt; |
| 9774 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9775 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9776 | spec->mixers[spec->num_mixers] = |
| 9777 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9778 | spec->num_mixers++; |
| 9779 | } else { |
| 9780 | spec->adc_nids = alc262_adc_nids; |
| 9781 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9782 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9783 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9784 | spec->num_mixers++; |
| 9785 | } |
| 9786 | } |
| 9787 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9788 | spec->vmaster_nid = 0x0c; |
| 9789 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9790 | codec->patch_ops = alc_patch_ops; |
| 9791 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9792 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9793 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9794 | if (!spec->loopback.amplist) |
| 9795 | spec->loopback.amplist = alc262_loopbacks; |
| 9796 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9797 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9798 | return 0; |
| 9799 | } |
| 9800 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9801 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9802 | * ALC268 channel source setting (2 channel) |
| 9803 | */ |
| 9804 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9805 | #define alc268_modes alc260_modes |
| 9806 | |
| 9807 | static hda_nid_t alc268_dac_nids[2] = { |
| 9808 | /* front, hp */ |
| 9809 | 0x02, 0x03 |
| 9810 | }; |
| 9811 | |
| 9812 | static hda_nid_t alc268_adc_nids[2] = { |
| 9813 | /* ADC0-1 */ |
| 9814 | 0x08, 0x07 |
| 9815 | }; |
| 9816 | |
| 9817 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9818 | /* ADC0 */ |
| 9819 | 0x08 |
| 9820 | }; |
| 9821 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9822 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9823 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9824 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9825 | /* output mixer control */ |
| 9826 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9827 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9828 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9830 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9831 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9832 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9833 | { } |
| 9834 | }; |
| 9835 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9836 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9837 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9838 | .ops = &snd_hda_bind_sw, |
| 9839 | .values = { |
| 9840 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9841 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9842 | 0 |
| 9843 | }, |
| 9844 | }; |
| 9845 | |
| 9846 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9847 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9848 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9849 | { } |
| 9850 | }; |
| 9851 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9852 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9853 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9854 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9855 | { } |
| 9856 | }; |
| 9857 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9858 | /* Toshiba specific */ |
| 9859 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9860 | |
| 9861 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9863 | { } /* end */ |
| 9864 | }; |
| 9865 | |
| 9866 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9867 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9868 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9869 | .ops = &snd_hda_bind_vol, |
| 9870 | .values = { |
| 9871 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9872 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9873 | 0 |
| 9874 | }, |
| 9875 | }; |
| 9876 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9877 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9878 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9879 | { |
| 9880 | struct alc_spec *spec = codec->spec; |
| 9881 | unsigned int mute; |
| 9882 | |
| 9883 | if (force || !spec->sense_updated) { |
| 9884 | unsigned int present; |
| 9885 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9886 | AC_VERB_GET_PIN_SENSE, 0); |
| 9887 | spec->jack_present = (present & 0x80000000) != 0; |
| 9888 | spec->sense_updated = 1; |
| 9889 | } |
| 9890 | if (spec->jack_present) |
| 9891 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9892 | else /* unmute internal speaker if necessary */ |
| 9893 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9894 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9895 | HDA_AMP_MUTE, mute); |
| 9896 | } |
| 9897 | |
| 9898 | |
| 9899 | /* bind hp and internal speaker mute (with plug check) */ |
| 9900 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9901 | struct snd_ctl_elem_value *ucontrol) |
| 9902 | { |
| 9903 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9904 | long *valp = ucontrol->value.integer.value; |
| 9905 | int change; |
| 9906 | |
| 9907 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9908 | HDA_AMP_MUTE, |
| 9909 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9910 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9911 | HDA_AMP_MUTE, |
| 9912 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9913 | if (change) |
| 9914 | alc268_acer_automute(codec, 0); |
| 9915 | return change; |
| 9916 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9917 | |
| 9918 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9919 | /* output mixer control */ |
| 9920 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9921 | { |
| 9922 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9923 | .name = "Master Playback Switch", |
| 9924 | .info = snd_hda_mixer_amp_switch_info, |
| 9925 | .get = snd_hda_mixer_amp_switch_get, |
| 9926 | .put = alc268_acer_master_sw_put, |
| 9927 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9928 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9929 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9930 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9931 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9932 | { } |
| 9933 | }; |
| 9934 | |
| 9935 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9936 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 9937 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9938 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9939 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9940 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9941 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9942 | |
| 9943 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9944 | { } |
| 9945 | }; |
| 9946 | |
| 9947 | /* unsolicited event for HP jack sensing */ |
| 9948 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9949 | unsigned int res) |
| 9950 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9951 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9952 | return; |
| 9953 | alc268_toshiba_automute(codec); |
| 9954 | } |
| 9955 | |
| 9956 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9957 | unsigned int res) |
| 9958 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9959 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9960 | return; |
| 9961 | alc268_acer_automute(codec, 1); |
| 9962 | } |
| 9963 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9964 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9965 | { |
| 9966 | alc268_acer_automute(codec, 1); |
| 9967 | } |
| 9968 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9969 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9970 | /* output mixer control */ |
| 9971 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9972 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9973 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9974 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9975 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9976 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9977 | { } |
| 9978 | }; |
| 9979 | |
| 9980 | static struct hda_verb alc268_dell_verbs[] = { |
| 9981 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9982 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9983 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9984 | { } |
| 9985 | }; |
| 9986 | |
| 9987 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9988 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9989 | { |
| 9990 | unsigned int present; |
| 9991 | unsigned int mute; |
| 9992 | |
| 9993 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9994 | if (present & 0x80000000) |
| 9995 | mute = HDA_AMP_MUTE; |
| 9996 | else |
| 9997 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9998 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9999 | HDA_AMP_MUTE, mute); |
| 10000 | } |
| 10001 | |
| 10002 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10003 | unsigned int res) |
| 10004 | { |
| 10005 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10006 | return; |
| 10007 | alc268_dell_automute(codec); |
| 10008 | } |
| 10009 | |
| 10010 | #define alc268_dell_init_hook alc268_dell_automute |
| 10011 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10012 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10013 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10014 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10015 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10016 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10017 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10018 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10019 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10020 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10021 | { } |
| 10022 | }; |
| 10023 | |
| 10024 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10025 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10026 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10027 | { } |
| 10028 | }; |
| 10029 | |
| 10030 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10031 | { |
| 10032 | unsigned int present; |
| 10033 | |
| 10034 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10035 | & AC_PINSENSE_PRESENCE; |
| 10036 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10037 | present ? 0 : PIN_OUT); |
| 10038 | } |
| 10039 | |
| 10040 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10041 | { |
| 10042 | unsigned int present; |
| 10043 | |
| 10044 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10045 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10046 | snd_hda_codec_write(codec, 0x23, 0, |
| 10047 | AC_VERB_SET_CONNECT_SEL, |
| 10048 | present ? 0x00 : 0x01); |
| 10049 | } |
| 10050 | |
| 10051 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10052 | { |
| 10053 | alc267_quanta_il1_hp_automute(codec); |
| 10054 | alc267_quanta_il1_mic_automute(codec); |
| 10055 | } |
| 10056 | |
| 10057 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10058 | unsigned int res) |
| 10059 | { |
| 10060 | switch (res >> 26) { |
| 10061 | case ALC880_HP_EVENT: |
| 10062 | alc267_quanta_il1_hp_automute(codec); |
| 10063 | break; |
| 10064 | case ALC880_MIC_EVENT: |
| 10065 | alc267_quanta_il1_mic_automute(codec); |
| 10066 | break; |
| 10067 | } |
| 10068 | } |
| 10069 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10070 | /* |
| 10071 | * generic initialization of ADC, input mixers and output mixers |
| 10072 | */ |
| 10073 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10074 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10075 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10076 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10077 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10078 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10079 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10080 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10081 | |
| 10082 | /* |
| 10083 | * Set up output mixers (0x0c - 0x0e) |
| 10084 | */ |
| 10085 | /* set vol=0 to output mixers */ |
| 10086 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10087 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10088 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10089 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10090 | |
| 10091 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10092 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10093 | |
| 10094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10096 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10097 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10098 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10099 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10100 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10101 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10102 | |
| 10103 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10104 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10105 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10106 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10107 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10108 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10109 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10110 | |
| 10111 | /* set PCBEEP vol = 0, mute connections */ |
| 10112 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10114 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10115 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10116 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10117 | |
| 10118 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10119 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10120 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10121 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10122 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10123 | { } |
| 10124 | }; |
| 10125 | |
| 10126 | /* |
| 10127 | * generic initialization of ADC, input mixers and output mixers |
| 10128 | */ |
| 10129 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10130 | /* set output DAC */ |
| 10131 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10132 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10133 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10134 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10135 | |
| 10136 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10137 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10138 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10139 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10140 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10141 | |
| 10142 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10143 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10145 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10146 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10147 | |
| 10148 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10149 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10150 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10151 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10152 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10153 | /* set PCBEEP vol = 0, mute connections */ |
| 10154 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10155 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10156 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10157 | |
| 10158 | { } |
| 10159 | }; |
| 10160 | |
| 10161 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10162 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10163 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10164 | |
| 10165 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10166 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10167 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10168 | { |
| 10169 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10170 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10171 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10172 | */ |
| 10173 | /* .name = "Capture Source", */ |
| 10174 | .name = "Input Source", |
| 10175 | .count = 1, |
| 10176 | .info = alc268_mux_enum_info, |
| 10177 | .get = alc268_mux_enum_get, |
| 10178 | .put = alc268_mux_enum_put, |
| 10179 | }, |
| 10180 | { } /* end */ |
| 10181 | }; |
| 10182 | |
| 10183 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10184 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10185 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10186 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10187 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10188 | { |
| 10189 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10190 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10191 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10192 | */ |
| 10193 | /* .name = "Capture Source", */ |
| 10194 | .name = "Input Source", |
| 10195 | .count = 2, |
| 10196 | .info = alc268_mux_enum_info, |
| 10197 | .get = alc268_mux_enum_get, |
| 10198 | .put = alc268_mux_enum_put, |
| 10199 | }, |
| 10200 | { } /* end */ |
| 10201 | }; |
| 10202 | |
| 10203 | static struct hda_input_mux alc268_capture_source = { |
| 10204 | .num_items = 4, |
| 10205 | .items = { |
| 10206 | { "Mic", 0x0 }, |
| 10207 | { "Front Mic", 0x1 }, |
| 10208 | { "Line", 0x2 }, |
| 10209 | { "CD", 0x3 }, |
| 10210 | }, |
| 10211 | }; |
| 10212 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10213 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10214 | .num_items = 3, |
| 10215 | .items = { |
| 10216 | { "Mic", 0x0 }, |
| 10217 | { "Internal Mic", 0x6 }, |
| 10218 | { "Line", 0x2 }, |
| 10219 | }, |
| 10220 | }; |
| 10221 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10222 | #ifdef CONFIG_SND_DEBUG |
| 10223 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10224 | /* Volume widgets */ |
| 10225 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10226 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10227 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10228 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10229 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10230 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10231 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10232 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10233 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10234 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10235 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10236 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10237 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10238 | /* The below appears problematic on some hardwares */ |
| 10239 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10240 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10241 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10242 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10243 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10244 | |
| 10245 | /* Modes for retasking pin widgets */ |
| 10246 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10247 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10248 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10249 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10250 | |
| 10251 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10252 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10253 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10254 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10255 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10256 | |
| 10257 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10258 | * The ALC268 does not have an SPDIF input. |
| 10259 | */ |
| 10260 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10261 | |
| 10262 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10263 | * this output to turn on an external amplifier. |
| 10264 | */ |
| 10265 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10266 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10267 | |
| 10268 | { } /* end */ |
| 10269 | }; |
| 10270 | #endif |
| 10271 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10272 | /* create input playback/capture controls for the given pin */ |
| 10273 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10274 | const char *ctlname, int idx) |
| 10275 | { |
| 10276 | char name[32]; |
| 10277 | int err; |
| 10278 | |
| 10279 | sprintf(name, "%s Playback Volume", ctlname); |
| 10280 | if (nid == 0x14) { |
| 10281 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10282 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10283 | HDA_OUTPUT)); |
| 10284 | if (err < 0) |
| 10285 | return err; |
| 10286 | } else if (nid == 0x15) { |
| 10287 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10288 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10289 | HDA_OUTPUT)); |
| 10290 | if (err < 0) |
| 10291 | return err; |
| 10292 | } else |
| 10293 | return -1; |
| 10294 | sprintf(name, "%s Playback Switch", ctlname); |
| 10295 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10296 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10297 | if (err < 0) |
| 10298 | return err; |
| 10299 | return 0; |
| 10300 | } |
| 10301 | |
| 10302 | /* add playback controls from the parsed DAC table */ |
| 10303 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10304 | const struct auto_pin_cfg *cfg) |
| 10305 | { |
| 10306 | hda_nid_t nid; |
| 10307 | int err; |
| 10308 | |
| 10309 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10310 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10311 | spec->multiout.dac_nids[0] = 2; |
| 10312 | spec->multiout.dac_nids[1] = 3; |
| 10313 | |
| 10314 | nid = cfg->line_out_pins[0]; |
| 10315 | if (nid) |
| 10316 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10317 | |
| 10318 | nid = cfg->speaker_pins[0]; |
| 10319 | if (nid == 0x1d) { |
| 10320 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10321 | "Speaker Playback Volume", |
| 10322 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10323 | if (err < 0) |
| 10324 | return err; |
| 10325 | } |
| 10326 | nid = cfg->hp_pins[0]; |
| 10327 | if (nid) |
| 10328 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10329 | |
| 10330 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10331 | if (nid == 0x16) { |
| 10332 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10333 | "Mono Playback Switch", |
| 10334 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10335 | if (err < 0) |
| 10336 | return err; |
| 10337 | } |
| 10338 | return 0; |
| 10339 | } |
| 10340 | |
| 10341 | /* create playback/capture controls for input pins */ |
| 10342 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10343 | const struct auto_pin_cfg *cfg) |
| 10344 | { |
| 10345 | struct hda_input_mux *imux = &spec->private_imux; |
| 10346 | int i, idx1; |
| 10347 | |
| 10348 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10349 | switch(cfg->input_pins[i]) { |
| 10350 | case 0x18: |
| 10351 | idx1 = 0; /* Mic 1 */ |
| 10352 | break; |
| 10353 | case 0x19: |
| 10354 | idx1 = 1; /* Mic 2 */ |
| 10355 | break; |
| 10356 | case 0x1a: |
| 10357 | idx1 = 2; /* Line In */ |
| 10358 | break; |
| 10359 | case 0x1c: |
| 10360 | idx1 = 3; /* CD */ |
| 10361 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10362 | case 0x12: |
| 10363 | case 0x13: |
| 10364 | idx1 = 6; /* digital mics */ |
| 10365 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10366 | default: |
| 10367 | continue; |
| 10368 | } |
| 10369 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10370 | imux->items[imux->num_items].index = idx1; |
| 10371 | imux->num_items++; |
| 10372 | } |
| 10373 | return 0; |
| 10374 | } |
| 10375 | |
| 10376 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10377 | { |
| 10378 | struct alc_spec *spec = codec->spec; |
| 10379 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10380 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10381 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10382 | unsigned int dac_vol1, dac_vol2; |
| 10383 | |
| 10384 | if (speaker_nid) { |
| 10385 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10386 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10387 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10388 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10389 | AMP_IN_UNMUTE(1)); |
| 10390 | snd_hda_codec_write(codec, 0x10, 0, |
| 10391 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10392 | AMP_IN_UNMUTE(1)); |
| 10393 | } else { |
| 10394 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10395 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10396 | snd_hda_codec_write(codec, 0x10, 0, |
| 10397 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10398 | } |
| 10399 | |
| 10400 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10401 | if (line_nid == 0x14) |
| 10402 | dac_vol2 = AMP_OUT_ZERO; |
| 10403 | else if (line_nid == 0x15) |
| 10404 | dac_vol1 = AMP_OUT_ZERO; |
| 10405 | if (hp_nid == 0x14) |
| 10406 | dac_vol2 = AMP_OUT_ZERO; |
| 10407 | else if (hp_nid == 0x15) |
| 10408 | dac_vol1 = AMP_OUT_ZERO; |
| 10409 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10410 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10411 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10412 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10413 | |
| 10414 | snd_hda_codec_write(codec, 0x02, 0, |
| 10415 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10416 | snd_hda_codec_write(codec, 0x03, 0, |
| 10417 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10418 | } |
| 10419 | |
| 10420 | /* pcm configuration: identiacal with ALC880 */ |
| 10421 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10422 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10423 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10424 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10425 | |
| 10426 | /* |
| 10427 | * BIOS auto configuration |
| 10428 | */ |
| 10429 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10430 | { |
| 10431 | struct alc_spec *spec = codec->spec; |
| 10432 | int err; |
| 10433 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10434 | |
| 10435 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10436 | alc268_ignore); |
| 10437 | if (err < 0) |
| 10438 | return err; |
| 10439 | if (!spec->autocfg.line_outs) |
| 10440 | return 0; /* can't find valid BIOS pin config */ |
| 10441 | |
| 10442 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10443 | if (err < 0) |
| 10444 | return err; |
| 10445 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10446 | if (err < 0) |
| 10447 | return err; |
| 10448 | |
| 10449 | spec->multiout.max_channels = 2; |
| 10450 | |
| 10451 | /* digital only support output */ |
| 10452 | if (spec->autocfg.dig_out_pin) |
| 10453 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10454 | |
| 10455 | if (spec->kctl_alloc) |
| 10456 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10457 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10458 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10459 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10460 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10461 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10462 | spec->num_mux_defs = 1; |
| 10463 | spec->input_mux = &spec->private_imux; |
| 10464 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10465 | err = alc_auto_add_mic_boost(codec); |
| 10466 | if (err < 0) |
| 10467 | return err; |
| 10468 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10469 | return 1; |
| 10470 | } |
| 10471 | |
| 10472 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10473 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10474 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10475 | |
| 10476 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10477 | static void alc268_auto_init(struct hda_codec *codec) |
| 10478 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10479 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10480 | alc268_auto_init_multi_out(codec); |
| 10481 | alc268_auto_init_hp_out(codec); |
| 10482 | alc268_auto_init_mono_speaker_out(codec); |
| 10483 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10484 | if (spec->unsol_event) |
| 10485 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10486 | } |
| 10487 | |
| 10488 | /* |
| 10489 | * configuration and preset |
| 10490 | */ |
| 10491 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10492 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10493 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10494 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10495 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10496 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10497 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10498 | #ifdef CONFIG_SND_DEBUG |
| 10499 | [ALC268_TEST] = "test", |
| 10500 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10501 | [ALC268_AUTO] = "auto", |
| 10502 | }; |
| 10503 | |
| 10504 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10505 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10506 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10507 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10508 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10509 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10510 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10511 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10512 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10513 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10514 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10515 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10516 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10517 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10518 | {} |
| 10519 | }; |
| 10520 | |
| 10521 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10522 | [ALC267_QUANTA_IL1] = { |
| 10523 | .mixers = { alc267_quanta_il1_mixer }, |
| 10524 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10525 | alc267_quanta_il1_verbs }, |
| 10526 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10527 | .dac_nids = alc268_dac_nids, |
| 10528 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10529 | .adc_nids = alc268_adc_nids_alt, |
| 10530 | .hp_nid = 0x03, |
| 10531 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10532 | .channel_mode = alc268_modes, |
| 10533 | .input_mux = &alc268_capture_source, |
| 10534 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 10535 | .init_hook = alc267_quanta_il1_automute, |
| 10536 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10537 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10538 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10539 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10540 | .init_verbs = { alc268_base_init_verbs }, |
| 10541 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10542 | .dac_nids = alc268_dac_nids, |
| 10543 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10544 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10545 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10546 | .hp_nid = 0x03, |
| 10547 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10548 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10549 | .channel_mode = alc268_modes, |
| 10550 | .input_mux = &alc268_capture_source, |
| 10551 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10552 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10553 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10554 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10555 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10556 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10557 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10558 | .dac_nids = alc268_dac_nids, |
| 10559 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10560 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10561 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10562 | .hp_nid = 0x03, |
| 10563 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10564 | .channel_mode = alc268_modes, |
| 10565 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10566 | .unsol_event = alc268_toshiba_unsol_event, |
| 10567 | .init_hook = alc268_toshiba_automute, |
| 10568 | }, |
| 10569 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10570 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10571 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10572 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10573 | alc268_acer_verbs }, |
| 10574 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10575 | .dac_nids = alc268_dac_nids, |
| 10576 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10577 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10578 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10579 | .hp_nid = 0x02, |
| 10580 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10581 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10582 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10583 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10584 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10585 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10586 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10587 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10588 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10589 | alc268_dell_verbs }, |
| 10590 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10591 | .dac_nids = alc268_dac_nids, |
| 10592 | .hp_nid = 0x02, |
| 10593 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10594 | .channel_mode = alc268_modes, |
| 10595 | .unsol_event = alc268_dell_unsol_event, |
| 10596 | .init_hook = alc268_dell_init_hook, |
| 10597 | .input_mux = &alc268_capture_source, |
| 10598 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10599 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10600 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10601 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10602 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10603 | alc268_toshiba_verbs }, |
| 10604 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10605 | .dac_nids = alc268_dac_nids, |
| 10606 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10607 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10608 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10609 | .hp_nid = 0x03, |
| 10610 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10611 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10612 | .channel_mode = alc268_modes, |
| 10613 | .input_mux = &alc268_capture_source, |
| 10614 | .unsol_event = alc268_toshiba_unsol_event, |
| 10615 | .init_hook = alc268_toshiba_automute |
| 10616 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10617 | #ifdef CONFIG_SND_DEBUG |
| 10618 | [ALC268_TEST] = { |
| 10619 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10620 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10621 | alc268_volume_init_verbs }, |
| 10622 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10623 | .dac_nids = alc268_dac_nids, |
| 10624 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10625 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10626 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10627 | .hp_nid = 0x03, |
| 10628 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10629 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10630 | .channel_mode = alc268_modes, |
| 10631 | .input_mux = &alc268_capture_source, |
| 10632 | }, |
| 10633 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10634 | }; |
| 10635 | |
| 10636 | static int patch_alc268(struct hda_codec *codec) |
| 10637 | { |
| 10638 | struct alc_spec *spec; |
| 10639 | int board_config; |
| 10640 | int err; |
| 10641 | |
| 10642 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10643 | if (spec == NULL) |
| 10644 | return -ENOMEM; |
| 10645 | |
| 10646 | codec->spec = spec; |
| 10647 | |
| 10648 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10649 | alc268_models, |
| 10650 | alc268_cfg_tbl); |
| 10651 | |
| 10652 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10653 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10654 | "trying auto-probe from BIOS...\n"); |
| 10655 | board_config = ALC268_AUTO; |
| 10656 | } |
| 10657 | |
| 10658 | if (board_config == ALC268_AUTO) { |
| 10659 | /* automatic parse from the BIOS config */ |
| 10660 | err = alc268_parse_auto_config(codec); |
| 10661 | if (err < 0) { |
| 10662 | alc_free(codec); |
| 10663 | return err; |
| 10664 | } else if (!err) { |
| 10665 | printk(KERN_INFO |
| 10666 | "hda_codec: Cannot set up configuration " |
| 10667 | "from BIOS. Using base mode...\n"); |
| 10668 | board_config = ALC268_3ST; |
| 10669 | } |
| 10670 | } |
| 10671 | |
| 10672 | if (board_config != ALC268_AUTO) |
| 10673 | setup_preset(spec, &alc268_presets[board_config]); |
| 10674 | |
| 10675 | spec->stream_name_analog = "ALC268 Analog"; |
| 10676 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10677 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10678 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10679 | |
| 10680 | spec->stream_name_digital = "ALC268 Digital"; |
| 10681 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10682 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10683 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10684 | /* override the amp caps for beep generator */ |
| 10685 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10686 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10687 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10688 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10689 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10690 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10691 | if (!spec->adc_nids && spec->input_mux) { |
| 10692 | /* check whether NID 0x07 is valid */ |
| 10693 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10694 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10695 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10696 | /* get type */ |
| 10697 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10698 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10699 | spec->adc_nids = alc268_adc_nids_alt; |
| 10700 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10701 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10702 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10703 | spec->num_mixers++; |
| 10704 | } else { |
| 10705 | spec->adc_nids = alc268_adc_nids; |
| 10706 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10707 | spec->mixers[spec->num_mixers] = |
| 10708 | alc268_capture_mixer; |
| 10709 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10710 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10711 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10712 | /* set default input source */ |
| 10713 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10714 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10715 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10716 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10717 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10718 | |
| 10719 | spec->vmaster_nid = 0x02; |
| 10720 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10721 | codec->patch_ops = alc_patch_ops; |
| 10722 | if (board_config == ALC268_AUTO) |
| 10723 | spec->init_hook = alc268_auto_init; |
| 10724 | |
| 10725 | return 0; |
| 10726 | } |
| 10727 | |
| 10728 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10729 | * ALC269 channel source setting (2 channel) |
| 10730 | */ |
| 10731 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10732 | |
| 10733 | #define alc269_dac_nids alc260_dac_nids |
| 10734 | |
| 10735 | static hda_nid_t alc269_adc_nids[1] = { |
| 10736 | /* ADC1 */ |
| 10737 | 0x07, |
| 10738 | }; |
| 10739 | |
| 10740 | #define alc269_modes alc260_modes |
| 10741 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10742 | |
| 10743 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10744 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10745 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10746 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10747 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10748 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10749 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10750 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10751 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10752 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10753 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10754 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10755 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10756 | { } /* end */ |
| 10757 | }; |
| 10758 | |
| 10759 | /* capture mixer elements */ |
| 10760 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10761 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10762 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10763 | { |
| 10764 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10765 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10766 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10767 | */ |
| 10768 | /* .name = "Capture Source", */ |
| 10769 | .name = "Input Source", |
| 10770 | .count = 1, |
| 10771 | .info = alc_mux_enum_info, |
| 10772 | .get = alc_mux_enum_get, |
| 10773 | .put = alc_mux_enum_put, |
| 10774 | }, |
| 10775 | { } /* end */ |
| 10776 | }; |
| 10777 | |
| 10778 | /* |
| 10779 | * generic initialization of ADC, input mixers and output mixers |
| 10780 | */ |
| 10781 | static struct hda_verb alc269_init_verbs[] = { |
| 10782 | /* |
| 10783 | * Unmute ADC0 and set the default input to mic-in |
| 10784 | */ |
| 10785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10786 | |
| 10787 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10788 | * analog-loopback mixer widget |
| 10789 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10790 | * front panel mic (mic 2) |
| 10791 | */ |
| 10792 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10793 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10794 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10798 | |
| 10799 | /* |
| 10800 | * Set up output mixers (0x0c - 0x0e) |
| 10801 | */ |
| 10802 | /* set vol=0 to output mixers */ |
| 10803 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10804 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10805 | |
| 10806 | /* set up input amps for analog loopback */ |
| 10807 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10810 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10811 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10812 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10813 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10814 | |
| 10815 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10816 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10817 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10818 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10819 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10820 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10821 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10822 | |
| 10823 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10825 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10827 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10828 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10829 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10830 | |
| 10831 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10832 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10833 | |
| 10834 | /* FIXME: use matrix-type input source selection */ |
| 10835 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10836 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10837 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10838 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10840 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10841 | |
| 10842 | /* set EAPD */ |
| 10843 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10844 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10845 | { } |
| 10846 | }; |
| 10847 | |
| 10848 | /* add playback controls from the parsed DAC table */ |
| 10849 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10850 | const struct auto_pin_cfg *cfg) |
| 10851 | { |
| 10852 | hda_nid_t nid; |
| 10853 | int err; |
| 10854 | |
| 10855 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10856 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10857 | spec->multiout.dac_nids[0] = 2; |
| 10858 | |
| 10859 | nid = cfg->line_out_pins[0]; |
| 10860 | if (nid) { |
| 10861 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10862 | "Front Playback Volume", |
| 10863 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10864 | if (err < 0) |
| 10865 | return err; |
| 10866 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10867 | "Front Playback Switch", |
| 10868 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10869 | if (err < 0) |
| 10870 | return err; |
| 10871 | } |
| 10872 | |
| 10873 | nid = cfg->speaker_pins[0]; |
| 10874 | if (nid) { |
| 10875 | if (!cfg->line_out_pins[0]) { |
| 10876 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10877 | "Speaker Playback Volume", |
| 10878 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10879 | HDA_OUTPUT)); |
| 10880 | if (err < 0) |
| 10881 | return err; |
| 10882 | } |
| 10883 | if (nid == 0x16) { |
| 10884 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10885 | "Speaker Playback Switch", |
| 10886 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10887 | HDA_OUTPUT)); |
| 10888 | if (err < 0) |
| 10889 | return err; |
| 10890 | } else { |
| 10891 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10892 | "Speaker Playback Switch", |
| 10893 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10894 | HDA_OUTPUT)); |
| 10895 | if (err < 0) |
| 10896 | return err; |
| 10897 | } |
| 10898 | } |
| 10899 | nid = cfg->hp_pins[0]; |
| 10900 | if (nid) { |
| 10901 | /* spec->multiout.hp_nid = 2; */ |
| 10902 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10903 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10904 | "Headphone Playback Volume", |
| 10905 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10906 | HDA_OUTPUT)); |
| 10907 | if (err < 0) |
| 10908 | return err; |
| 10909 | } |
| 10910 | if (nid == 0x16) { |
| 10911 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10912 | "Headphone Playback Switch", |
| 10913 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10914 | HDA_OUTPUT)); |
| 10915 | if (err < 0) |
| 10916 | return err; |
| 10917 | } else { |
| 10918 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10919 | "Headphone Playback Switch", |
| 10920 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10921 | HDA_OUTPUT)); |
| 10922 | if (err < 0) |
| 10923 | return err; |
| 10924 | } |
| 10925 | } |
| 10926 | return 0; |
| 10927 | } |
| 10928 | |
| 10929 | #define alc269_auto_create_analog_input_ctls \ |
| 10930 | alc880_auto_create_analog_input_ctls |
| 10931 | |
| 10932 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10933 | #define alc269_loopbacks alc880_loopbacks |
| 10934 | #endif |
| 10935 | |
| 10936 | /* pcm configuration: identiacal with ALC880 */ |
| 10937 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10938 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10939 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10940 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10941 | |
| 10942 | /* |
| 10943 | * BIOS auto configuration |
| 10944 | */ |
| 10945 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10946 | { |
| 10947 | struct alc_spec *spec = codec->spec; |
| 10948 | int err; |
| 10949 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10950 | |
| 10951 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10952 | alc269_ignore); |
| 10953 | if (err < 0) |
| 10954 | return err; |
| 10955 | |
| 10956 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10957 | if (err < 0) |
| 10958 | return err; |
| 10959 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10960 | if (err < 0) |
| 10961 | return err; |
| 10962 | |
| 10963 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10964 | |
| 10965 | if (spec->autocfg.dig_out_pin) |
| 10966 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10967 | |
| 10968 | if (spec->kctl_alloc) |
| 10969 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10970 | |
| 10971 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10972 | spec->num_mux_defs = 1; |
| 10973 | spec->input_mux = &spec->private_imux; |
| 10974 | |
| 10975 | err = alc_auto_add_mic_boost(codec); |
| 10976 | if (err < 0) |
| 10977 | return err; |
| 10978 | |
| 10979 | return 1; |
| 10980 | } |
| 10981 | |
| 10982 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10983 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10984 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10985 | |
| 10986 | |
| 10987 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10988 | static void alc269_auto_init(struct hda_codec *codec) |
| 10989 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10990 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10991 | alc269_auto_init_multi_out(codec); |
| 10992 | alc269_auto_init_hp_out(codec); |
| 10993 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10994 | if (spec->unsol_event) |
| 10995 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10996 | } |
| 10997 | |
| 10998 | /* |
| 10999 | * configuration and preset |
| 11000 | */ |
| 11001 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11002 | [ALC269_BASIC] = "basic", |
| 11003 | }; |
| 11004 | |
| 11005 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 11006 | {} |
| 11007 | }; |
| 11008 | |
| 11009 | static struct alc_config_preset alc269_presets[] = { |
| 11010 | [ALC269_BASIC] = { |
| 11011 | .mixers = { alc269_base_mixer }, |
| 11012 | .init_verbs = { alc269_init_verbs }, |
| 11013 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11014 | .dac_nids = alc269_dac_nids, |
| 11015 | .hp_nid = 0x03, |
| 11016 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11017 | .channel_mode = alc269_modes, |
| 11018 | .input_mux = &alc269_capture_source, |
| 11019 | }, |
| 11020 | }; |
| 11021 | |
| 11022 | static int patch_alc269(struct hda_codec *codec) |
| 11023 | { |
| 11024 | struct alc_spec *spec; |
| 11025 | int board_config; |
| 11026 | int err; |
| 11027 | |
| 11028 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11029 | if (spec == NULL) |
| 11030 | return -ENOMEM; |
| 11031 | |
| 11032 | codec->spec = spec; |
| 11033 | |
| 11034 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11035 | alc269_models, |
| 11036 | alc269_cfg_tbl); |
| 11037 | |
| 11038 | if (board_config < 0) { |
| 11039 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11040 | "trying auto-probe from BIOS...\n"); |
| 11041 | board_config = ALC269_AUTO; |
| 11042 | } |
| 11043 | |
| 11044 | if (board_config == ALC269_AUTO) { |
| 11045 | /* automatic parse from the BIOS config */ |
| 11046 | err = alc269_parse_auto_config(codec); |
| 11047 | if (err < 0) { |
| 11048 | alc_free(codec); |
| 11049 | return err; |
| 11050 | } else if (!err) { |
| 11051 | printk(KERN_INFO |
| 11052 | "hda_codec: Cannot set up configuration " |
| 11053 | "from BIOS. Using base mode...\n"); |
| 11054 | board_config = ALC269_BASIC; |
| 11055 | } |
| 11056 | } |
| 11057 | |
| 11058 | if (board_config != ALC269_AUTO) |
| 11059 | setup_preset(spec, &alc269_presets[board_config]); |
| 11060 | |
| 11061 | spec->stream_name_analog = "ALC269 Analog"; |
| 11062 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11063 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11064 | |
| 11065 | spec->stream_name_digital = "ALC269 Digital"; |
| 11066 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11067 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11068 | |
| 11069 | spec->adc_nids = alc269_adc_nids; |
| 11070 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 11071 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11072 | spec->num_mixers++; |
| 11073 | |
| 11074 | codec->patch_ops = alc_patch_ops; |
| 11075 | if (board_config == ALC269_AUTO) |
| 11076 | spec->init_hook = alc269_auto_init; |
| 11077 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11078 | if (!spec->loopback.amplist) |
| 11079 | spec->loopback.amplist = alc269_loopbacks; |
| 11080 | #endif |
| 11081 | |
| 11082 | return 0; |
| 11083 | } |
| 11084 | |
| 11085 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11086 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11087 | */ |
| 11088 | |
| 11089 | /* |
| 11090 | * set the path ways for 2 channel output |
| 11091 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11092 | */ |
| 11093 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11094 | /* set pin widget 1Ah (line in) for input */ |
| 11095 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11096 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11097 | * the vref |
| 11098 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11099 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11100 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11101 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11102 | #if 0 |
| 11103 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11104 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11105 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11106 | { } /* end */ |
| 11107 | }; |
| 11108 | /* |
| 11109 | * 6ch mode |
| 11110 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11111 | */ |
| 11112 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11113 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11114 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11115 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11116 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11117 | |
| 11118 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11119 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11120 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11121 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11122 | #if 0 |
| 11123 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11124 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11125 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11126 | { } /* end */ |
| 11127 | }; |
| 11128 | |
| 11129 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11130 | { 2, alc861_threestack_ch2_init }, |
| 11131 | { 6, alc861_threestack_ch6_init }, |
| 11132 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11133 | /* Set mic1 as input and unmute the mixer */ |
| 11134 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11135 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11136 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11137 | { } /* end */ |
| 11138 | }; |
| 11139 | /* Set mic1 as output and mute mixer */ |
| 11140 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11141 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11142 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11143 | { } /* end */ |
| 11144 | }; |
| 11145 | |
| 11146 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11147 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11148 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11149 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11150 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11151 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11152 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11153 | /* set pin widget 1Ah (line in) for input */ |
| 11154 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11155 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11156 | * the vref |
| 11157 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11158 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11159 | |
| 11160 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11161 | #if 0 |
| 11162 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11163 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11164 | #endif |
| 11165 | { } /* end */ |
| 11166 | }; |
| 11167 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11168 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11169 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11170 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11171 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11172 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11173 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11174 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11175 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11176 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11177 | |
| 11178 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11179 | #if 0 |
| 11180 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11181 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11182 | #endif |
| 11183 | { } /* end */ |
| 11184 | }; |
| 11185 | |
| 11186 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11187 | { 2, alc861_asus_ch2_init }, |
| 11188 | { 6, alc861_asus_ch6_init }, |
| 11189 | }; |
| 11190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11191 | /* patch-ALC861 */ |
| 11192 | |
| 11193 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11194 | /* output mixer control */ |
| 11195 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11196 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11197 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11198 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11199 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11200 | |
| 11201 | /*Input mixer control */ |
| 11202 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11203 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11204 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11205 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11206 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11207 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11208 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11209 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11210 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11211 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11212 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11213 | /* Capture mixer control */ |
| 11214 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11215 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11216 | { |
| 11217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11218 | .name = "Capture Source", |
| 11219 | .count = 1, |
| 11220 | .info = alc_mux_enum_info, |
| 11221 | .get = alc_mux_enum_get, |
| 11222 | .put = alc_mux_enum_put, |
| 11223 | }, |
| 11224 | { } /* end */ |
| 11225 | }; |
| 11226 | |
| 11227 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11228 | /* output mixer control */ |
| 11229 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11230 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11231 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11232 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11233 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11234 | |
| 11235 | /* Input mixer control */ |
| 11236 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11237 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11238 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11239 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11240 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11241 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11242 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11243 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11244 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11245 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11246 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11247 | /* Capture mixer control */ |
| 11248 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11249 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11250 | { |
| 11251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11252 | .name = "Capture Source", |
| 11253 | .count = 1, |
| 11254 | .info = alc_mux_enum_info, |
| 11255 | .get = alc_mux_enum_get, |
| 11256 | .put = alc_mux_enum_put, |
| 11257 | }, |
| 11258 | { |
| 11259 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11260 | .name = "Channel Mode", |
| 11261 | .info = alc_ch_mode_info, |
| 11262 | .get = alc_ch_mode_get, |
| 11263 | .put = alc_ch_mode_put, |
| 11264 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11265 | }, |
| 11266 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11267 | }; |
| 11268 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11269 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11270 | /* output mixer control */ |
| 11271 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11272 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11273 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11274 | |
| 11275 | /*Capture mixer control */ |
| 11276 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11277 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11278 | { |
| 11279 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11280 | .name = "Capture Source", |
| 11281 | .count = 1, |
| 11282 | .info = alc_mux_enum_info, |
| 11283 | .get = alc_mux_enum_get, |
| 11284 | .put = alc_mux_enum_put, |
| 11285 | }, |
| 11286 | |
| 11287 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11288 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11289 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11290 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11291 | /* output mixer control */ |
| 11292 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11293 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11294 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11295 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11296 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11297 | |
| 11298 | /* Input mixer control */ |
| 11299 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11300 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11301 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11302 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11303 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11304 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11305 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11306 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11307 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11308 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11309 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11310 | /* Capture mixer control */ |
| 11311 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11312 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11313 | { |
| 11314 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11315 | .name = "Capture Source", |
| 11316 | .count = 1, |
| 11317 | .info = alc_mux_enum_info, |
| 11318 | .get = alc_mux_enum_get, |
| 11319 | .put = alc_mux_enum_put, |
| 11320 | }, |
| 11321 | { |
| 11322 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11323 | .name = "Channel Mode", |
| 11324 | .info = alc_ch_mode_info, |
| 11325 | .get = alc_ch_mode_get, |
| 11326 | .put = alc_ch_mode_put, |
| 11327 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11328 | }, |
| 11329 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11330 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11331 | |
| 11332 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11333 | /* output mixer control */ |
| 11334 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11335 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11336 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11337 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11339 | |
| 11340 | /* Input mixer control */ |
| 11341 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11342 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11343 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11344 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11345 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11346 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11347 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11348 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11349 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11351 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11352 | /* Capture mixer control */ |
| 11353 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11354 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11355 | { |
| 11356 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11357 | .name = "Capture Source", |
| 11358 | .count = 1, |
| 11359 | .info = alc_mux_enum_info, |
| 11360 | .get = alc_mux_enum_get, |
| 11361 | .put = alc_mux_enum_put, |
| 11362 | }, |
| 11363 | { |
| 11364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11365 | .name = "Channel Mode", |
| 11366 | .info = alc_ch_mode_info, |
| 11367 | .get = alc_ch_mode_get, |
| 11368 | .put = alc_ch_mode_put, |
| 11369 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11370 | }, |
| 11371 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11372 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11373 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11374 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11375 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11376 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11377 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11378 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11379 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11380 | { } |
| 11381 | }; |
| 11382 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11383 | /* |
| 11384 | * generic initialization of ADC, input mixers and output mixers |
| 11385 | */ |
| 11386 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11387 | /* |
| 11388 | * Unmute ADC0 and set the default input to mic-in |
| 11389 | */ |
| 11390 | /* port-A for surround (rear panel) */ |
| 11391 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11392 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11393 | /* port-B for mic-in (rear panel) with vref */ |
| 11394 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11395 | /* port-C for line-in (rear panel) */ |
| 11396 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11397 | /* port-D for Front */ |
| 11398 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11399 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11400 | /* port-E for HP out (front panel) */ |
| 11401 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11402 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11403 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11404 | /* port-F for mic-in (front panel) with vref */ |
| 11405 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11406 | /* port-G for CLFE (rear panel) */ |
| 11407 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11408 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11409 | /* port-H for side (rear panel) */ |
| 11410 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11411 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11412 | /* CD-in */ |
| 11413 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11414 | /* route front mic to ADC1*/ |
| 11415 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11416 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11417 | |
| 11418 | /* Unmute DAC0~3 & spdif out*/ |
| 11419 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11420 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11421 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11422 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11423 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11424 | |
| 11425 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11426 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11427 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11428 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11429 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11430 | |
| 11431 | /* Unmute Stereo Mixer 15 */ |
| 11432 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11433 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11435 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11436 | |
| 11437 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11438 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11439 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11440 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11441 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11442 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11443 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11444 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | /* hp used DAC 3 (Front) */ |
| 11446 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11448 | |
| 11449 | { } |
| 11450 | }; |
| 11451 | |
| 11452 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11453 | /* |
| 11454 | * Unmute ADC0 and set the default input to mic-in |
| 11455 | */ |
| 11456 | /* port-A for surround (rear panel) */ |
| 11457 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11458 | /* port-B for mic-in (rear panel) with vref */ |
| 11459 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11460 | /* port-C for line-in (rear panel) */ |
| 11461 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11462 | /* port-D for Front */ |
| 11463 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11464 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11465 | /* port-E for HP out (front panel) */ |
| 11466 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11467 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11468 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11469 | /* port-F for mic-in (front panel) with vref */ |
| 11470 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11471 | /* port-G for CLFE (rear panel) */ |
| 11472 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11473 | /* port-H for side (rear panel) */ |
| 11474 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11475 | /* CD-in */ |
| 11476 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11477 | /* route front mic to ADC1*/ |
| 11478 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11479 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11480 | /* Unmute DAC0~3 & spdif out*/ |
| 11481 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11482 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11483 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11484 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11485 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11486 | |
| 11487 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11488 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11489 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11490 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11491 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11492 | |
| 11493 | /* Unmute Stereo Mixer 15 */ |
| 11494 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11495 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11496 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11498 | |
| 11499 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11500 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11501 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11502 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11503 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11504 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11505 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11506 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11507 | /* hp used DAC 3 (Front) */ |
| 11508 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11509 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11510 | { } |
| 11511 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11512 | |
| 11513 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11514 | /* |
| 11515 | * Unmute ADC0 and set the default input to mic-in |
| 11516 | */ |
| 11517 | /* port-A for surround (rear panel) */ |
| 11518 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11519 | /* port-B for mic-in (rear panel) with vref */ |
| 11520 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11521 | /* port-C for line-in (rear panel) */ |
| 11522 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11523 | /* port-D for Front */ |
| 11524 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11525 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11526 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11527 | /* this has to be set to VREF80 */ |
| 11528 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11529 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11530 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11531 | /* port-F for mic-in (front panel) with vref */ |
| 11532 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11533 | /* port-G for CLFE (rear panel) */ |
| 11534 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11535 | /* port-H for side (rear panel) */ |
| 11536 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11537 | /* CD-in */ |
| 11538 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11539 | /* route front mic to ADC1*/ |
| 11540 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11541 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11542 | /* Unmute DAC0~3 & spdif out*/ |
| 11543 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11544 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11545 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11546 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11548 | |
| 11549 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11550 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11551 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11552 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11553 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11554 | |
| 11555 | /* Unmute Stereo Mixer 15 */ |
| 11556 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11557 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11560 | |
| 11561 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11562 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11563 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11564 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11565 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11566 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11567 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11569 | /* hp used DAC 3 (Front) */ |
| 11570 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11572 | { } |
| 11573 | }; |
| 11574 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11575 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11576 | /* |
| 11577 | * Unmute ADC0 and set the default input to mic-in |
| 11578 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11579 | /* port-A for surround (rear panel) |
| 11580 | * according to codec#0 this is the HP jack |
| 11581 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11582 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11583 | /* route front PCM to HP */ |
| 11584 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11585 | /* port-B for mic-in (rear panel) with vref */ |
| 11586 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11587 | /* port-C for line-in (rear panel) */ |
| 11588 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11589 | /* port-D for Front */ |
| 11590 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11591 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11592 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11593 | /* this has to be set to VREF80 */ |
| 11594 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11595 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11596 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11597 | /* port-F for mic-in (front panel) with vref */ |
| 11598 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11599 | /* port-G for CLFE (rear panel) */ |
| 11600 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11601 | /* port-H for side (rear panel) */ |
| 11602 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11603 | /* CD-in */ |
| 11604 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11605 | /* route front mic to ADC1*/ |
| 11606 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11607 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11608 | /* Unmute DAC0~3 & spdif out*/ |
| 11609 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11610 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11611 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11612 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11614 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11615 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11616 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11617 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11618 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11619 | |
| 11620 | /* Unmute Stereo Mixer 15 */ |
| 11621 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11622 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11625 | |
| 11626 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11627 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11628 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11629 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11630 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11631 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11632 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11634 | /* hp used DAC 3 (Front) */ |
| 11635 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11637 | { } |
| 11638 | }; |
| 11639 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11640 | /* additional init verbs for ASUS laptops */ |
| 11641 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11642 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11643 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11644 | { } |
| 11645 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11646 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11647 | /* |
| 11648 | * generic initialization of ADC, input mixers and output mixers |
| 11649 | */ |
| 11650 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11651 | /* |
| 11652 | * Unmute ADC0 and set the default input to mic-in |
| 11653 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11654 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11656 | |
| 11657 | /* Unmute DAC0~3 & spdif out*/ |
| 11658 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11659 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11660 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11661 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11662 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11663 | |
| 11664 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11665 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11666 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11667 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11668 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11669 | |
| 11670 | /* Unmute Stereo Mixer 15 */ |
| 11671 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11672 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11675 | |
| 11676 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11677 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11678 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11679 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11680 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11681 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11682 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11683 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11684 | |
| 11685 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11686 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11688 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11689 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11690 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11691 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11692 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11693 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11694 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11695 | |
| 11696 | { } |
| 11697 | }; |
| 11698 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11699 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11700 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11701 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11702 | { } |
| 11703 | }; |
| 11704 | |
| 11705 | /* toggle speaker-output according to the hp-jack state */ |
| 11706 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11707 | { |
| 11708 | unsigned int present; |
| 11709 | |
| 11710 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11711 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11712 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11713 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11714 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11715 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11716 | } |
| 11717 | |
| 11718 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11719 | unsigned int res) |
| 11720 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11721 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11722 | alc861_toshiba_automute(codec); |
| 11723 | } |
| 11724 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11725 | /* pcm configuration: identiacal with ALC880 */ |
| 11726 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11727 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11728 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11729 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11730 | |
| 11731 | |
| 11732 | #define ALC861_DIGOUT_NID 0x07 |
| 11733 | |
| 11734 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11735 | { 8, NULL } |
| 11736 | }; |
| 11737 | |
| 11738 | static hda_nid_t alc861_dac_nids[4] = { |
| 11739 | /* front, surround, clfe, side */ |
| 11740 | 0x03, 0x06, 0x05, 0x04 |
| 11741 | }; |
| 11742 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11743 | static hda_nid_t alc660_dac_nids[3] = { |
| 11744 | /* front, clfe, surround */ |
| 11745 | 0x03, 0x05, 0x06 |
| 11746 | }; |
| 11747 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11748 | static hda_nid_t alc861_adc_nids[1] = { |
| 11749 | /* ADC0-2 */ |
| 11750 | 0x08, |
| 11751 | }; |
| 11752 | |
| 11753 | static struct hda_input_mux alc861_capture_source = { |
| 11754 | .num_items = 5, |
| 11755 | .items = { |
| 11756 | { "Mic", 0x0 }, |
| 11757 | { "Front Mic", 0x3 }, |
| 11758 | { "Line", 0x1 }, |
| 11759 | { "CD", 0x4 }, |
| 11760 | { "Mixer", 0x5 }, |
| 11761 | }, |
| 11762 | }; |
| 11763 | |
| 11764 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11765 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11766 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11767 | { |
| 11768 | int i; |
| 11769 | hda_nid_t nid; |
| 11770 | |
| 11771 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11772 | for (i = 0; i < cfg->line_outs; i++) { |
| 11773 | nid = cfg->line_out_pins[i]; |
| 11774 | if (nid) { |
| 11775 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11776 | continue; |
| 11777 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11778 | } |
| 11779 | } |
| 11780 | spec->multiout.num_dacs = cfg->line_outs; |
| 11781 | return 0; |
| 11782 | } |
| 11783 | |
| 11784 | /* add playback controls from the parsed DAC table */ |
| 11785 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11786 | const struct auto_pin_cfg *cfg) |
| 11787 | { |
| 11788 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11789 | static const char *chname[4] = { |
| 11790 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11791 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11792 | hda_nid_t nid; |
| 11793 | int i, idx, err; |
| 11794 | |
| 11795 | for (i = 0; i < cfg->line_outs; i++) { |
| 11796 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11797 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11798 | continue; |
| 11799 | if (nid == 0x05) { |
| 11800 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11801 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11802 | "Center Playback Switch", |
| 11803 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11804 | HDA_OUTPUT)); |
| 11805 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11806 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11807 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11808 | "LFE Playback Switch", |
| 11809 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11810 | HDA_OUTPUT)); |
| 11811 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11812 | return err; |
| 11813 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11814 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11815 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11816 | if (nid == alc861_dac_nids[idx]) |
| 11817 | break; |
| 11818 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11819 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11820 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11821 | HDA_OUTPUT)); |
| 11822 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11823 | return err; |
| 11824 | } |
| 11825 | } |
| 11826 | return 0; |
| 11827 | } |
| 11828 | |
| 11829 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11830 | { |
| 11831 | int err; |
| 11832 | hda_nid_t nid; |
| 11833 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11834 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11835 | return 0; |
| 11836 | |
| 11837 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11838 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11839 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11840 | "Headphone Playback Switch", |
| 11841 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11842 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11843 | return err; |
| 11844 | spec->multiout.hp_nid = nid; |
| 11845 | } |
| 11846 | return 0; |
| 11847 | } |
| 11848 | |
| 11849 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11850 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11851 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11852 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11853 | struct hda_input_mux *imux = &spec->private_imux; |
| 11854 | int i, err, idx, idx1; |
| 11855 | |
| 11856 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11857 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11858 | case 0x0c: |
| 11859 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11860 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11861 | break; |
| 11862 | case 0x0f: |
| 11863 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11864 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11865 | break; |
| 11866 | case 0x0d: |
| 11867 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11868 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11869 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11870 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11871 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11872 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11873 | break; |
| 11874 | case 0x11: |
| 11875 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11876 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11877 | break; |
| 11878 | default: |
| 11879 | continue; |
| 11880 | } |
| 11881 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11882 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11883 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11884 | if (err < 0) |
| 11885 | return err; |
| 11886 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11887 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11888 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11889 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11890 | } |
| 11891 | return 0; |
| 11892 | } |
| 11893 | |
| 11894 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11895 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11896 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11897 | |
| 11898 | { |
| 11899 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11900 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11901 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11902 | */ |
| 11903 | /* .name = "Capture Source", */ |
| 11904 | .name = "Input Source", |
| 11905 | .count = 1, |
| 11906 | .info = alc_mux_enum_info, |
| 11907 | .get = alc_mux_enum_get, |
| 11908 | .put = alc_mux_enum_put, |
| 11909 | }, |
| 11910 | { } /* end */ |
| 11911 | }; |
| 11912 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11913 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11914 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11915 | int pin_type, int dac_idx) |
| 11916 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 11917 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11918 | pin_type); |
| 11919 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11920 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11921 | } |
| 11922 | |
| 11923 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11924 | { |
| 11925 | struct alc_spec *spec = codec->spec; |
| 11926 | int i; |
| 11927 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11928 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11929 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11930 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11931 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11932 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11933 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11934 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11935 | } |
| 11936 | } |
| 11937 | |
| 11938 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11939 | { |
| 11940 | struct alc_spec *spec = codec->spec; |
| 11941 | hda_nid_t pin; |
| 11942 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11943 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11944 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11945 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11946 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11947 | pin = spec->autocfg.speaker_pins[0]; |
| 11948 | if (pin) |
| 11949 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11950 | } |
| 11951 | |
| 11952 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11953 | { |
| 11954 | struct alc_spec *spec = codec->spec; |
| 11955 | int i; |
| 11956 | |
| 11957 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11958 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11959 | if (nid >= 0x0c && nid <= 0x11) { |
| 11960 | snd_hda_codec_write(codec, nid, 0, |
| 11961 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11962 | i <= AUTO_PIN_FRONT_MIC ? |
| 11963 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11964 | } |
| 11965 | } |
| 11966 | } |
| 11967 | |
| 11968 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11969 | /* return 1 if successful, 0 if the proper config is not found, |
| 11970 | * or a negative error code |
| 11971 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11972 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11973 | { |
| 11974 | struct alc_spec *spec = codec->spec; |
| 11975 | int err; |
| 11976 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11977 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11978 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11979 | alc861_ignore); |
| 11980 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11981 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11982 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11983 | return 0; /* can't find valid BIOS pin config */ |
| 11984 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11985 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11986 | if (err < 0) |
| 11987 | return err; |
| 11988 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11989 | if (err < 0) |
| 11990 | return err; |
| 11991 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11992 | if (err < 0) |
| 11993 | return err; |
| 11994 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11995 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11996 | return err; |
| 11997 | |
| 11998 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11999 | |
| 12000 | if (spec->autocfg.dig_out_pin) |
| 12001 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12002 | |
| 12003 | if (spec->kctl_alloc) |
| 12004 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12005 | |
| 12006 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12007 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12008 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12009 | spec->input_mux = &spec->private_imux; |
| 12010 | |
| 12011 | spec->adc_nids = alc861_adc_nids; |
| 12012 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12013 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12014 | spec->num_mixers++; |
| 12015 | |
| 12016 | return 1; |
| 12017 | } |
| 12018 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12019 | /* additional initialization for auto-configuration model */ |
| 12020 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12021 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12022 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12023 | alc861_auto_init_multi_out(codec); |
| 12024 | alc861_auto_init_hp_out(codec); |
| 12025 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12026 | if (spec->unsol_event) |
| 12027 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12028 | } |
| 12029 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12030 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12031 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12032 | { 0x15, HDA_INPUT, 0 }, |
| 12033 | { 0x15, HDA_INPUT, 1 }, |
| 12034 | { 0x15, HDA_INPUT, 2 }, |
| 12035 | { 0x15, HDA_INPUT, 3 }, |
| 12036 | { } /* end */ |
| 12037 | }; |
| 12038 | #endif |
| 12039 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12040 | |
| 12041 | /* |
| 12042 | * configuration and preset |
| 12043 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12044 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12045 | [ALC861_3ST] = "3stack", |
| 12046 | [ALC660_3ST] = "3stack-660", |
| 12047 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12048 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12049 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12050 | [ALC861_TOSHIBA] = "toshiba", |
| 12051 | [ALC861_ASUS] = "asus", |
| 12052 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12053 | [ALC861_AUTO] = "auto", |
| 12054 | }; |
| 12055 | |
| 12056 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12057 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12058 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12059 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12060 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12061 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12062 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12063 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12064 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12065 | * Any other models that need this preset? |
| 12066 | */ |
| 12067 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12068 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12069 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12070 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12071 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12072 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12073 | /* FIXME: the below seems conflict */ |
| 12074 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12075 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12076 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12077 | {} |
| 12078 | }; |
| 12079 | |
| 12080 | static struct alc_config_preset alc861_presets[] = { |
| 12081 | [ALC861_3ST] = { |
| 12082 | .mixers = { alc861_3ST_mixer }, |
| 12083 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12084 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12085 | .dac_nids = alc861_dac_nids, |
| 12086 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12087 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12088 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12089 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12090 | .adc_nids = alc861_adc_nids, |
| 12091 | .input_mux = &alc861_capture_source, |
| 12092 | }, |
| 12093 | [ALC861_3ST_DIG] = { |
| 12094 | .mixers = { alc861_base_mixer }, |
| 12095 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12096 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12097 | .dac_nids = alc861_dac_nids, |
| 12098 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12099 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12100 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12101 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12102 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12103 | .adc_nids = alc861_adc_nids, |
| 12104 | .input_mux = &alc861_capture_source, |
| 12105 | }, |
| 12106 | [ALC861_6ST_DIG] = { |
| 12107 | .mixers = { alc861_base_mixer }, |
| 12108 | .init_verbs = { alc861_base_init_verbs }, |
| 12109 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12110 | .dac_nids = alc861_dac_nids, |
| 12111 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12112 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12113 | .channel_mode = alc861_8ch_modes, |
| 12114 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12115 | .adc_nids = alc861_adc_nids, |
| 12116 | .input_mux = &alc861_capture_source, |
| 12117 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12118 | [ALC660_3ST] = { |
| 12119 | .mixers = { alc861_3ST_mixer }, |
| 12120 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12121 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12122 | .dac_nids = alc660_dac_nids, |
| 12123 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12124 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12125 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12126 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12127 | .adc_nids = alc861_adc_nids, |
| 12128 | .input_mux = &alc861_capture_source, |
| 12129 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12130 | [ALC861_UNIWILL_M31] = { |
| 12131 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12132 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12133 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12134 | .dac_nids = alc861_dac_nids, |
| 12135 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12136 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12137 | .channel_mode = alc861_uniwill_m31_modes, |
| 12138 | .need_dac_fix = 1, |
| 12139 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12140 | .adc_nids = alc861_adc_nids, |
| 12141 | .input_mux = &alc861_capture_source, |
| 12142 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12143 | [ALC861_TOSHIBA] = { |
| 12144 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12145 | .init_verbs = { alc861_base_init_verbs, |
| 12146 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12147 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12148 | .dac_nids = alc861_dac_nids, |
| 12149 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12150 | .channel_mode = alc883_3ST_2ch_modes, |
| 12151 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12152 | .adc_nids = alc861_adc_nids, |
| 12153 | .input_mux = &alc861_capture_source, |
| 12154 | .unsol_event = alc861_toshiba_unsol_event, |
| 12155 | .init_hook = alc861_toshiba_automute, |
| 12156 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12157 | [ALC861_ASUS] = { |
| 12158 | .mixers = { alc861_asus_mixer }, |
| 12159 | .init_verbs = { alc861_asus_init_verbs }, |
| 12160 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12161 | .dac_nids = alc861_dac_nids, |
| 12162 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12163 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12164 | .channel_mode = alc861_asus_modes, |
| 12165 | .need_dac_fix = 1, |
| 12166 | .hp_nid = 0x06, |
| 12167 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12168 | .adc_nids = alc861_adc_nids, |
| 12169 | .input_mux = &alc861_capture_source, |
| 12170 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12171 | [ALC861_ASUS_LAPTOP] = { |
| 12172 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12173 | .init_verbs = { alc861_asus_init_verbs, |
| 12174 | alc861_asus_laptop_init_verbs }, |
| 12175 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12176 | .dac_nids = alc861_dac_nids, |
| 12177 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12178 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12179 | .channel_mode = alc883_3ST_2ch_modes, |
| 12180 | .need_dac_fix = 1, |
| 12181 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12182 | .adc_nids = alc861_adc_nids, |
| 12183 | .input_mux = &alc861_capture_source, |
| 12184 | }, |
| 12185 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12186 | |
| 12187 | |
| 12188 | static int patch_alc861(struct hda_codec *codec) |
| 12189 | { |
| 12190 | struct alc_spec *spec; |
| 12191 | int board_config; |
| 12192 | int err; |
| 12193 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12194 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12195 | if (spec == NULL) |
| 12196 | return -ENOMEM; |
| 12197 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12198 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12199 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12200 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12201 | alc861_models, |
| 12202 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12203 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12204 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12205 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12206 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12207 | board_config = ALC861_AUTO; |
| 12208 | } |
| 12209 | |
| 12210 | if (board_config == ALC861_AUTO) { |
| 12211 | /* automatic parse from the BIOS config */ |
| 12212 | err = alc861_parse_auto_config(codec); |
| 12213 | if (err < 0) { |
| 12214 | alc_free(codec); |
| 12215 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12216 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12217 | printk(KERN_INFO |
| 12218 | "hda_codec: Cannot set up configuration " |
| 12219 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12220 | board_config = ALC861_3ST_DIG; |
| 12221 | } |
| 12222 | } |
| 12223 | |
| 12224 | if (board_config != ALC861_AUTO) |
| 12225 | setup_preset(spec, &alc861_presets[board_config]); |
| 12226 | |
| 12227 | spec->stream_name_analog = "ALC861 Analog"; |
| 12228 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12229 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12230 | |
| 12231 | spec->stream_name_digital = "ALC861 Digital"; |
| 12232 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12233 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12234 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12235 | spec->vmaster_nid = 0x03; |
| 12236 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | codec->patch_ops = alc_patch_ops; |
| 12238 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12239 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12240 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12241 | if (!spec->loopback.amplist) |
| 12242 | spec->loopback.amplist = alc861_loopbacks; |
| 12243 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12244 | |
| 12245 | return 0; |
| 12246 | } |
| 12247 | |
| 12248 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12249 | * ALC861-VD support |
| 12250 | * |
| 12251 | * Based on ALC882 |
| 12252 | * |
| 12253 | * In addition, an independent DAC |
| 12254 | */ |
| 12255 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12256 | |
| 12257 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12258 | /* front, surr, clfe, side surr */ |
| 12259 | 0x02, 0x03, 0x04, 0x05 |
| 12260 | }; |
| 12261 | |
| 12262 | /* dac_nids for ALC660vd are in a different order - according to |
| 12263 | * Realtek's driver. |
| 12264 | * This should probably tesult in a different mixer for 6stack models |
| 12265 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12266 | * - and it is the same as in 861vd. |
| 12267 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12268 | */ |
| 12269 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12270 | /* front, rear, clfe, rear_surr */ |
| 12271 | 0x02, 0x04, 0x03 |
| 12272 | }; |
| 12273 | |
| 12274 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12275 | /* ADC0 */ |
| 12276 | 0x09, |
| 12277 | }; |
| 12278 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12279 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12280 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12281 | /* input MUX */ |
| 12282 | /* FIXME: should be a matrix-type input source selection */ |
| 12283 | static struct hda_input_mux alc861vd_capture_source = { |
| 12284 | .num_items = 4, |
| 12285 | .items = { |
| 12286 | { "Mic", 0x0 }, |
| 12287 | { "Front Mic", 0x1 }, |
| 12288 | { "Line", 0x2 }, |
| 12289 | { "CD", 0x4 }, |
| 12290 | }, |
| 12291 | }; |
| 12292 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12293 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12294 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12295 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12296 | { "Ext Mic", 0x0 }, |
| 12297 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12298 | }, |
| 12299 | }; |
| 12300 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12301 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12302 | .num_items = 2, |
| 12303 | .items = { |
| 12304 | { "Front Mic", 0x0 }, |
| 12305 | { "ATAPI Mic", 0x1 }, |
| 12306 | }, |
| 12307 | }; |
| 12308 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12309 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12310 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12311 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12312 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12313 | |
| 12314 | /* |
| 12315 | * 2ch mode |
| 12316 | */ |
| 12317 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12318 | { 2, NULL } |
| 12319 | }; |
| 12320 | |
| 12321 | /* |
| 12322 | * 6ch mode |
| 12323 | */ |
| 12324 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12325 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12326 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12327 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12328 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12329 | { } /* end */ |
| 12330 | }; |
| 12331 | |
| 12332 | /* |
| 12333 | * 8ch mode |
| 12334 | */ |
| 12335 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12336 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12337 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12338 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12339 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12340 | { } /* end */ |
| 12341 | }; |
| 12342 | |
| 12343 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12344 | { 6, alc861vd_6stack_ch6_init }, |
| 12345 | { 8, alc861vd_6stack_ch8_init }, |
| 12346 | }; |
| 12347 | |
| 12348 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12349 | { |
| 12350 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12351 | .name = "Channel Mode", |
| 12352 | .info = alc_ch_mode_info, |
| 12353 | .get = alc_ch_mode_get, |
| 12354 | .put = alc_ch_mode_put, |
| 12355 | }, |
| 12356 | { } /* end */ |
| 12357 | }; |
| 12358 | |
| 12359 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12360 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12361 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12362 | |
| 12363 | { |
| 12364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12365 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12366 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12367 | */ |
| 12368 | /* .name = "Capture Source", */ |
| 12369 | .name = "Input Source", |
| 12370 | .count = 1, |
| 12371 | .info = alc861vd_mux_enum_info, |
| 12372 | .get = alc861vd_mux_enum_get, |
| 12373 | .put = alc861vd_mux_enum_put, |
| 12374 | }, |
| 12375 | { } /* end */ |
| 12376 | }; |
| 12377 | |
| 12378 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12379 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12380 | */ |
| 12381 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12382 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12383 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12384 | |
| 12385 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12386 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12387 | |
| 12388 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12389 | HDA_OUTPUT), |
| 12390 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12391 | HDA_OUTPUT), |
| 12392 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12393 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12394 | |
| 12395 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12396 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12397 | |
| 12398 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12399 | |
| 12400 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12403 | |
| 12404 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12405 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12406 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12407 | |
| 12408 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12409 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12410 | |
| 12411 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12412 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12413 | |
| 12414 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12415 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12416 | |
| 12417 | { } /* end */ |
| 12418 | }; |
| 12419 | |
| 12420 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12421 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12422 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12423 | |
| 12424 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12425 | |
| 12426 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12429 | |
| 12430 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12431 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12432 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12433 | |
| 12434 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12435 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12436 | |
| 12437 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12438 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12439 | |
| 12440 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12441 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12442 | |
| 12443 | { } /* end */ |
| 12444 | }; |
| 12445 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12446 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12447 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12448 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12449 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12450 | |
| 12451 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12452 | |
| 12453 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12454 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12455 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12456 | |
| 12457 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12458 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12459 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12460 | |
| 12461 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12462 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12463 | |
| 12464 | { } /* end */ |
| 12465 | }; |
| 12466 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12467 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12468 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12469 | */ |
| 12470 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12471 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12472 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12473 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12474 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12475 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12476 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12477 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12478 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12479 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12480 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12481 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12482 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12483 | { } /* end */ |
| 12484 | }; |
| 12485 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12486 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12487 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12488 | */ |
| 12489 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12490 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12491 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12492 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12493 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12494 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12495 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12496 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12497 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12498 | |
| 12499 | { } /* end */ |
| 12500 | }; |
| 12501 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12502 | /* |
| 12503 | * generic initialization of ADC, input mixers and output mixers |
| 12504 | */ |
| 12505 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12506 | /* |
| 12507 | * Unmute ADC0 and set the default input to mic-in |
| 12508 | */ |
| 12509 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12510 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12511 | |
| 12512 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12513 | * the analog-loopback mixer widget |
| 12514 | */ |
| 12515 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12516 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12517 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12521 | |
| 12522 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12523 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12527 | |
| 12528 | /* |
| 12529 | * Set up output mixers (0x02 - 0x05) |
| 12530 | */ |
| 12531 | /* set vol=0 to output mixers */ |
| 12532 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12533 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12534 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12535 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12536 | |
| 12537 | /* set up input amps for analog loopback */ |
| 12538 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12539 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12542 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12543 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12544 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12545 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12546 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12547 | |
| 12548 | { } |
| 12549 | }; |
| 12550 | |
| 12551 | /* |
| 12552 | * 3-stack pin configuration: |
| 12553 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12554 | */ |
| 12555 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12556 | /* |
| 12557 | * Set pin mode and muting |
| 12558 | */ |
| 12559 | /* set front pin widgets 0x14 for output */ |
| 12560 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12561 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12562 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12563 | |
| 12564 | /* Mic (rear) pin: input vref at 80% */ |
| 12565 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12566 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12567 | /* Front Mic pin: input vref at 80% */ |
| 12568 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12569 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12570 | /* Line In pin: input */ |
| 12571 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12572 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12573 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12574 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12575 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12576 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12577 | /* CD pin widget for input */ |
| 12578 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12579 | |
| 12580 | { } |
| 12581 | }; |
| 12582 | |
| 12583 | /* |
| 12584 | * 6-stack pin configuration: |
| 12585 | */ |
| 12586 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12587 | /* |
| 12588 | * Set pin mode and muting |
| 12589 | */ |
| 12590 | /* set front pin widgets 0x14 for output */ |
| 12591 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12593 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12594 | |
| 12595 | /* Rear Pin: output 1 (0x0d) */ |
| 12596 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12597 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12598 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12599 | /* CLFE Pin: output 2 (0x0e) */ |
| 12600 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12601 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12602 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12603 | /* Side Pin: output 3 (0x0f) */ |
| 12604 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12605 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12606 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12607 | |
| 12608 | /* Mic (rear) pin: input vref at 80% */ |
| 12609 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12610 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12611 | /* Front Mic pin: input vref at 80% */ |
| 12612 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12613 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12614 | /* Line In pin: input */ |
| 12615 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12616 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12617 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12618 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12619 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12620 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12621 | /* CD pin widget for input */ |
| 12622 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12623 | |
| 12624 | { } |
| 12625 | }; |
| 12626 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12627 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12628 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12629 | { } |
| 12630 | }; |
| 12631 | |
| 12632 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12633 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12634 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12636 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12637 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12638 | {} |
| 12639 | }; |
| 12640 | |
| 12641 | /* toggle speaker-output according to the hp-jack state */ |
| 12642 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12643 | { |
| 12644 | unsigned int present; |
| 12645 | unsigned char bits; |
| 12646 | |
| 12647 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12648 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12649 | bits = present ? HDA_AMP_MUTE : 0; |
| 12650 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12651 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12652 | } |
| 12653 | |
| 12654 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12655 | { |
| 12656 | unsigned int present; |
| 12657 | unsigned char bits; |
| 12658 | |
| 12659 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12660 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12661 | bits = present ? HDA_AMP_MUTE : 0; |
| 12662 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12663 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12664 | } |
| 12665 | |
| 12666 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12667 | { |
| 12668 | alc861vd_lenovo_hp_automute(codec); |
| 12669 | alc861vd_lenovo_mic_automute(codec); |
| 12670 | } |
| 12671 | |
| 12672 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12673 | unsigned int res) |
| 12674 | { |
| 12675 | switch (res >> 26) { |
| 12676 | case ALC880_HP_EVENT: |
| 12677 | alc861vd_lenovo_hp_automute(codec); |
| 12678 | break; |
| 12679 | case ALC880_MIC_EVENT: |
| 12680 | alc861vd_lenovo_mic_automute(codec); |
| 12681 | break; |
| 12682 | } |
| 12683 | } |
| 12684 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12685 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12686 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12687 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12688 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12689 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12690 | |
| 12691 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12692 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12693 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12694 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12695 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12696 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12697 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12698 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12699 | |
| 12700 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12701 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12702 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12703 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12704 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12705 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12706 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12707 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12708 | |
| 12709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12710 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12711 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12712 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12713 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12714 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12715 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12716 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12717 | |
| 12718 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12719 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12722 | |
| 12723 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12724 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12725 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12726 | |
| 12727 | { } /* end */ |
| 12728 | }; |
| 12729 | |
| 12730 | /* toggle speaker-output according to the hp-jack state */ |
| 12731 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12732 | { |
| 12733 | unsigned int present; |
| 12734 | |
| 12735 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12736 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12737 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12738 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12739 | } |
| 12740 | |
| 12741 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12742 | { |
| 12743 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12744 | alc861vd_dallas_automute(codec); |
| 12745 | } |
| 12746 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12747 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12748 | #define alc861vd_loopbacks alc880_loopbacks |
| 12749 | #endif |
| 12750 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12751 | /* pcm configuration: identiacal with ALC880 */ |
| 12752 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12753 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12754 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12755 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12756 | |
| 12757 | /* |
| 12758 | * configuration and preset |
| 12759 | */ |
| 12760 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12761 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12762 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12763 | [ALC861VD_3ST] = "3stack", |
| 12764 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12765 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12766 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12767 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12768 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12769 | [ALC861VD_AUTO] = "auto", |
| 12770 | }; |
| 12771 | |
| 12772 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12773 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12774 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12775 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12776 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12777 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12778 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12779 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12780 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12781 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12782 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12783 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12784 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12785 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12786 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12787 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12788 | {} |
| 12789 | }; |
| 12790 | |
| 12791 | static struct alc_config_preset alc861vd_presets[] = { |
| 12792 | [ALC660VD_3ST] = { |
| 12793 | .mixers = { alc861vd_3st_mixer }, |
| 12794 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12795 | alc861vd_3stack_init_verbs }, |
| 12796 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12797 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12798 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12799 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12800 | .input_mux = &alc861vd_capture_source, |
| 12801 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12802 | [ALC660VD_3ST_DIG] = { |
| 12803 | .mixers = { alc861vd_3st_mixer }, |
| 12804 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12805 | alc861vd_3stack_init_verbs }, |
| 12806 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12807 | .dac_nids = alc660vd_dac_nids, |
| 12808 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12809 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12810 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12811 | .input_mux = &alc861vd_capture_source, |
| 12812 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12813 | [ALC861VD_3ST] = { |
| 12814 | .mixers = { alc861vd_3st_mixer }, |
| 12815 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12816 | alc861vd_3stack_init_verbs }, |
| 12817 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12818 | .dac_nids = alc861vd_dac_nids, |
| 12819 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12820 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12821 | .input_mux = &alc861vd_capture_source, |
| 12822 | }, |
| 12823 | [ALC861VD_3ST_DIG] = { |
| 12824 | .mixers = { alc861vd_3st_mixer }, |
| 12825 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12826 | alc861vd_3stack_init_verbs }, |
| 12827 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12828 | .dac_nids = alc861vd_dac_nids, |
| 12829 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12830 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12831 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12832 | .input_mux = &alc861vd_capture_source, |
| 12833 | }, |
| 12834 | [ALC861VD_6ST_DIG] = { |
| 12835 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12836 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12837 | alc861vd_6stack_init_verbs }, |
| 12838 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12839 | .dac_nids = alc861vd_dac_nids, |
| 12840 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12841 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12842 | .channel_mode = alc861vd_6stack_modes, |
| 12843 | .input_mux = &alc861vd_capture_source, |
| 12844 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12845 | [ALC861VD_LENOVO] = { |
| 12846 | .mixers = { alc861vd_lenovo_mixer }, |
| 12847 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12848 | alc861vd_3stack_init_verbs, |
| 12849 | alc861vd_eapd_verbs, |
| 12850 | alc861vd_lenovo_unsol_verbs }, |
| 12851 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12852 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12853 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12854 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12855 | .input_mux = &alc861vd_capture_source, |
| 12856 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12857 | .init_hook = alc861vd_lenovo_automute, |
| 12858 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12859 | [ALC861VD_DALLAS] = { |
| 12860 | .mixers = { alc861vd_dallas_mixer }, |
| 12861 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12862 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12863 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12864 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12865 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12866 | .input_mux = &alc861vd_dallas_capture_source, |
| 12867 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12868 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12869 | }, |
| 12870 | [ALC861VD_HP] = { |
| 12871 | .mixers = { alc861vd_hp_mixer }, |
| 12872 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12873 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12874 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12875 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12876 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12877 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12878 | .input_mux = &alc861vd_hp_capture_source, |
| 12879 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12880 | .init_hook = alc861vd_dallas_automute, |
| 12881 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12882 | }; |
| 12883 | |
| 12884 | /* |
| 12885 | * BIOS auto configuration |
| 12886 | */ |
| 12887 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12888 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12889 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12890 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12891 | } |
| 12892 | |
| 12893 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12894 | { |
| 12895 | struct alc_spec *spec = codec->spec; |
| 12896 | int i; |
| 12897 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12898 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12899 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12900 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12901 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12902 | if (nid) |
| 12903 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12904 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12905 | } |
| 12906 | } |
| 12907 | |
| 12908 | |
| 12909 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12910 | { |
| 12911 | struct alc_spec *spec = codec->spec; |
| 12912 | hda_nid_t pin; |
| 12913 | |
| 12914 | pin = spec->autocfg.hp_pins[0]; |
| 12915 | if (pin) /* connect to front and use dac 0 */ |
| 12916 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12917 | pin = spec->autocfg.speaker_pins[0]; |
| 12918 | if (pin) |
| 12919 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12920 | } |
| 12921 | |
| 12922 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12923 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12924 | |
| 12925 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12926 | { |
| 12927 | struct alc_spec *spec = codec->spec; |
| 12928 | int i; |
| 12929 | |
| 12930 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12931 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12932 | if (alc861vd_is_input_pin(nid)) { |
| 12933 | snd_hda_codec_write(codec, nid, 0, |
| 12934 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12935 | i <= AUTO_PIN_FRONT_MIC ? |
| 12936 | PIN_VREF80 : PIN_IN); |
| 12937 | if (nid != ALC861VD_PIN_CD_NID) |
| 12938 | snd_hda_codec_write(codec, nid, 0, |
| 12939 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12940 | AMP_OUT_MUTE); |
| 12941 | } |
| 12942 | } |
| 12943 | } |
| 12944 | |
| 12945 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12946 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12947 | |
| 12948 | /* add playback controls from the parsed DAC table */ |
| 12949 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12950 | * different NIDs for mute/unmute switch and volume control */ |
| 12951 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12952 | const struct auto_pin_cfg *cfg) |
| 12953 | { |
| 12954 | char name[32]; |
| 12955 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12956 | hda_nid_t nid_v, nid_s; |
| 12957 | int i, err; |
| 12958 | |
| 12959 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12960 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12961 | continue; |
| 12962 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12963 | alc880_dac_to_idx( |
| 12964 | spec->multiout.dac_nids[i])); |
| 12965 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12966 | alc880_dac_to_idx( |
| 12967 | spec->multiout.dac_nids[i])); |
| 12968 | |
| 12969 | if (i == 2) { |
| 12970 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12971 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12972 | "Center Playback Volume", |
| 12973 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12974 | HDA_OUTPUT)); |
| 12975 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12976 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12977 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12978 | "LFE Playback Volume", |
| 12979 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12980 | HDA_OUTPUT)); |
| 12981 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12982 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12983 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12984 | "Center Playback Switch", |
| 12985 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12986 | HDA_INPUT)); |
| 12987 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12988 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12989 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12990 | "LFE Playback Switch", |
| 12991 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12992 | HDA_INPUT)); |
| 12993 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12994 | return err; |
| 12995 | } else { |
| 12996 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12997 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12998 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12999 | HDA_OUTPUT)); |
| 13000 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13001 | return err; |
| 13002 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13003 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13004 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13005 | HDA_INPUT)); |
| 13006 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13007 | return err; |
| 13008 | } |
| 13009 | } |
| 13010 | return 0; |
| 13011 | } |
| 13012 | |
| 13013 | /* add playback controls for speaker and HP outputs */ |
| 13014 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13015 | * different NIDs for mute/unmute switch and volume control */ |
| 13016 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13017 | hda_nid_t pin, const char *pfx) |
| 13018 | { |
| 13019 | hda_nid_t nid_v, nid_s; |
| 13020 | int err; |
| 13021 | char name[32]; |
| 13022 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13023 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13024 | return 0; |
| 13025 | |
| 13026 | if (alc880_is_fixed_pin(pin)) { |
| 13027 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13028 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13029 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13030 | spec->multiout.hp_nid = nid_v; |
| 13031 | else |
| 13032 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13033 | /* control HP volume/switch on the output mixer amp */ |
| 13034 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13035 | alc880_fixed_pin_idx(pin)); |
| 13036 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13037 | alc880_fixed_pin_idx(pin)); |
| 13038 | |
| 13039 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13040 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13041 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13042 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13043 | return err; |
| 13044 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13045 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13046 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13047 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13048 | return err; |
| 13049 | } else if (alc880_is_multi_pin(pin)) { |
| 13050 | /* set manual connection */ |
| 13051 | /* we have only a switch on HP-out PIN */ |
| 13052 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13053 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13054 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13055 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13056 | return err; |
| 13057 | } |
| 13058 | return 0; |
| 13059 | } |
| 13060 | |
| 13061 | /* parse the BIOS configuration and set up the alc_spec |
| 13062 | * return 1 if successful, 0 if the proper config is not found, |
| 13063 | * or a negative error code |
| 13064 | * Based on ALC880 version - had to change it to override |
| 13065 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13066 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13067 | { |
| 13068 | struct alc_spec *spec = codec->spec; |
| 13069 | int err; |
| 13070 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13071 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13072 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13073 | alc861vd_ignore); |
| 13074 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13075 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13076 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13077 | return 0; /* can't find valid BIOS pin config */ |
| 13078 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13079 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13080 | if (err < 0) |
| 13081 | return err; |
| 13082 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13083 | if (err < 0) |
| 13084 | return err; |
| 13085 | err = alc861vd_auto_create_extra_out(spec, |
| 13086 | spec->autocfg.speaker_pins[0], |
| 13087 | "Speaker"); |
| 13088 | if (err < 0) |
| 13089 | return err; |
| 13090 | err = alc861vd_auto_create_extra_out(spec, |
| 13091 | spec->autocfg.hp_pins[0], |
| 13092 | "Headphone"); |
| 13093 | if (err < 0) |
| 13094 | return err; |
| 13095 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13096 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13097 | return err; |
| 13098 | |
| 13099 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13100 | |
| 13101 | if (spec->autocfg.dig_out_pin) |
| 13102 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13103 | |
| 13104 | if (spec->kctl_alloc) |
| 13105 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13106 | |
| 13107 | spec->init_verbs[spec->num_init_verbs++] |
| 13108 | = alc861vd_volume_init_verbs; |
| 13109 | |
| 13110 | spec->num_mux_defs = 1; |
| 13111 | spec->input_mux = &spec->private_imux; |
| 13112 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13113 | err = alc_auto_add_mic_boost(codec); |
| 13114 | if (err < 0) |
| 13115 | return err; |
| 13116 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13117 | return 1; |
| 13118 | } |
| 13119 | |
| 13120 | /* additional initialization for auto-configuration model */ |
| 13121 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13122 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13123 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13124 | alc861vd_auto_init_multi_out(codec); |
| 13125 | alc861vd_auto_init_hp_out(codec); |
| 13126 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13127 | if (spec->unsol_event) |
| 13128 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13129 | } |
| 13130 | |
| 13131 | static int patch_alc861vd(struct hda_codec *codec) |
| 13132 | { |
| 13133 | struct alc_spec *spec; |
| 13134 | int err, board_config; |
| 13135 | |
| 13136 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13137 | if (spec == NULL) |
| 13138 | return -ENOMEM; |
| 13139 | |
| 13140 | codec->spec = spec; |
| 13141 | |
| 13142 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13143 | alc861vd_models, |
| 13144 | alc861vd_cfg_tbl); |
| 13145 | |
| 13146 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13147 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13148 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13149 | board_config = ALC861VD_AUTO; |
| 13150 | } |
| 13151 | |
| 13152 | if (board_config == ALC861VD_AUTO) { |
| 13153 | /* automatic parse from the BIOS config */ |
| 13154 | err = alc861vd_parse_auto_config(codec); |
| 13155 | if (err < 0) { |
| 13156 | alc_free(codec); |
| 13157 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13158 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13159 | printk(KERN_INFO |
| 13160 | "hda_codec: Cannot set up configuration " |
| 13161 | "from BIOS. Using base mode...\n"); |
| 13162 | board_config = ALC861VD_3ST; |
| 13163 | } |
| 13164 | } |
| 13165 | |
| 13166 | if (board_config != ALC861VD_AUTO) |
| 13167 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13168 | |
| 13169 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13170 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13171 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13172 | |
| 13173 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13174 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13175 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13176 | |
| 13177 | spec->adc_nids = alc861vd_adc_nids; |
| 13178 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13179 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13180 | |
| 13181 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13182 | spec->num_mixers++; |
| 13183 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13184 | spec->vmaster_nid = 0x02; |
| 13185 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13186 | codec->patch_ops = alc_patch_ops; |
| 13187 | |
| 13188 | if (board_config == ALC861VD_AUTO) |
| 13189 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13190 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13191 | if (!spec->loopback.amplist) |
| 13192 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13193 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13194 | |
| 13195 | return 0; |
| 13196 | } |
| 13197 | |
| 13198 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13199 | * ALC662 support |
| 13200 | * |
| 13201 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13202 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13203 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13204 | * 6-channel independent captures. |
| 13205 | * |
| 13206 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13207 | * driver yet). |
| 13208 | */ |
| 13209 | #define ALC662_DIGOUT_NID 0x06 |
| 13210 | #define ALC662_DIGIN_NID 0x0a |
| 13211 | |
| 13212 | static hda_nid_t alc662_dac_nids[4] = { |
| 13213 | /* front, rear, clfe, rear_surr */ |
| 13214 | 0x02, 0x03, 0x04 |
| 13215 | }; |
| 13216 | |
| 13217 | static hda_nid_t alc662_adc_nids[1] = { |
| 13218 | /* ADC1-2 */ |
| 13219 | 0x09, |
| 13220 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13221 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13222 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13223 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13224 | /* input MUX */ |
| 13225 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13226 | static struct hda_input_mux alc662_capture_source = { |
| 13227 | .num_items = 4, |
| 13228 | .items = { |
| 13229 | { "Mic", 0x0 }, |
| 13230 | { "Front Mic", 0x1 }, |
| 13231 | { "Line", 0x2 }, |
| 13232 | { "CD", 0x4 }, |
| 13233 | }, |
| 13234 | }; |
| 13235 | |
| 13236 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13237 | .num_items = 2, |
| 13238 | .items = { |
| 13239 | { "Mic", 0x1 }, |
| 13240 | { "Line", 0x2 }, |
| 13241 | }, |
| 13242 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13243 | |
| 13244 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13245 | .num_items = 2, |
| 13246 | .items = { |
| 13247 | { "i-Mic", 0x1 }, |
| 13248 | { "e-Mic", 0x0 }, |
| 13249 | }, |
| 13250 | }; |
| 13251 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13252 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13253 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13254 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13255 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13256 | /* |
| 13257 | * 2ch mode |
| 13258 | */ |
| 13259 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13260 | { 2, NULL } |
| 13261 | }; |
| 13262 | |
| 13263 | /* |
| 13264 | * 2ch mode |
| 13265 | */ |
| 13266 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13267 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13268 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13269 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13270 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13271 | { } /* end */ |
| 13272 | }; |
| 13273 | |
| 13274 | /* |
| 13275 | * 6ch mode |
| 13276 | */ |
| 13277 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13278 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13279 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13280 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13281 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13282 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13283 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13284 | { } /* end */ |
| 13285 | }; |
| 13286 | |
| 13287 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13288 | { 2, alc662_3ST_ch2_init }, |
| 13289 | { 6, alc662_3ST_ch6_init }, |
| 13290 | }; |
| 13291 | |
| 13292 | /* |
| 13293 | * 2ch mode |
| 13294 | */ |
| 13295 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13296 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13297 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13298 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13299 | { } /* end */ |
| 13300 | }; |
| 13301 | |
| 13302 | /* |
| 13303 | * 6ch mode |
| 13304 | */ |
| 13305 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13306 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13307 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13308 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13309 | { } /* end */ |
| 13310 | }; |
| 13311 | |
| 13312 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13313 | { 2, alc662_sixstack_ch6_init }, |
| 13314 | { 6, alc662_sixstack_ch8_init }, |
| 13315 | }; |
| 13316 | |
| 13317 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13318 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13319 | */ |
| 13320 | |
| 13321 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13322 | /* output mixer control */ |
| 13323 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13324 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13325 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13326 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13327 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13328 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13329 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13330 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13331 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13332 | |
| 13333 | /*Input mixer control */ |
| 13334 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13335 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13336 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13337 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13338 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13339 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13340 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13341 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13342 | { } /* end */ |
| 13343 | }; |
| 13344 | |
| 13345 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13346 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13347 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13348 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13349 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13350 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13351 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13352 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13353 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13354 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13355 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13356 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13357 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13358 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13359 | { } /* end */ |
| 13360 | }; |
| 13361 | |
| 13362 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13363 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13364 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13365 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13366 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13367 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13368 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13369 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13370 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13371 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13372 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13373 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13374 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13375 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13376 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13378 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13379 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13380 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13381 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13382 | { } /* end */ |
| 13383 | }; |
| 13384 | |
| 13385 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13386 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13387 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13388 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13389 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13390 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13391 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13392 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13393 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13394 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13395 | { } /* end */ |
| 13396 | }; |
| 13397 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13398 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13399 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13400 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13401 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13402 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13403 | |
| 13404 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13405 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13406 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13407 | |
| 13408 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13409 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13410 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13411 | { } /* end */ |
| 13412 | }; |
| 13413 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13414 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13415 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13416 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13417 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13418 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13419 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13420 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13421 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13422 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13423 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13424 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13425 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13426 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13427 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13428 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13429 | { } /* end */ |
| 13430 | }; |
| 13431 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13432 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13433 | { |
| 13434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13435 | .name = "Channel Mode", |
| 13436 | .info = alc_ch_mode_info, |
| 13437 | .get = alc_ch_mode_get, |
| 13438 | .put = alc_ch_mode_put, |
| 13439 | }, |
| 13440 | { } /* end */ |
| 13441 | }; |
| 13442 | |
| 13443 | static struct hda_verb alc662_init_verbs[] = { |
| 13444 | /* ADC: mute amp left and right */ |
| 13445 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13446 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13447 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13448 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13449 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13450 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13452 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13453 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13454 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13455 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13456 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13457 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13458 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13459 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13460 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13461 | |
| 13462 | /* Front Pin: output 0 (0x0c) */ |
| 13463 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13464 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13465 | |
| 13466 | /* Rear Pin: output 1 (0x0d) */ |
| 13467 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13468 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13469 | |
| 13470 | /* CLFE Pin: output 2 (0x0e) */ |
| 13471 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13472 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13473 | |
| 13474 | /* Mic (rear) pin: input vref at 80% */ |
| 13475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13476 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13477 | /* Front Mic pin: input vref at 80% */ |
| 13478 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13479 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13480 | /* Line In pin: input */ |
| 13481 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13482 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13483 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13484 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13485 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13486 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13487 | /* CD pin widget for input */ |
| 13488 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13489 | |
| 13490 | /* FIXME: use matrix-type input source selection */ |
| 13491 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13492 | /* Input mixer */ |
| 13493 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13494 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13497 | |
| 13498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13502 | { } |
| 13503 | }; |
| 13504 | |
| 13505 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13506 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13507 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13508 | {} |
| 13509 | }; |
| 13510 | |
| 13511 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13512 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13513 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13514 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13515 | }; |
| 13516 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13517 | /* Set Unsolicited Event*/ |
| 13518 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13519 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13520 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13521 | {} |
| 13522 | }; |
| 13523 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13524 | /* |
| 13525 | * generic initialization of ADC, input mixers and output mixers |
| 13526 | */ |
| 13527 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13528 | /* |
| 13529 | * Unmute ADC and set the default input to mic-in |
| 13530 | */ |
| 13531 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13532 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13533 | |
| 13534 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13535 | * mixer widget |
| 13536 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13537 | * panel mic (mic 2) |
| 13538 | */ |
| 13539 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13540 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13541 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13544 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13545 | |
| 13546 | /* |
| 13547 | * Set up output mixers (0x0c - 0x0f) |
| 13548 | */ |
| 13549 | /* set vol=0 to output mixers */ |
| 13550 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13551 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13552 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13553 | |
| 13554 | /* set up input amps for analog loopback */ |
| 13555 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13556 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13557 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13558 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13559 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13560 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13561 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13562 | |
| 13563 | |
| 13564 | /* FIXME: use matrix-type input source selection */ |
| 13565 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13566 | /* Input mixer */ |
| 13567 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13568 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13569 | { } |
| 13570 | }; |
| 13571 | |
| 13572 | /* capture mixer elements */ |
| 13573 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13574 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13575 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13576 | { |
| 13577 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13578 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13579 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13580 | */ |
| 13581 | /* .name = "Capture Source", */ |
| 13582 | .name = "Input Source", |
| 13583 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13584 | .info = alc662_mux_enum_info, |
| 13585 | .get = alc662_mux_enum_get, |
| 13586 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13587 | }, |
| 13588 | { } /* end */ |
| 13589 | }; |
| 13590 | |
| 13591 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13592 | { |
| 13593 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13594 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13595 | |
| 13596 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13597 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13598 | bits = present ? HDA_AMP_MUTE : 0; |
| 13599 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13600 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13601 | } |
| 13602 | |
| 13603 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13604 | { |
| 13605 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13606 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13607 | |
| 13608 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13609 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13610 | bits = present ? HDA_AMP_MUTE : 0; |
| 13611 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13612 | HDA_AMP_MUTE, bits); |
| 13613 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13614 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13615 | } |
| 13616 | |
| 13617 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13618 | unsigned int res) |
| 13619 | { |
| 13620 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13621 | alc662_lenovo_101e_all_automute(codec); |
| 13622 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13623 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13624 | } |
| 13625 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13626 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13627 | { |
| 13628 | unsigned int present; |
| 13629 | |
| 13630 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13631 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13632 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13633 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13634 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13635 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13636 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13637 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13638 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13639 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13640 | } |
| 13641 | |
| 13642 | /* unsolicited event for HP jack sensing */ |
| 13643 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13644 | unsigned int res) |
| 13645 | { |
| 13646 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13647 | alc262_hippo1_automute( codec ); |
| 13648 | |
| 13649 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13650 | alc662_eeepc_mic_automute(codec); |
| 13651 | } |
| 13652 | |
| 13653 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13654 | { |
| 13655 | alc262_hippo1_automute( codec ); |
| 13656 | alc662_eeepc_mic_automute(codec); |
| 13657 | } |
| 13658 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13659 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13660 | { |
| 13661 | unsigned int mute; |
| 13662 | unsigned int present; |
| 13663 | |
| 13664 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13665 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13666 | AC_VERB_GET_PIN_SENSE, 0); |
| 13667 | present = (present & 0x80000000) != 0; |
| 13668 | if (present) { |
| 13669 | /* mute internal speaker */ |
| 13670 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13671 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13672 | } else { |
| 13673 | /* unmute internal speaker if necessary */ |
| 13674 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13675 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13676 | HDA_AMP_MUTE, mute); |
| 13677 | } |
| 13678 | } |
| 13679 | |
| 13680 | /* unsolicited event for HP jack sensing */ |
| 13681 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13682 | unsigned int res) |
| 13683 | { |
| 13684 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13685 | alc662_eeepc_ep20_automute(codec); |
| 13686 | } |
| 13687 | |
| 13688 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13689 | { |
| 13690 | alc662_eeepc_ep20_automute(codec); |
| 13691 | } |
| 13692 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13693 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13694 | #define alc662_loopbacks alc880_loopbacks |
| 13695 | #endif |
| 13696 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13697 | |
| 13698 | /* pcm configuration: identiacal with ALC880 */ |
| 13699 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13700 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13701 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13702 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13703 | |
| 13704 | /* |
| 13705 | * configuration and preset |
| 13706 | */ |
| 13707 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13708 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13709 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13710 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13711 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13712 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13713 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13714 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13715 | [ALC662_AUTO] = "auto", |
| 13716 | }; |
| 13717 | |
| 13718 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 13719 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13720 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13721 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13722 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13723 | {} |
| 13724 | }; |
| 13725 | |
| 13726 | static struct alc_config_preset alc662_presets[] = { |
| 13727 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13728 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13729 | .init_verbs = { alc662_init_verbs }, |
| 13730 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13731 | .dac_nids = alc662_dac_nids, |
| 13732 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13733 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13734 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13735 | .channel_mode = alc662_3ST_2ch_modes, |
| 13736 | .input_mux = &alc662_capture_source, |
| 13737 | }, |
| 13738 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13739 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13740 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13741 | .init_verbs = { alc662_init_verbs }, |
| 13742 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13743 | .dac_nids = alc662_dac_nids, |
| 13744 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13745 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13746 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13747 | .channel_mode = alc662_3ST_6ch_modes, |
| 13748 | .need_dac_fix = 1, |
| 13749 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13750 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13751 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13752 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13753 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13754 | .init_verbs = { alc662_init_verbs }, |
| 13755 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13756 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13757 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13758 | .channel_mode = alc662_3ST_6ch_modes, |
| 13759 | .need_dac_fix = 1, |
| 13760 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13761 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13762 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13763 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13764 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13765 | .init_verbs = { alc662_init_verbs }, |
| 13766 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13767 | .dac_nids = alc662_dac_nids, |
| 13768 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13769 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13770 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13771 | .channel_mode = alc662_5stack_modes, |
| 13772 | .input_mux = &alc662_capture_source, |
| 13773 | }, |
| 13774 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13775 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13776 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13777 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13778 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13779 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13780 | .channel_mode = alc662_3ST_2ch_modes, |
| 13781 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13782 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13783 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13784 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13785 | [ALC662_ASUS_EEEPC_P701] = { |
| 13786 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13787 | .init_verbs = { alc662_init_verbs, |
| 13788 | alc662_eeepc_sue_init_verbs }, |
| 13789 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13790 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13791 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13792 | .channel_mode = alc662_3ST_2ch_modes, |
| 13793 | .input_mux = &alc662_eeepc_capture_source, |
| 13794 | .unsol_event = alc662_eeepc_unsol_event, |
| 13795 | .init_hook = alc662_eeepc_inithook, |
| 13796 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13797 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13798 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13799 | alc662_chmode_mixer }, |
| 13800 | .init_verbs = { alc662_init_verbs, |
| 13801 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13802 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13803 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13804 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13805 | .channel_mode = alc662_3ST_6ch_modes, |
| 13806 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13807 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13808 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13809 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13810 | |
| 13811 | }; |
| 13812 | |
| 13813 | |
| 13814 | /* |
| 13815 | * BIOS auto configuration |
| 13816 | */ |
| 13817 | |
| 13818 | /* add playback controls from the parsed DAC table */ |
| 13819 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13820 | const struct auto_pin_cfg *cfg) |
| 13821 | { |
| 13822 | char name[32]; |
| 13823 | static const char *chname[4] = { |
| 13824 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13825 | }; |
| 13826 | hda_nid_t nid; |
| 13827 | int i, err; |
| 13828 | |
| 13829 | for (i = 0; i < cfg->line_outs; i++) { |
| 13830 | if (!spec->multiout.dac_nids[i]) |
| 13831 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13832 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13833 | if (i == 2) { |
| 13834 | /* Center/LFE */ |
| 13835 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13836 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13837 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13838 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13839 | if (err < 0) |
| 13840 | return err; |
| 13841 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13842 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13843 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13844 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13845 | if (err < 0) |
| 13846 | return err; |
| 13847 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13848 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13849 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13850 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13851 | if (err < 0) |
| 13852 | return err; |
| 13853 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13854 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13855 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13856 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13857 | if (err < 0) |
| 13858 | return err; |
| 13859 | } else { |
| 13860 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13861 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13862 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13863 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13864 | if (err < 0) |
| 13865 | return err; |
| 13866 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13867 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13868 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13869 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13870 | if (err < 0) |
| 13871 | return err; |
| 13872 | } |
| 13873 | } |
| 13874 | return 0; |
| 13875 | } |
| 13876 | |
| 13877 | /* add playback controls for speaker and HP outputs */ |
| 13878 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13879 | const char *pfx) |
| 13880 | { |
| 13881 | hda_nid_t nid; |
| 13882 | int err; |
| 13883 | char name[32]; |
| 13884 | |
| 13885 | if (!pin) |
| 13886 | return 0; |
| 13887 | |
| 13888 | if (alc880_is_fixed_pin(pin)) { |
| 13889 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13890 | /* printk("DAC nid=%x\n",nid); */ |
| 13891 | /* specify the DAC as the extra output */ |
| 13892 | if (!spec->multiout.hp_nid) |
| 13893 | spec->multiout.hp_nid = nid; |
| 13894 | else |
| 13895 | spec->multiout.extra_out_nid[0] = nid; |
| 13896 | /* control HP volume/switch on the output mixer amp */ |
| 13897 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13898 | sprintf(name, "%s Playback Volume", pfx); |
| 13899 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13900 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13901 | if (err < 0) |
| 13902 | return err; |
| 13903 | sprintf(name, "%s Playback Switch", pfx); |
| 13904 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13905 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13906 | if (err < 0) |
| 13907 | return err; |
| 13908 | } else if (alc880_is_multi_pin(pin)) { |
| 13909 | /* set manual connection */ |
| 13910 | /* we have only a switch on HP-out PIN */ |
| 13911 | sprintf(name, "%s Playback Switch", pfx); |
| 13912 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13913 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13914 | if (err < 0) |
| 13915 | return err; |
| 13916 | } |
| 13917 | return 0; |
| 13918 | } |
| 13919 | |
| 13920 | /* create playback/capture controls for input pins */ |
| 13921 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13922 | const struct auto_pin_cfg *cfg) |
| 13923 | { |
| 13924 | struct hda_input_mux *imux = &spec->private_imux; |
| 13925 | int i, err, idx; |
| 13926 | |
| 13927 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13928 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13929 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13930 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13931 | auto_pin_cfg_labels[i], |
| 13932 | idx, 0x0b); |
| 13933 | if (err < 0) |
| 13934 | return err; |
| 13935 | imux->items[imux->num_items].label = |
| 13936 | auto_pin_cfg_labels[i]; |
| 13937 | imux->items[imux->num_items].index = |
| 13938 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13939 | imux->num_items++; |
| 13940 | } |
| 13941 | } |
| 13942 | return 0; |
| 13943 | } |
| 13944 | |
| 13945 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13946 | hda_nid_t nid, int pin_type, |
| 13947 | int dac_idx) |
| 13948 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13949 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13950 | /* need the manual connection? */ |
| 13951 | if (alc880_is_multi_pin(nid)) { |
| 13952 | struct alc_spec *spec = codec->spec; |
| 13953 | int idx = alc880_multi_pin_idx(nid); |
| 13954 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13955 | AC_VERB_SET_CONNECT_SEL, |
| 13956 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13957 | } |
| 13958 | } |
| 13959 | |
| 13960 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13961 | { |
| 13962 | struct alc_spec *spec = codec->spec; |
| 13963 | int i; |
| 13964 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13965 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13966 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13967 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13968 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13969 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13970 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13971 | i); |
| 13972 | } |
| 13973 | } |
| 13974 | |
| 13975 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13976 | { |
| 13977 | struct alc_spec *spec = codec->spec; |
| 13978 | hda_nid_t pin; |
| 13979 | |
| 13980 | pin = spec->autocfg.hp_pins[0]; |
| 13981 | if (pin) /* connect to front */ |
| 13982 | /* use dac 0 */ |
| 13983 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13984 | pin = spec->autocfg.speaker_pins[0]; |
| 13985 | if (pin) |
| 13986 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13987 | } |
| 13988 | |
| 13989 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13990 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13991 | |
| 13992 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13993 | { |
| 13994 | struct alc_spec *spec = codec->spec; |
| 13995 | int i; |
| 13996 | |
| 13997 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13998 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13999 | if (alc662_is_input_pin(nid)) { |
| 14000 | snd_hda_codec_write(codec, nid, 0, |
| 14001 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14002 | (i <= AUTO_PIN_FRONT_MIC ? |
| 14003 | PIN_VREF80 : PIN_IN)); |
| 14004 | if (nid != ALC662_PIN_CD_NID) |
| 14005 | snd_hda_codec_write(codec, nid, 0, |
| 14006 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14007 | AMP_OUT_MUTE); |
| 14008 | } |
| 14009 | } |
| 14010 | } |
| 14011 | |
| 14012 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 14013 | { |
| 14014 | struct alc_spec *spec = codec->spec; |
| 14015 | int err; |
| 14016 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 14017 | |
| 14018 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14019 | alc662_ignore); |
| 14020 | if (err < 0) |
| 14021 | return err; |
| 14022 | if (!spec->autocfg.line_outs) |
| 14023 | return 0; /* can't find valid BIOS pin config */ |
| 14024 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14025 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14026 | if (err < 0) |
| 14027 | return err; |
| 14028 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14029 | if (err < 0) |
| 14030 | return err; |
| 14031 | err = alc662_auto_create_extra_out(spec, |
| 14032 | spec->autocfg.speaker_pins[0], |
| 14033 | "Speaker"); |
| 14034 | if (err < 0) |
| 14035 | return err; |
| 14036 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 14037 | "Headphone"); |
| 14038 | if (err < 0) |
| 14039 | return err; |
| 14040 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14041 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14042 | return err; |
| 14043 | |
| 14044 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14045 | |
| 14046 | if (spec->autocfg.dig_out_pin) |
| 14047 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 14048 | |
| 14049 | if (spec->kctl_alloc) |
| 14050 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14051 | |
| 14052 | spec->num_mux_defs = 1; |
| 14053 | spec->input_mux = &spec->private_imux; |
| 14054 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14055 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14056 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 14057 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14058 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14059 | } |
| 14060 | |
| 14061 | /* additional initialization for auto-configuration model */ |
| 14062 | static void alc662_auto_init(struct hda_codec *codec) |
| 14063 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14064 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14065 | alc662_auto_init_multi_out(codec); |
| 14066 | alc662_auto_init_hp_out(codec); |
| 14067 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14068 | if (spec->unsol_event) |
| 14069 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14070 | } |
| 14071 | |
| 14072 | static int patch_alc662(struct hda_codec *codec) |
| 14073 | { |
| 14074 | struct alc_spec *spec; |
| 14075 | int err, board_config; |
| 14076 | |
| 14077 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14078 | if (!spec) |
| 14079 | return -ENOMEM; |
| 14080 | |
| 14081 | codec->spec = spec; |
| 14082 | |
| 14083 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 14084 | alc662_models, |
| 14085 | alc662_cfg_tbl); |
| 14086 | if (board_config < 0) { |
| 14087 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14088 | "trying auto-probe from BIOS...\n"); |
| 14089 | board_config = ALC662_AUTO; |
| 14090 | } |
| 14091 | |
| 14092 | if (board_config == ALC662_AUTO) { |
| 14093 | /* automatic parse from the BIOS config */ |
| 14094 | err = alc662_parse_auto_config(codec); |
| 14095 | if (err < 0) { |
| 14096 | alc_free(codec); |
| 14097 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14098 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14099 | printk(KERN_INFO |
| 14100 | "hda_codec: Cannot set up configuration " |
| 14101 | "from BIOS. Using base mode...\n"); |
| 14102 | board_config = ALC662_3ST_2ch_DIG; |
| 14103 | } |
| 14104 | } |
| 14105 | |
| 14106 | if (board_config != ALC662_AUTO) |
| 14107 | setup_preset(spec, &alc662_presets[board_config]); |
| 14108 | |
| 14109 | spec->stream_name_analog = "ALC662 Analog"; |
| 14110 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14111 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14112 | |
| 14113 | spec->stream_name_digital = "ALC662 Digital"; |
| 14114 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14115 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14116 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14117 | spec->adc_nids = alc662_adc_nids; |
| 14118 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14119 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14120 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14121 | spec->vmaster_nid = 0x02; |
| 14122 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14123 | codec->patch_ops = alc_patch_ops; |
| 14124 | if (board_config == ALC662_AUTO) |
| 14125 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14126 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14127 | if (!spec->loopback.amplist) |
| 14128 | spec->loopback.amplist = alc662_loopbacks; |
| 14129 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14130 | |
| 14131 | return 0; |
| 14132 | } |
| 14133 | |
| 14134 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14135 | * patch entries |
| 14136 | */ |
| 14137 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14138 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14139 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14140 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14141 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14142 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14143 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14144 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14145 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14146 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14147 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14148 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14149 | .patch = patch_alc883 }, |
| 14150 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14151 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14152 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14153 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14154 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 14155 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 14156 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14157 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14158 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14159 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14160 | {} /* terminator */ |
| 14161 | }; |