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 | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 166 | ALC663_ASUS_M51VA, |
| 167 | ALC663_ASUS_G71V, |
| 168 | ALC663_ASUS_H13, |
| 169 | ALC663_ASUS_G50V, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 170 | ALC662_AUTO, |
| 171 | ALC662_MODEL_LAST, |
| 172 | }; |
| 173 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 174 | /* ALC882 models */ |
| 175 | enum { |
| 176 | ALC882_3ST_DIG, |
| 177 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 178 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 179 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 180 | ALC882_TARGA, |
| 181 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 182 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 183 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 184 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 185 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 186 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 187 | ALC882_MODEL_LAST, |
| 188 | }; |
| 189 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 190 | /* ALC883 models */ |
| 191 | enum { |
| 192 | ALC883_3ST_2ch_DIG, |
| 193 | ALC883_3ST_6ch_DIG, |
| 194 | ALC883_3ST_6ch, |
| 195 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 196 | ALC883_TARGA_DIG, |
| 197 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 198 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 199 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 200 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 201 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 202 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 203 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 204 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 205 | ALC888_LENOVO_MS7195_DIG, |
| 206 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 207 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 208 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 209 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 210 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 211 | ALC883_FUJITSU_PI2515, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 212 | ALC883_3ST_6ch_INTEL, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 213 | ALC883_AUTO, |
| 214 | ALC883_MODEL_LAST, |
| 215 | }; |
| 216 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 217 | /* for GPIO Poll */ |
| 218 | #define GPIO_MASK 0x03 |
| 219 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | struct alc_spec { |
| 221 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 222 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 223 | unsigned int num_mixers; |
| 224 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 225 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 226 | * don't forget NULL |
| 227 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 228 | */ |
| 229 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 231 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | struct hda_pcm_stream *stream_analog_playback; |
| 233 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 234 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 235 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 237 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | struct hda_pcm_stream *stream_digital_playback; |
| 239 | struct hda_pcm_stream *stream_digital_capture; |
| 240 | |
| 241 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 242 | struct hda_multi_out multiout; /* playback set-up |
| 243 | * max_channels, dacs must be set |
| 244 | * dig_out_nid and hp_nid are optional |
| 245 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 246 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | |
| 248 | /* capture */ |
| 249 | unsigned int num_adc_nids; |
| 250 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 251 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 252 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | |
| 254 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 255 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | const struct hda_input_mux *input_mux; |
| 257 | unsigned int cur_mux[3]; |
| 258 | |
| 259 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 260 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 261 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 262 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | |
| 264 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 265 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 266 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 267 | /* dynamic controls, init_verbs and input_mux */ |
| 268 | struct auto_pin_cfg autocfg; |
| 269 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 270 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 271 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 272 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 273 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 274 | /* hooks */ |
| 275 | void (*init_hook)(struct hda_codec *codec); |
| 276 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 277 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 278 | /* for pin sensing */ |
| 279 | unsigned int sense_updated: 1; |
| 280 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 281 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 282 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 283 | /* for virtual master */ |
| 284 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 285 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 286 | struct hda_loopback_check loopback; |
| 287 | #endif |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 288 | |
| 289 | /* for PLL fix */ |
| 290 | hda_nid_t pll_nid; |
| 291 | unsigned int pll_coef_idx, pll_coef_bit; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 292 | }; |
| 293 | |
| 294 | /* |
| 295 | * configuration template - to be copied to the spec instance |
| 296 | */ |
| 297 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 298 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 299 | * with spec |
| 300 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 301 | const struct hda_verb *init_verbs[5]; |
| 302 | unsigned int num_dacs; |
| 303 | hda_nid_t *dac_nids; |
| 304 | hda_nid_t dig_out_nid; /* optional */ |
| 305 | hda_nid_t hp_nid; /* optional */ |
| 306 | unsigned int num_adc_nids; |
| 307 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 308 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 309 | hda_nid_t dig_in_nid; |
| 310 | unsigned int num_channel_mode; |
| 311 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 312 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 313 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 314 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 315 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 316 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 317 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 318 | struct hda_amp_list *loopbacks; |
| 319 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 320 | }; |
| 321 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | |
| 323 | /* |
| 324 | * input MUX handling |
| 325 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 326 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 327 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 328 | { |
| 329 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 330 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 331 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 332 | if (mux_idx >= spec->num_mux_defs) |
| 333 | mux_idx = 0; |
| 334 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | } |
| 336 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 337 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 338 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | { |
| 340 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 341 | struct alc_spec *spec = codec->spec; |
| 342 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 343 | |
| 344 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 345 | return 0; |
| 346 | } |
| 347 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 348 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 349 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | { |
| 351 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 352 | struct alc_spec *spec = codec->spec; |
| 353 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 354 | 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] | 355 | hda_nid_t nid = spec->capsrc_nids ? |
| 356 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 357 | 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] | 358 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | } |
| 360 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 361 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | /* |
| 363 | * channel mode setting |
| 364 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 365 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 366 | struct snd_ctl_elem_info *uinfo) |
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_info(codec, uinfo, spec->channel_mode, |
| 371 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | } |
| 373 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 374 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 375 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 376 | { |
| 377 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 378 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 379 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 380 | spec->num_channel_mode, |
| 381 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 382 | } |
| 383 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 384 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 385 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | { |
| 387 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 388 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 389 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 390 | spec->num_channel_mode, |
| 391 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 392 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 393 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 394 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 395 | } |
| 396 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 397 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 398 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 399 | * instead of "%" to avoid consequences of accidently treating the % as |
| 400 | * being part of a format specifier. Maximum allowed length of a value is |
| 401 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 402 | * |
| 403 | * Note: some retasking pin complexes seem to ignore requests for input |
| 404 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 405 | * are requested. Therefore order this list so that this behaviour will not |
| 406 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 407 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 408 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 409 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 410 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 411 | "Mic 50pc bias", "Mic 80pc bias", |
| 412 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | }; |
| 414 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 415 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | }; |
| 417 | /* 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] | 418 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 419 | * addition, "input" pins may or may not process the mic bias option |
| 420 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 421 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 422 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 423 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 424 | #define ALC_PIN_DIR_IN 0x00 |
| 425 | #define ALC_PIN_DIR_OUT 0x01 |
| 426 | #define ALC_PIN_DIR_INOUT 0x02 |
| 427 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 428 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 429 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 430 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 431 | * For each direction the minimum and maximum values are given. |
| 432 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 433 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 435 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 436 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 437 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 438 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 439 | }; |
| 440 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 441 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 442 | #define alc_pin_mode_n_items(_dir) \ |
| 443 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 444 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 445 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 446 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 447 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 448 | unsigned int item_num = uinfo->value.enumerated.item; |
| 449 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 450 | |
| 451 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 452 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 453 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 454 | |
| 455 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 456 | item_num = alc_pin_mode_min(dir); |
| 457 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 458 | return 0; |
| 459 | } |
| 460 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 462 | struct snd_ctl_elem_value *ucontrol) |
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 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 465 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 466 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 468 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 469 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 470 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 471 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 472 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 473 | /* Find enumerated value for current pinctl setting */ |
| 474 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 475 | 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] | 476 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 477 | *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] | 478 | return 0; |
| 479 | } |
| 480 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 481 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 482 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | { |
| 484 | signed int change; |
| 485 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 486 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 487 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 488 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 489 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 490 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 491 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 492 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 493 | 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] | 494 | val = alc_pin_mode_min(dir); |
| 495 | |
| 496 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 497 | if (change) { |
| 498 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 499 | snd_hda_codec_write_cache(codec, nid, 0, |
| 500 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 501 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 502 | |
| 503 | /* Also enable the retasking pin's input/output as required |
| 504 | * for the requested pin mode. Enum values of 2 or less are |
| 505 | * input modes. |
| 506 | * |
| 507 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 508 | * reduces noise slightly (particularly on input) so we'll |
| 509 | * do it. However, having both input and output buffers |
| 510 | * enabled simultaneously doesn't seem to be problematic if |
| 511 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 512 | */ |
| 513 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 514 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 515 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 516 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 517 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 518 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 519 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 520 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 521 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 522 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 523 | } |
| 524 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 525 | return change; |
| 526 | } |
| 527 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 528 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 529 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 530 | .info = alc_pin_mode_info, \ |
| 531 | .get = alc_pin_mode_get, \ |
| 532 | .put = alc_pin_mode_put, \ |
| 533 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 534 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 535 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 536 | * together using a mask with more than one bit set. This control is |
| 537 | * currently used only by the ALC260 test model. At this stage they are not |
| 538 | * needed for any "production" models. |
| 539 | */ |
| 540 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 541 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 542 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 543 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 544 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 545 | { |
| 546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 547 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 548 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 549 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 551 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 552 | |
| 553 | *valp = (val & mask) != 0; |
| 554 | return 0; |
| 555 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 556 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 557 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 558 | { |
| 559 | signed int change; |
| 560 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 561 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 562 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 563 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 564 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 565 | AC_VERB_GET_GPIO_DATA, |
| 566 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 567 | |
| 568 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 569 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 570 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 571 | gpio_data &= ~mask; |
| 572 | else |
| 573 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 574 | snd_hda_codec_write_cache(codec, nid, 0, |
| 575 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 576 | |
| 577 | return change; |
| 578 | } |
| 579 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 580 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 581 | .info = alc_gpio_data_info, \ |
| 582 | .get = alc_gpio_data_get, \ |
| 583 | .put = alc_gpio_data_put, \ |
| 584 | .private_value = nid | (mask<<16) } |
| 585 | #endif /* CONFIG_SND_DEBUG */ |
| 586 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 587 | /* A switch control to allow the enabling of the digital IO pins on the |
| 588 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 589 | * to provide something in the test model allowing digital outputs to be |
| 590 | * identified if present. If models are found which can utilise these |
| 591 | * outputs a more complete mixer control can be devised for those models if |
| 592 | * necessary. |
| 593 | */ |
| 594 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 595 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 596 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 597 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 598 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 599 | { |
| 600 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 601 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 602 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 603 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 605 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 606 | |
| 607 | *valp = (val & mask) != 0; |
| 608 | return 0; |
| 609 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 610 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 611 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | { |
| 613 | signed int change; |
| 614 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 615 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 616 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 617 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 618 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 619 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 620 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 621 | |
| 622 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 623 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 624 | if (val==0) |
| 625 | ctrl_data &= ~mask; |
| 626 | else |
| 627 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 628 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 629 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 630 | |
| 631 | return change; |
| 632 | } |
| 633 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 634 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 635 | .info = alc_spdif_ctrl_info, \ |
| 636 | .get = alc_spdif_ctrl_get, \ |
| 637 | .put = alc_spdif_ctrl_put, \ |
| 638 | .private_value = nid | (mask<<16) } |
| 639 | #endif /* CONFIG_SND_DEBUG */ |
| 640 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 641 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 642 | * Again, this is only used in the ALC26x test models to help identify when |
| 643 | * the EAPD line must be asserted for features to work. |
| 644 | */ |
| 645 | #ifdef CONFIG_SND_DEBUG |
| 646 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 647 | |
| 648 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 649 | struct snd_ctl_elem_value *ucontrol) |
| 650 | { |
| 651 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 652 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 653 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 654 | long *valp = ucontrol->value.integer.value; |
| 655 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 656 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 657 | |
| 658 | *valp = (val & mask) != 0; |
| 659 | return 0; |
| 660 | } |
| 661 | |
| 662 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 663 | struct snd_ctl_elem_value *ucontrol) |
| 664 | { |
| 665 | int change; |
| 666 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 667 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 668 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 669 | long val = *ucontrol->value.integer.value; |
| 670 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 671 | AC_VERB_GET_EAPD_BTLENABLE, |
| 672 | 0x00); |
| 673 | |
| 674 | /* Set/unset the masked control bit(s) as needed */ |
| 675 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 676 | if (!val) |
| 677 | ctrl_data &= ~mask; |
| 678 | else |
| 679 | ctrl_data |= mask; |
| 680 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 681 | ctrl_data); |
| 682 | |
| 683 | return change; |
| 684 | } |
| 685 | |
| 686 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 687 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 688 | .info = alc_eapd_ctrl_info, \ |
| 689 | .get = alc_eapd_ctrl_get, \ |
| 690 | .put = alc_eapd_ctrl_put, \ |
| 691 | .private_value = nid | (mask<<16) } |
| 692 | #endif /* CONFIG_SND_DEBUG */ |
| 693 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 694 | /* |
| 695 | * set up from the preset table |
| 696 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 697 | static void setup_preset(struct alc_spec *spec, |
| 698 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 699 | { |
| 700 | int i; |
| 701 | |
| 702 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 703 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 704 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 705 | i++) |
| 706 | spec->init_verbs[spec->num_init_verbs++] = |
| 707 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 708 | |
| 709 | spec->channel_mode = preset->channel_mode; |
| 710 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 711 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 712 | |
| 713 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 714 | |
| 715 | spec->multiout.num_dacs = preset->num_dacs; |
| 716 | spec->multiout.dac_nids = preset->dac_nids; |
| 717 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 718 | spec->multiout.hp_nid = preset->hp_nid; |
| 719 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 720 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 721 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 722 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 723 | spec->input_mux = preset->input_mux; |
| 724 | |
| 725 | spec->num_adc_nids = preset->num_adc_nids; |
| 726 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 727 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 728 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 729 | |
| 730 | spec->unsol_event = preset->unsol_event; |
| 731 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 732 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 733 | spec->loopback.amplist = preset->loopbacks; |
| 734 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 735 | } |
| 736 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 737 | /* Enable GPIO mask and set output */ |
| 738 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 739 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 740 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 741 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 742 | { } |
| 743 | }; |
| 744 | |
| 745 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 746 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 747 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 748 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 749 | { } |
| 750 | }; |
| 751 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 752 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 753 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 754 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 755 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 756 | { } |
| 757 | }; |
| 758 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 759 | /* |
| 760 | * Fix hardware PLL issue |
| 761 | * On some codecs, the analog PLL gating control must be off while |
| 762 | * the default value is 1. |
| 763 | */ |
| 764 | static void alc_fix_pll(struct hda_codec *codec) |
| 765 | { |
| 766 | struct alc_spec *spec = codec->spec; |
| 767 | unsigned int val; |
| 768 | |
| 769 | if (!spec->pll_nid) |
| 770 | return; |
| 771 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 772 | spec->pll_coef_idx); |
| 773 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 774 | AC_VERB_GET_PROC_COEF, 0); |
| 775 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 776 | spec->pll_coef_idx); |
| 777 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 778 | val & ~(1 << spec->pll_coef_bit)); |
| 779 | } |
| 780 | |
| 781 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 782 | unsigned int coef_idx, unsigned int coef_bit) |
| 783 | { |
| 784 | struct alc_spec *spec = codec->spec; |
| 785 | spec->pll_nid = nid; |
| 786 | spec->pll_coef_idx = coef_idx; |
| 787 | spec->pll_coef_bit = coef_bit; |
| 788 | alc_fix_pll(codec); |
| 789 | } |
| 790 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 791 | static void alc_sku_automute(struct hda_codec *codec) |
| 792 | { |
| 793 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 794 | unsigned int present; |
| 795 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 796 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 797 | |
| 798 | /* need to execute and sync at first */ |
| 799 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 800 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 801 | AC_VERB_GET_PIN_SENSE, 0); |
| 802 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 803 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 804 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 805 | } |
| 806 | |
| 807 | /* unsolicited event for HP jack sensing */ |
| 808 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 809 | { |
| 810 | if (codec->vendor_id == 0x10ec0880) |
| 811 | res >>= 28; |
| 812 | else |
| 813 | res >>= 26; |
| 814 | if (res != ALC880_HP_EVENT) |
| 815 | return; |
| 816 | |
| 817 | alc_sku_automute(codec); |
| 818 | } |
| 819 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 820 | /* additional initialization for ALC888 variants */ |
| 821 | static void alc888_coef_init(struct hda_codec *codec) |
| 822 | { |
| 823 | unsigned int tmp; |
| 824 | |
| 825 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 826 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 827 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 828 | if ((tmp & 0xf0) == 2) |
| 829 | /* alc888S-VC */ |
| 830 | snd_hda_codec_read(codec, 0x20, 0, |
| 831 | AC_VERB_SET_PROC_COEF, 0x830); |
| 832 | else |
| 833 | /* alc888-VB */ |
| 834 | snd_hda_codec_read(codec, 0x20, 0, |
| 835 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 836 | } |
| 837 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 838 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 839 | * 31 ~ 16 : Manufacture ID |
| 840 | * 15 ~ 8 : SKU ID |
| 841 | * 7 ~ 0 : Assembly ID |
| 842 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 843 | */ |
| 844 | static void alc_subsystem_id(struct hda_codec *codec, |
| 845 | unsigned int porta, unsigned int porte, |
| 846 | unsigned int portd) |
| 847 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 848 | unsigned int ass, tmp, i; |
| 849 | unsigned nid; |
| 850 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 851 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 852 | ass = codec->subsystem_id & 0xffff; |
| 853 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 854 | goto do_sku; |
| 855 | |
| 856 | /* |
| 857 | * 31~30 : port conetcivity |
| 858 | * 29~21 : reserve |
| 859 | * 20 : PCBEEP input |
| 860 | * 19~16 : Check sum (15:1) |
| 861 | * 15~1 : Custom |
| 862 | * 0 : override |
| 863 | */ |
| 864 | nid = 0x1d; |
| 865 | if (codec->vendor_id == 0x10ec0260) |
| 866 | nid = 0x17; |
| 867 | ass = snd_hda_codec_read(codec, nid, 0, |
| 868 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 869 | if (!(ass & 1) && !(ass & 0x100000)) |
| 870 | return; |
| 871 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 872 | return; |
| 873 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 874 | /* check sum */ |
| 875 | tmp = 0; |
| 876 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 877 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 878 | tmp++; |
| 879 | } |
| 880 | if (((ass >> 16) & 0xf) != tmp) |
| 881 | return; |
| 882 | do_sku: |
| 883 | /* |
| 884 | * 0 : override |
| 885 | * 1 : Swap Jack |
| 886 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 887 | * 3~5 : External Amplifier control |
| 888 | * 7~6 : Reserved |
| 889 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 890 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 891 | switch (tmp) { |
| 892 | case 1: |
| 893 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 894 | break; |
| 895 | case 3: |
| 896 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 897 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 898 | case 7: |
| 899 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 900 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 902 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 903 | case 0x10ec0260: |
| 904 | snd_hda_codec_write(codec, 0x0f, 0, |
| 905 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 906 | snd_hda_codec_write(codec, 0x10, 0, |
| 907 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 908 | break; |
| 909 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 910 | case 0x10ec0267: |
| 911 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 912 | case 0x10ec0269: |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 913 | case 0x10ec0660: |
| 914 | case 0x10ec0662: |
| 915 | case 0x10ec0663: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 916 | case 0x10ec0862: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 917 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 918 | snd_hda_codec_write(codec, 0x14, 0, |
| 919 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 920 | snd_hda_codec_write(codec, 0x15, 0, |
| 921 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 922 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 923 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 924 | switch (codec->vendor_id) { |
| 925 | case 0x10ec0260: |
| 926 | snd_hda_codec_write(codec, 0x1a, 0, |
| 927 | AC_VERB_SET_COEF_INDEX, 7); |
| 928 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 929 | AC_VERB_GET_PROC_COEF, 0); |
| 930 | snd_hda_codec_write(codec, 0x1a, 0, |
| 931 | AC_VERB_SET_COEF_INDEX, 7); |
| 932 | snd_hda_codec_write(codec, 0x1a, 0, |
| 933 | AC_VERB_SET_PROC_COEF, |
| 934 | tmp | 0x2010); |
| 935 | break; |
| 936 | case 0x10ec0262: |
| 937 | case 0x10ec0880: |
| 938 | case 0x10ec0882: |
| 939 | case 0x10ec0883: |
| 940 | case 0x10ec0885: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 941 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 942 | snd_hda_codec_write(codec, 0x20, 0, |
| 943 | AC_VERB_SET_COEF_INDEX, 7); |
| 944 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 945 | AC_VERB_GET_PROC_COEF, 0); |
| 946 | snd_hda_codec_write(codec, 0x20, 0, |
| 947 | AC_VERB_SET_COEF_INDEX, 7); |
| 948 | snd_hda_codec_write(codec, 0x20, 0, |
| 949 | AC_VERB_SET_PROC_COEF, |
| 950 | tmp | 0x2010); |
| 951 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 952 | case 0x10ec0888: |
| 953 | alc888_coef_init(codec); |
| 954 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 955 | case 0x10ec0267: |
| 956 | case 0x10ec0268: |
| 957 | snd_hda_codec_write(codec, 0x20, 0, |
| 958 | AC_VERB_SET_COEF_INDEX, 7); |
| 959 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 960 | AC_VERB_GET_PROC_COEF, 0); |
| 961 | snd_hda_codec_write(codec, 0x20, 0, |
| 962 | AC_VERB_SET_COEF_INDEX, 7); |
| 963 | snd_hda_codec_write(codec, 0x20, 0, |
| 964 | AC_VERB_SET_PROC_COEF, |
| 965 | tmp | 0x3000); |
| 966 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 967 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 968 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 969 | break; |
| 970 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 971 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 972 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 973 | * when the external headphone out jack is plugged" |
| 974 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 975 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 976 | return; |
| 977 | /* |
| 978 | * 10~8 : Jack location |
| 979 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 980 | * 14~13: Resvered |
| 981 | * 15 : 1 --> enable the function "Mute internal speaker |
| 982 | * when the external headphone out jack is plugged" |
| 983 | */ |
| 984 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 985 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 986 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 987 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 988 | else |
| 989 | return; |
| 990 | } |
| 991 | |
| 992 | if (!spec->autocfg.hp_pins[0]) { |
| 993 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 994 | if (tmp == 0) |
| 995 | spec->autocfg.hp_pins[0] = porta; |
| 996 | else if (tmp == 1) |
| 997 | spec->autocfg.hp_pins[0] = porte; |
| 998 | else if (tmp == 2) |
| 999 | spec->autocfg.hp_pins[0] = portd; |
| 1000 | else |
| 1001 | return; |
| 1002 | } |
| 1003 | |
| 1004 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 1005 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 1006 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 1007 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1008 | } |
| 1009 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 1010 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 1011 | * Fix-up pin default configurations |
| 1012 | */ |
| 1013 | |
| 1014 | struct alc_pincfg { |
| 1015 | hda_nid_t nid; |
| 1016 | u32 val; |
| 1017 | }; |
| 1018 | |
| 1019 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 1020 | const struct snd_pci_quirk *quirk, |
| 1021 | const struct alc_pincfg **pinfix) |
| 1022 | { |
| 1023 | const struct alc_pincfg *cfg; |
| 1024 | |
| 1025 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 1026 | if (!quirk) |
| 1027 | return; |
| 1028 | |
| 1029 | cfg = pinfix[quirk->value]; |
| 1030 | for (; cfg->nid; cfg++) { |
| 1031 | int i; |
| 1032 | u32 val = cfg->val; |
| 1033 | for (i = 0; i < 4; i++) { |
| 1034 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 1035 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 1036 | val & 0xff); |
| 1037 | val >>= 8; |
| 1038 | } |
| 1039 | } |
| 1040 | } |
| 1041 | |
| 1042 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1043 | * ALC880 3-stack model |
| 1044 | * |
| 1045 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1046 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 1047 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1048 | */ |
| 1049 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1050 | static hda_nid_t alc880_dac_nids[4] = { |
| 1051 | /* front, rear, clfe, rear_surr */ |
| 1052 | 0x02, 0x05, 0x04, 0x03 |
| 1053 | }; |
| 1054 | |
| 1055 | static hda_nid_t alc880_adc_nids[3] = { |
| 1056 | /* ADC0-2 */ |
| 1057 | 0x07, 0x08, 0x09, |
| 1058 | }; |
| 1059 | |
| 1060 | /* The datasheet says the node 0x07 is connected from inputs, |
| 1061 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1062 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1063 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1064 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1065 | /* ADC1-2 */ |
| 1066 | 0x08, 0x09, |
| 1067 | }; |
| 1068 | |
| 1069 | #define ALC880_DIGOUT_NID 0x06 |
| 1070 | #define ALC880_DIGIN_NID 0x0a |
| 1071 | |
| 1072 | static struct hda_input_mux alc880_capture_source = { |
| 1073 | .num_items = 4, |
| 1074 | .items = { |
| 1075 | { "Mic", 0x0 }, |
| 1076 | { "Front Mic", 0x3 }, |
| 1077 | { "Line", 0x2 }, |
| 1078 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1079 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1080 | }; |
| 1081 | |
| 1082 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1083 | /* 2ch mode */ |
| 1084 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1085 | /* set line-in to input, mute it */ |
| 1086 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1087 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1088 | /* set mic-in to input vref 80%, mute it */ |
| 1089 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1090 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1091 | { } /* end */ |
| 1092 | }; |
| 1093 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1094 | /* 6ch mode */ |
| 1095 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1096 | /* set line-in to output, unmute it */ |
| 1097 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1098 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1099 | /* set mic-in to output, unmute it */ |
| 1100 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1101 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1102 | { } /* end */ |
| 1103 | }; |
| 1104 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1105 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1106 | { 2, alc880_threestack_ch2_init }, |
| 1107 | { 6, alc880_threestack_ch6_init }, |
| 1108 | }; |
| 1109 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1110 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1111 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1112 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1113 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1114 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1115 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1116 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1117 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1118 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1119 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1120 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1121 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1122 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1123 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1124 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1125 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1126 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1127 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1128 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1129 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1130 | { |
| 1131 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1132 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1133 | .info = alc_ch_mode_info, |
| 1134 | .get = alc_ch_mode_get, |
| 1135 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1136 | }, |
| 1137 | { } /* end */ |
| 1138 | }; |
| 1139 | |
| 1140 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1141 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1142 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1143 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1144 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1145 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1146 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1147 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1148 | { |
| 1149 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1150 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1151 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1152 | */ |
| 1153 | /* .name = "Capture Source", */ |
| 1154 | .name = "Input Source", |
| 1155 | .count = 3, |
| 1156 | .info = alc_mux_enum_info, |
| 1157 | .get = alc_mux_enum_get, |
| 1158 | .put = alc_mux_enum_put, |
| 1159 | }, |
| 1160 | { } /* end */ |
| 1161 | }; |
| 1162 | |
| 1163 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1164 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1165 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1166 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1167 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1168 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1169 | { |
| 1170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1171 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1172 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1173 | */ |
| 1174 | /* .name = "Capture Source", */ |
| 1175 | .name = "Input Source", |
| 1176 | .count = 2, |
| 1177 | .info = alc_mux_enum_info, |
| 1178 | .get = alc_mux_enum_get, |
| 1179 | .put = alc_mux_enum_put, |
| 1180 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1181 | { } /* end */ |
| 1182 | }; |
| 1183 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1184 | |
| 1185 | |
| 1186 | /* |
| 1187 | * ALC880 5-stack model |
| 1188 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1189 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1190 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1191 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1192 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1193 | */ |
| 1194 | |
| 1195 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1196 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1197 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1198 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1199 | { } /* end */ |
| 1200 | }; |
| 1201 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1202 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1203 | /* 6ch mode */ |
| 1204 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1205 | /* set line-in to input, mute it */ |
| 1206 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1207 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1208 | { } /* end */ |
| 1209 | }; |
| 1210 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1211 | /* 8ch mode */ |
| 1212 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1213 | /* set line-in to output, unmute it */ |
| 1214 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1215 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1216 | { } /* end */ |
| 1217 | }; |
| 1218 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1219 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1220 | { 6, alc880_fivestack_ch6_init }, |
| 1221 | { 8, alc880_fivestack_ch8_init }, |
| 1222 | }; |
| 1223 | |
| 1224 | |
| 1225 | /* |
| 1226 | * ALC880 6-stack model |
| 1227 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1228 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1229 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1230 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1231 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1232 | */ |
| 1233 | |
| 1234 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1235 | /* front, rear, clfe, rear_surr */ |
| 1236 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1237 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1238 | |
| 1239 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1240 | .num_items = 4, |
| 1241 | .items = { |
| 1242 | { "Mic", 0x0 }, |
| 1243 | { "Front Mic", 0x1 }, |
| 1244 | { "Line", 0x2 }, |
| 1245 | { "CD", 0x4 }, |
| 1246 | }, |
| 1247 | }; |
| 1248 | |
| 1249 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1250 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1251 | { 8, NULL }, |
| 1252 | }; |
| 1253 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1254 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1255 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1256 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1257 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1258 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1259 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1260 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1262 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1263 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1265 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1266 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1267 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1268 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1269 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1270 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1271 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1272 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1273 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1274 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1275 | { |
| 1276 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1277 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1278 | .info = alc_ch_mode_info, |
| 1279 | .get = alc_ch_mode_get, |
| 1280 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1281 | }, |
| 1282 | { } /* end */ |
| 1283 | }; |
| 1284 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1285 | |
| 1286 | /* |
| 1287 | * ALC880 W810 model |
| 1288 | * |
| 1289 | * W810 has rear IO for: |
| 1290 | * Front (DAC 02) |
| 1291 | * Surround (DAC 03) |
| 1292 | * Center/LFE (DAC 04) |
| 1293 | * Digital out (06) |
| 1294 | * |
| 1295 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1296 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1297 | * |
| 1298 | * There is a variable resistor to control the speaker or headphone |
| 1299 | * volume. This is a hardware-only device without a software API. |
| 1300 | * |
| 1301 | * Plugging headphones in will disable the internal speakers. This is |
| 1302 | * implemented in hardware, not via the driver using jack sense. In |
| 1303 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1304 | * disable both the speakers and headphones. |
| 1305 | * |
| 1306 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1307 | * These may not do anything useful with this driver yet, because I |
| 1308 | * haven't setup any initialization verbs for these yet... |
| 1309 | */ |
| 1310 | |
| 1311 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1312 | /* front, rear/surround, clfe */ |
| 1313 | 0x02, 0x03, 0x04 |
| 1314 | }; |
| 1315 | |
| 1316 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1317 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1318 | { 6, NULL } |
| 1319 | }; |
| 1320 | |
| 1321 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1322 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1323 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1324 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1325 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1326 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1327 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1328 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1329 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1330 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1331 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1332 | { } /* end */ |
| 1333 | }; |
| 1334 | |
| 1335 | |
| 1336 | /* |
| 1337 | * Z710V model |
| 1338 | * |
| 1339 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1340 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1341 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1342 | */ |
| 1343 | |
| 1344 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1345 | 0x02 |
| 1346 | }; |
| 1347 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1348 | |
| 1349 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1350 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1351 | { 2, NULL } |
| 1352 | }; |
| 1353 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1354 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1355 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1356 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1357 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1358 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1359 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1360 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1361 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1362 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1363 | { } /* end */ |
| 1364 | }; |
| 1365 | |
| 1366 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1367 | /* |
| 1368 | * ALC880 F1734 model |
| 1369 | * |
| 1370 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1371 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1372 | */ |
| 1373 | |
| 1374 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1375 | 0x03 |
| 1376 | }; |
| 1377 | #define ALC880_F1734_HP_DAC 0x02 |
| 1378 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1379 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1380 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1381 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1382 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1383 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1384 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1385 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1386 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1387 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1388 | { } /* end */ |
| 1389 | }; |
| 1390 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1391 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1392 | .num_items = 2, |
| 1393 | .items = { |
| 1394 | { "Mic", 0x1 }, |
| 1395 | { "CD", 0x4 }, |
| 1396 | }, |
| 1397 | }; |
| 1398 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1399 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1400 | /* |
| 1401 | * ALC880 ASUS model |
| 1402 | * |
| 1403 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1404 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1405 | * Mic = 0x18, Line = 0x1a |
| 1406 | */ |
| 1407 | |
| 1408 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1409 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1410 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1411 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1412 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1413 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1414 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1415 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1416 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1417 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1418 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1419 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1420 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1421 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1422 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1423 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1426 | { |
| 1427 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1428 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1429 | .info = alc_ch_mode_info, |
| 1430 | .get = alc_ch_mode_get, |
| 1431 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1432 | }, |
| 1433 | { } /* end */ |
| 1434 | }; |
| 1435 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1436 | /* |
| 1437 | * ALC880 ASUS W1V model |
| 1438 | * |
| 1439 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1440 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1441 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1442 | */ |
| 1443 | |
| 1444 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1445 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1446 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1447 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1448 | { } /* end */ |
| 1449 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1450 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1451 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1452 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1453 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1454 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1455 | { } /* end */ |
| 1456 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1457 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1458 | /* TCL S700 */ |
| 1459 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1461 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1465 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1466 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1467 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1468 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1469 | { |
| 1470 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1471 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1472 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1473 | */ |
| 1474 | /* .name = "Capture Source", */ |
| 1475 | .name = "Input Source", |
| 1476 | .count = 1, |
| 1477 | .info = alc_mux_enum_info, |
| 1478 | .get = alc_mux_enum_get, |
| 1479 | .put = alc_mux_enum_put, |
| 1480 | }, |
| 1481 | { } /* end */ |
| 1482 | }; |
| 1483 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1484 | /* Uniwill */ |
| 1485 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1486 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1487 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1488 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1489 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1490 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1491 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1492 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1493 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1494 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1495 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1496 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1497 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1498 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1499 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1500 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1501 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1502 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1503 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1504 | { |
| 1505 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1506 | .name = "Channel Mode", |
| 1507 | .info = alc_ch_mode_info, |
| 1508 | .get = alc_ch_mode_get, |
| 1509 | .put = alc_ch_mode_put, |
| 1510 | }, |
| 1511 | { } /* end */ |
| 1512 | }; |
| 1513 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1514 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1515 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1516 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1517 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1518 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1520 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1521 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1522 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1523 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1524 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1525 | { } /* end */ |
| 1526 | }; |
| 1527 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1528 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1529 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1530 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1531 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1532 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1535 | { } /* end */ |
| 1536 | }; |
| 1537 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1538 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1539 | * virtual master controls |
| 1540 | */ |
| 1541 | |
| 1542 | /* |
| 1543 | * slave controls for virtual master |
| 1544 | */ |
| 1545 | static const char *alc_slave_vols[] = { |
| 1546 | "Front Playback Volume", |
| 1547 | "Surround Playback Volume", |
| 1548 | "Center Playback Volume", |
| 1549 | "LFE Playback Volume", |
| 1550 | "Side Playback Volume", |
| 1551 | "Headphone Playback Volume", |
| 1552 | "Speaker Playback Volume", |
| 1553 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1554 | "Line-Out Playback Volume", |
| 1555 | NULL, |
| 1556 | }; |
| 1557 | |
| 1558 | static const char *alc_slave_sws[] = { |
| 1559 | "Front Playback Switch", |
| 1560 | "Surround Playback Switch", |
| 1561 | "Center Playback Switch", |
| 1562 | "LFE Playback Switch", |
| 1563 | "Side Playback Switch", |
| 1564 | "Headphone Playback Switch", |
| 1565 | "Speaker Playback Switch", |
| 1566 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1567 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1568 | NULL, |
| 1569 | }; |
| 1570 | |
| 1571 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1572 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1573 | */ |
| 1574 | static int alc_build_controls(struct hda_codec *codec) |
| 1575 | { |
| 1576 | struct alc_spec *spec = codec->spec; |
| 1577 | int err; |
| 1578 | int i; |
| 1579 | |
| 1580 | for (i = 0; i < spec->num_mixers; i++) { |
| 1581 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1582 | if (err < 0) |
| 1583 | return err; |
| 1584 | } |
| 1585 | |
| 1586 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1587 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1588 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | if (err < 0) |
| 1590 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1591 | err = snd_hda_create_spdif_share_sw(codec, |
| 1592 | &spec->multiout); |
| 1593 | if (err < 0) |
| 1594 | return err; |
| 1595 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1596 | } |
| 1597 | if (spec->dig_in_nid) { |
| 1598 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1599 | if (err < 0) |
| 1600 | return err; |
| 1601 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1602 | |
| 1603 | /* if we have no master control, let's create it */ |
| 1604 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1605 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1606 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1607 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1608 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1609 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1610 | if (err < 0) |
| 1611 | return err; |
| 1612 | } |
| 1613 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1614 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1615 | NULL, alc_slave_sws); |
| 1616 | if (err < 0) |
| 1617 | return err; |
| 1618 | } |
| 1619 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1620 | return 0; |
| 1621 | } |
| 1622 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1623 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1624 | /* |
| 1625 | * initialize the codec volumes, etc |
| 1626 | */ |
| 1627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1628 | /* |
| 1629 | * generic initialization of ADC, input mixers and output mixers |
| 1630 | */ |
| 1631 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1632 | /* |
| 1633 | * Unmute ADC0-2 and set the default input to mic-in |
| 1634 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1635 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1636 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1637 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1638 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1639 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1640 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1641 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1642 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1643 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1644 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1645 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1646 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1647 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1648 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1649 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1650 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1651 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1652 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1653 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1654 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1655 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1656 | /* |
| 1657 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1658 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1659 | /* set vol=0 to output mixers */ |
| 1660 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1661 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1662 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1663 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1664 | /* set up input amps for analog loopback */ |
| 1665 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1666 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1667 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1668 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1669 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1670 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1671 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1672 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1673 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1674 | |
| 1675 | { } |
| 1676 | }; |
| 1677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1678 | /* |
| 1679 | * 3-stack pin configuration: |
| 1680 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1681 | */ |
| 1682 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1683 | /* |
| 1684 | * preset connection lists of input pins |
| 1685 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1686 | */ |
| 1687 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1688 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1689 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1690 | |
| 1691 | /* |
| 1692 | * Set pin mode and muting |
| 1693 | */ |
| 1694 | /* set front pin widgets 0x14 for output */ |
| 1695 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1696 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1697 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1698 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1699 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1700 | /* Mic2 (as headphone out) for HP output */ |
| 1701 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1702 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | /* Line In pin widget for input */ |
| 1704 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1705 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1706 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1707 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1708 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1709 | /* CD pin widget for input */ |
| 1710 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1711 | |
| 1712 | { } |
| 1713 | }; |
| 1714 | |
| 1715 | /* |
| 1716 | * 5-stack pin configuration: |
| 1717 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1718 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1719 | */ |
| 1720 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1721 | /* |
| 1722 | * preset connection lists of input pins |
| 1723 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1724 | */ |
| 1725 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1726 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1727 | |
| 1728 | /* |
| 1729 | * Set pin mode and muting |
| 1730 | */ |
| 1731 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1732 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1733 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1734 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1735 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1736 | /* unmute pins for output (no gain on this amp) */ |
| 1737 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1738 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1739 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1740 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1741 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1742 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1743 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1744 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1745 | /* Mic2 (as headphone out) for HP output */ |
| 1746 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1747 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | /* Line In pin widget for input */ |
| 1749 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1750 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1751 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1752 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1753 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1754 | /* CD pin widget for input */ |
| 1755 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1756 | |
| 1757 | { } |
| 1758 | }; |
| 1759 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1760 | /* |
| 1761 | * W810 pin configuration: |
| 1762 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1763 | */ |
| 1764 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1765 | /* hphone/speaker input selector: front DAC */ |
| 1766 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1767 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1768 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1772 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1773 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1774 | |
| 1775 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1776 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1777 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1778 | { } |
| 1779 | }; |
| 1780 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1781 | /* |
| 1782 | * Z71V pin configuration: |
| 1783 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1784 | */ |
| 1785 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1786 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1787 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1788 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1789 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1790 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1791 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1792 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1793 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1794 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1795 | |
| 1796 | { } |
| 1797 | }; |
| 1798 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1799 | /* |
| 1800 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1801 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1802 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1803 | */ |
| 1804 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1805 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1806 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1809 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1811 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1812 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1813 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1814 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1815 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1816 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1820 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1822 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1823 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1824 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1825 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1826 | { } |
| 1827 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1828 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1829 | /* |
| 1830 | * Uniwill pin configuration: |
| 1831 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1832 | * line = 0x1a |
| 1833 | */ |
| 1834 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1835 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1836 | |
| 1837 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1838 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1839 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1840 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1841 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1842 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1843 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1844 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1846 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1848 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1850 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1851 | |
| 1852 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1853 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1854 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1855 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1856 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1857 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1858 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1859 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1860 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1861 | |
| 1862 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1863 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1864 | |
| 1865 | { } |
| 1866 | }; |
| 1867 | |
| 1868 | /* |
| 1869 | * Uniwill P53 |
| 1870 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1871 | */ |
| 1872 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1873 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1874 | |
| 1875 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1876 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1877 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1879 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1880 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1883 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1884 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1885 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1886 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1887 | |
| 1888 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1889 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1890 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1891 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1892 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1893 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1894 | |
| 1895 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1896 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1897 | |
| 1898 | { } |
| 1899 | }; |
| 1900 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1901 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1902 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1903 | { } |
| 1904 | }; |
| 1905 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1906 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1907 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1908 | { |
| 1909 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1910 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1911 | |
| 1912 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1913 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1914 | bits = present ? HDA_AMP_MUTE : 0; |
| 1915 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1916 | HDA_AMP_MUTE, bits); |
| 1917 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1918 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1919 | } |
| 1920 | |
| 1921 | /* auto-toggle front mic */ |
| 1922 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1923 | { |
| 1924 | unsigned int present; |
| 1925 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1926 | |
| 1927 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1928 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1929 | bits = present ? HDA_AMP_MUTE : 0; |
| 1930 | 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] | 1931 | } |
| 1932 | |
| 1933 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1934 | { |
| 1935 | alc880_uniwill_hp_automute(codec); |
| 1936 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1937 | } |
| 1938 | |
| 1939 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1940 | unsigned int res) |
| 1941 | { |
| 1942 | /* Looks like the unsol event is incompatible with the standard |
| 1943 | * definition. 4bit tag is placed at 28 bit! |
| 1944 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1945 | switch (res >> 28) { |
| 1946 | case ALC880_HP_EVENT: |
| 1947 | alc880_uniwill_hp_automute(codec); |
| 1948 | break; |
| 1949 | case ALC880_MIC_EVENT: |
| 1950 | alc880_uniwill_mic_automute(codec); |
| 1951 | break; |
| 1952 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1953 | } |
| 1954 | |
| 1955 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1956 | { |
| 1957 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1958 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1959 | |
| 1960 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1961 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1962 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1963 | 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] | 1964 | } |
| 1965 | |
| 1966 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1967 | { |
| 1968 | unsigned int present; |
| 1969 | |
| 1970 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1971 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1972 | present &= HDA_AMP_VOLMASK; |
| 1973 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1974 | HDA_AMP_VOLMASK, present); |
| 1975 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1976 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1977 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1978 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1979 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1980 | unsigned int res) |
| 1981 | { |
| 1982 | /* Looks like the unsol event is incompatible with the standard |
| 1983 | * definition. 4bit tag is placed at 28 bit! |
| 1984 | */ |
| 1985 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1986 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1987 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1988 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1989 | } |
| 1990 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1991 | /* |
| 1992 | * F1734 pin configuration: |
| 1993 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1994 | */ |
| 1995 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1996 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1997 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1998 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1999 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2000 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2001 | |
| 2002 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2003 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2004 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2005 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2006 | |
| 2007 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2008 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 2009 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2010 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2011 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2012 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2013 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2014 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2015 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2016 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 2017 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 2018 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 2019 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2020 | { } |
| 2021 | }; |
| 2022 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2023 | /* |
| 2024 | * ASUS pin configuration: |
| 2025 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 2026 | */ |
| 2027 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 2028 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 2029 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2030 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2031 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2032 | |
| 2033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2034 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2035 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2036 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2037 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2038 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2039 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2040 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2041 | |
| 2042 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2043 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2044 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2045 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2046 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2047 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2049 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2050 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2051 | |
| 2052 | { } |
| 2053 | }; |
| 2054 | |
| 2055 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 2056 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 2057 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2058 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2059 | /* Clevo m520g init */ |
| 2060 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 2061 | /* headphone output */ |
| 2062 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2063 | /* line-out */ |
| 2064 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2065 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2066 | /* Line-in */ |
| 2067 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2068 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2069 | /* CD */ |
| 2070 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2071 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2072 | /* Mic1 (rear panel) */ |
| 2073 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2074 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2075 | /* Mic2 (front panel) */ |
| 2076 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2077 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2078 | /* headphone */ |
| 2079 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2081 | /* change to EAPD mode */ |
| 2082 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2083 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2084 | |
| 2085 | { } |
| 2086 | }; |
| 2087 | |
| 2088 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2089 | /* change to EAPD mode */ |
| 2090 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2091 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2092 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2093 | /* Headphone output */ |
| 2094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2095 | /* Front output*/ |
| 2096 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2097 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2098 | |
| 2099 | /* Line In pin widget for input */ |
| 2100 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2101 | /* CD pin widget for input */ |
| 2102 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2103 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2104 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2105 | |
| 2106 | /* change to EAPD mode */ |
| 2107 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2108 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2109 | |
| 2110 | { } |
| 2111 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2112 | |
| 2113 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2114 | * LG m1 express dual |
| 2115 | * |
| 2116 | * Pin assignment: |
| 2117 | * Rear Line-In/Out (blue): 0x14 |
| 2118 | * Build-in Mic-In: 0x15 |
| 2119 | * Speaker-out: 0x17 |
| 2120 | * HP-Out (green): 0x1b |
| 2121 | * Mic-In/Out (red): 0x19 |
| 2122 | * SPDIF-Out: 0x1e |
| 2123 | */ |
| 2124 | |
| 2125 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2126 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2127 | 0x05, 0x02, 0x03 |
| 2128 | }; |
| 2129 | |
| 2130 | /* seems analog CD is not working */ |
| 2131 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2132 | .num_items = 3, |
| 2133 | .items = { |
| 2134 | { "Mic", 0x1 }, |
| 2135 | { "Line", 0x5 }, |
| 2136 | { "Internal Mic", 0x6 }, |
| 2137 | }, |
| 2138 | }; |
| 2139 | |
| 2140 | /* 2,4,6 channel modes */ |
| 2141 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2142 | /* set line-in and mic-in to input */ |
| 2143 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2144 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2145 | { } |
| 2146 | }; |
| 2147 | |
| 2148 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2149 | /* set line-in to out and mic-in to input */ |
| 2150 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2151 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2152 | { } |
| 2153 | }; |
| 2154 | |
| 2155 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2156 | /* set line-in and mic-in to output */ |
| 2157 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2158 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2159 | { } |
| 2160 | }; |
| 2161 | |
| 2162 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2163 | { 2, alc880_lg_ch2_init }, |
| 2164 | { 4, alc880_lg_ch4_init }, |
| 2165 | { 6, alc880_lg_ch6_init }, |
| 2166 | }; |
| 2167 | |
| 2168 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2169 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2170 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2171 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2172 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2173 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2174 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2175 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2176 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2177 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2178 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2179 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2180 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2181 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2182 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2183 | { |
| 2184 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2185 | .name = "Channel Mode", |
| 2186 | .info = alc_ch_mode_info, |
| 2187 | .get = alc_ch_mode_get, |
| 2188 | .put = alc_ch_mode_put, |
| 2189 | }, |
| 2190 | { } /* end */ |
| 2191 | }; |
| 2192 | |
| 2193 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2194 | /* set capture source to mic-in */ |
| 2195 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2196 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2197 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2198 | /* mute all amp mixer inputs */ |
| 2199 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2200 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2201 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2202 | /* line-in to input */ |
| 2203 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2204 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2205 | /* built-in mic */ |
| 2206 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2207 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2208 | /* speaker-out */ |
| 2209 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2210 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2211 | /* mic-in to input */ |
| 2212 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2213 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2214 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2215 | /* HP-out */ |
| 2216 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2217 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2218 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2219 | /* jack sense */ |
| 2220 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2221 | { } |
| 2222 | }; |
| 2223 | |
| 2224 | /* toggle speaker-output according to the hp-jack state */ |
| 2225 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2226 | { |
| 2227 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2228 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2229 | |
| 2230 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2231 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2232 | bits = present ? HDA_AMP_MUTE : 0; |
| 2233 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2234 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2235 | } |
| 2236 | |
| 2237 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2238 | { |
| 2239 | /* Looks like the unsol event is incompatible with the standard |
| 2240 | * definition. 4bit tag is placed at 28 bit! |
| 2241 | */ |
| 2242 | if ((res >> 28) == 0x01) |
| 2243 | alc880_lg_automute(codec); |
| 2244 | } |
| 2245 | |
| 2246 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2247 | * LG LW20 |
| 2248 | * |
| 2249 | * Pin assignment: |
| 2250 | * Speaker-out: 0x14 |
| 2251 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2252 | * Built-in Mic-In: 0x19 |
| 2253 | * Line-In: 0x1b |
| 2254 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2255 | * SPDIF-Out: 0x1e |
| 2256 | */ |
| 2257 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2258 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2259 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2260 | .items = { |
| 2261 | { "Mic", 0x0 }, |
| 2262 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2263 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2264 | }, |
| 2265 | }; |
| 2266 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2267 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2268 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2269 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2270 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2271 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2272 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2273 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2274 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2275 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2276 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2277 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2278 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2279 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2280 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2281 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2282 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2283 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2284 | { |
| 2285 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2286 | .name = "Channel Mode", |
| 2287 | .info = alc_ch_mode_info, |
| 2288 | .get = alc_ch_mode_get, |
| 2289 | .put = alc_ch_mode_put, |
| 2290 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2291 | { } /* end */ |
| 2292 | }; |
| 2293 | |
| 2294 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2295 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2296 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2297 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2298 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2299 | /* set capture source to mic-in */ |
| 2300 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2301 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2303 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2304 | /* speaker-out */ |
| 2305 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2306 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2307 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2308 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2309 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2310 | /* mic-in to input */ |
| 2311 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2312 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2313 | /* built-in mic */ |
| 2314 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2315 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2316 | /* jack sense */ |
| 2317 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2318 | { } |
| 2319 | }; |
| 2320 | |
| 2321 | /* toggle speaker-output according to the hp-jack state */ |
| 2322 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2323 | { |
| 2324 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2325 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2326 | |
| 2327 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2328 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2329 | bits = present ? HDA_AMP_MUTE : 0; |
| 2330 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2331 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2332 | } |
| 2333 | |
| 2334 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2335 | { |
| 2336 | /* Looks like the unsol event is incompatible with the standard |
| 2337 | * definition. 4bit tag is placed at 28 bit! |
| 2338 | */ |
| 2339 | if ((res >> 28) == 0x01) |
| 2340 | alc880_lg_lw_automute(codec); |
| 2341 | } |
| 2342 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2343 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2344 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2345 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2346 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2347 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2348 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2349 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2350 | { } /* end */ |
| 2351 | }; |
| 2352 | |
| 2353 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2354 | .num_items = 2, |
| 2355 | .items = { |
| 2356 | { "Mic", 0x0 }, |
| 2357 | { "Internal Mic", 0x1 }, |
| 2358 | }, |
| 2359 | }; |
| 2360 | |
| 2361 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2362 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2363 | |
| 2364 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2365 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2366 | |
| 2367 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2368 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2369 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2370 | /* Mic2 (as headphone out) for HP output */ |
| 2371 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2372 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2373 | /* Internal Speaker */ |
| 2374 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2375 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2376 | |
| 2377 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2378 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2379 | |
| 2380 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2381 | { } |
| 2382 | }; |
| 2383 | |
| 2384 | /* toggle speaker-output according to the hp-jack state */ |
| 2385 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2386 | { |
| 2387 | unsigned int present; |
| 2388 | unsigned char bits; |
| 2389 | |
| 2390 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2391 | AC_VERB_GET_PIN_SENSE, 0) |
| 2392 | & AC_PINSENSE_PRESENCE; |
| 2393 | bits = present ? HDA_AMP_MUTE : 0; |
| 2394 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2395 | HDA_AMP_MUTE, bits); |
| 2396 | if (present) |
| 2397 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2398 | else |
| 2399 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2400 | } |
| 2401 | |
| 2402 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2403 | unsigned int res) |
| 2404 | { |
| 2405 | /* Looks like the unsol event is incompatible with the standard |
| 2406 | * definition. 4bit tag is placed at 28 bit! |
| 2407 | */ |
| 2408 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2409 | alc880_medion_rim_automute(codec); |
| 2410 | } |
| 2411 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2412 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2413 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2414 | { 0x0b, HDA_INPUT, 0 }, |
| 2415 | { 0x0b, HDA_INPUT, 1 }, |
| 2416 | { 0x0b, HDA_INPUT, 2 }, |
| 2417 | { 0x0b, HDA_INPUT, 3 }, |
| 2418 | { 0x0b, HDA_INPUT, 4 }, |
| 2419 | { } /* end */ |
| 2420 | }; |
| 2421 | |
| 2422 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2423 | { 0x0b, HDA_INPUT, 1 }, |
| 2424 | { 0x0b, HDA_INPUT, 6 }, |
| 2425 | { 0x0b, HDA_INPUT, 7 }, |
| 2426 | { } /* end */ |
| 2427 | }; |
| 2428 | #endif |
| 2429 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2430 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2431 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2432 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2433 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2434 | static int alc_init(struct hda_codec *codec) |
| 2435 | { |
| 2436 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2437 | unsigned int i; |
| 2438 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 2439 | alc_fix_pll(codec); |
| 2440 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2441 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2442 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2443 | |
| 2444 | if (spec->init_hook) |
| 2445 | spec->init_hook(codec); |
| 2446 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2447 | return 0; |
| 2448 | } |
| 2449 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2450 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2451 | { |
| 2452 | struct alc_spec *spec = codec->spec; |
| 2453 | |
| 2454 | if (spec->unsol_event) |
| 2455 | spec->unsol_event(codec, res); |
| 2456 | } |
| 2457 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2458 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2459 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2460 | { |
| 2461 | struct alc_spec *spec = codec->spec; |
| 2462 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2463 | } |
| 2464 | #endif |
| 2465 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2466 | /* |
| 2467 | * Analog playback callbacks |
| 2468 | */ |
| 2469 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2470 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2471 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2472 | { |
| 2473 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2474 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2475 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2476 | } |
| 2477 | |
| 2478 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2479 | struct hda_codec *codec, |
| 2480 | unsigned int stream_tag, |
| 2481 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2482 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2483 | { |
| 2484 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2485 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2486 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2487 | } |
| 2488 | |
| 2489 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2490 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2491 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2492 | { |
| 2493 | struct alc_spec *spec = codec->spec; |
| 2494 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2495 | } |
| 2496 | |
| 2497 | /* |
| 2498 | * Digital out |
| 2499 | */ |
| 2500 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2501 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2502 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2503 | { |
| 2504 | struct alc_spec *spec = codec->spec; |
| 2505 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2506 | } |
| 2507 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2508 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2509 | struct hda_codec *codec, |
| 2510 | unsigned int stream_tag, |
| 2511 | unsigned int format, |
| 2512 | struct snd_pcm_substream *substream) |
| 2513 | { |
| 2514 | struct alc_spec *spec = codec->spec; |
| 2515 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2516 | stream_tag, format, substream); |
| 2517 | } |
| 2518 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2519 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2520 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2521 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2522 | { |
| 2523 | struct alc_spec *spec = codec->spec; |
| 2524 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2525 | } |
| 2526 | |
| 2527 | /* |
| 2528 | * Analog capture |
| 2529 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2530 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2531 | struct hda_codec *codec, |
| 2532 | unsigned int stream_tag, |
| 2533 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2534 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2535 | { |
| 2536 | struct alc_spec *spec = codec->spec; |
| 2537 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2538 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2539 | stream_tag, 0, format); |
| 2540 | return 0; |
| 2541 | } |
| 2542 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2543 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2545 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2546 | { |
| 2547 | struct alc_spec *spec = codec->spec; |
| 2548 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2549 | snd_hda_codec_cleanup_stream(codec, |
| 2550 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2551 | return 0; |
| 2552 | } |
| 2553 | |
| 2554 | |
| 2555 | /* |
| 2556 | */ |
| 2557 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2558 | .substreams = 1, |
| 2559 | .channels_min = 2, |
| 2560 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2561 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2562 | .ops = { |
| 2563 | .open = alc880_playback_pcm_open, |
| 2564 | .prepare = alc880_playback_pcm_prepare, |
| 2565 | .cleanup = alc880_playback_pcm_cleanup |
| 2566 | }, |
| 2567 | }; |
| 2568 | |
| 2569 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2570 | .substreams = 1, |
| 2571 | .channels_min = 2, |
| 2572 | .channels_max = 2, |
| 2573 | /* NID is set in alc_build_pcms */ |
| 2574 | }; |
| 2575 | |
| 2576 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2577 | .substreams = 1, |
| 2578 | .channels_min = 2, |
| 2579 | .channels_max = 2, |
| 2580 | /* NID is set in alc_build_pcms */ |
| 2581 | }; |
| 2582 | |
| 2583 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2584 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2585 | .channels_min = 2, |
| 2586 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2587 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2588 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2589 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2590 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2591 | }, |
| 2592 | }; |
| 2593 | |
| 2594 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2595 | .substreams = 1, |
| 2596 | .channels_min = 2, |
| 2597 | .channels_max = 2, |
| 2598 | /* NID is set in alc_build_pcms */ |
| 2599 | .ops = { |
| 2600 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2601 | .close = alc880_dig_playback_pcm_close, |
| 2602 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2603 | }, |
| 2604 | }; |
| 2605 | |
| 2606 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2607 | .substreams = 1, |
| 2608 | .channels_min = 2, |
| 2609 | .channels_max = 2, |
| 2610 | /* NID is set in alc_build_pcms */ |
| 2611 | }; |
| 2612 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2613 | /* 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] | 2614 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2615 | .substreams = 0, |
| 2616 | .channels_min = 0, |
| 2617 | .channels_max = 0, |
| 2618 | }; |
| 2619 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2620 | static int alc_build_pcms(struct hda_codec *codec) |
| 2621 | { |
| 2622 | struct alc_spec *spec = codec->spec; |
| 2623 | struct hda_pcm *info = spec->pcm_rec; |
| 2624 | int i; |
| 2625 | |
| 2626 | codec->num_pcms = 1; |
| 2627 | codec->pcm_info = info; |
| 2628 | |
| 2629 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2630 | if (spec->stream_analog_playback) { |
| 2631 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2632 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2633 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2634 | } |
| 2635 | if (spec->stream_analog_capture) { |
| 2636 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2637 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2638 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2639 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2640 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2641 | if (spec->channel_mode) { |
| 2642 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2643 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2644 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2645 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2646 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2647 | } |
| 2648 | } |
| 2649 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2650 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2651 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2652 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2653 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2654 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2655 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2656 | if (spec->multiout.dig_out_nid && |
| 2657 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2658 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2659 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2660 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2661 | if (spec->dig_in_nid && |
| 2662 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2663 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2664 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2665 | } |
| 2666 | } |
| 2667 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2668 | /* If the use of more than one ADC is requested for the current |
| 2669 | * model, configure a second analog capture-only PCM. |
| 2670 | */ |
| 2671 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2672 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2673 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2674 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2675 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2676 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2677 | if (spec->alt_dac_nid) { |
| 2678 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2679 | *spec->stream_analog_alt_playback; |
| 2680 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2681 | spec->alt_dac_nid; |
| 2682 | } else { |
| 2683 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2684 | alc_pcm_null_stream; |
| 2685 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2686 | } |
| 2687 | if (spec->num_adc_nids > 1) { |
| 2688 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2689 | *spec->stream_analog_alt_capture; |
| 2690 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2691 | spec->adc_nids[1]; |
| 2692 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2693 | spec->num_adc_nids - 1; |
| 2694 | } else { |
| 2695 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2696 | alc_pcm_null_stream; |
| 2697 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2698 | } |
| 2699 | } |
| 2700 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2701 | return 0; |
| 2702 | } |
| 2703 | |
| 2704 | static void alc_free(struct hda_codec *codec) |
| 2705 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2706 | struct alc_spec *spec = codec->spec; |
| 2707 | unsigned int i; |
| 2708 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2709 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2710 | return; |
| 2711 | |
| 2712 | if (spec->kctl_alloc) { |
| 2713 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2714 | kfree(spec->kctl_alloc[i].name); |
| 2715 | kfree(spec->kctl_alloc); |
| 2716 | } |
| 2717 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2718 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2719 | } |
| 2720 | |
| 2721 | /* |
| 2722 | */ |
| 2723 | static struct hda_codec_ops alc_patch_ops = { |
| 2724 | .build_controls = alc_build_controls, |
| 2725 | .build_pcms = alc_build_pcms, |
| 2726 | .init = alc_init, |
| 2727 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2728 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2729 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2730 | .check_power_status = alc_check_power_status, |
| 2731 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2732 | }; |
| 2733 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2734 | |
| 2735 | /* |
| 2736 | * Test configuration for debugging |
| 2737 | * |
| 2738 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2739 | * enum controls. |
| 2740 | */ |
| 2741 | #ifdef CONFIG_SND_DEBUG |
| 2742 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2743 | 0x02, 0x03, 0x04, 0x05 |
| 2744 | }; |
| 2745 | |
| 2746 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2747 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2748 | .items = { |
| 2749 | { "In-1", 0x0 }, |
| 2750 | { "In-2", 0x1 }, |
| 2751 | { "In-3", 0x2 }, |
| 2752 | { "In-4", 0x3 }, |
| 2753 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2754 | { "Front", 0x5 }, |
| 2755 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2756 | }, |
| 2757 | }; |
| 2758 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2759 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2760 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2761 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2762 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2763 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2764 | }; |
| 2765 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2766 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2767 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2768 | { |
| 2769 | static char *texts[] = { |
| 2770 | "N/A", "Line Out", "HP Out", |
| 2771 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2772 | }; |
| 2773 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2774 | uinfo->count = 1; |
| 2775 | uinfo->value.enumerated.items = 8; |
| 2776 | if (uinfo->value.enumerated.item >= 8) |
| 2777 | uinfo->value.enumerated.item = 7; |
| 2778 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2779 | return 0; |
| 2780 | } |
| 2781 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2782 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2783 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2784 | { |
| 2785 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2786 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2787 | unsigned int pin_ctl, item = 0; |
| 2788 | |
| 2789 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2790 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2791 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2792 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2793 | item = 2; |
| 2794 | else |
| 2795 | item = 1; |
| 2796 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2797 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2798 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2799 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2800 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2801 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2802 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2803 | } |
| 2804 | } |
| 2805 | ucontrol->value.enumerated.item[0] = item; |
| 2806 | return 0; |
| 2807 | } |
| 2808 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2809 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2810 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2811 | { |
| 2812 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2813 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2814 | static unsigned int ctls[] = { |
| 2815 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2816 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2817 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2818 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2819 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2820 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2821 | }; |
| 2822 | unsigned int old_ctl, new_ctl; |
| 2823 | |
| 2824 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2825 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2826 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2827 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2828 | int val; |
| 2829 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2830 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2831 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2832 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2833 | HDA_AMP_MUTE : 0; |
| 2834 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2835 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2836 | return 1; |
| 2837 | } |
| 2838 | return 0; |
| 2839 | } |
| 2840 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2841 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2842 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2843 | { |
| 2844 | static char *texts[] = { |
| 2845 | "Front", "Surround", "CLFE", "Side" |
| 2846 | }; |
| 2847 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2848 | uinfo->count = 1; |
| 2849 | uinfo->value.enumerated.items = 4; |
| 2850 | if (uinfo->value.enumerated.item >= 4) |
| 2851 | uinfo->value.enumerated.item = 3; |
| 2852 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2853 | return 0; |
| 2854 | } |
| 2855 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2856 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2857 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2858 | { |
| 2859 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2860 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2861 | unsigned int sel; |
| 2862 | |
| 2863 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2864 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2865 | return 0; |
| 2866 | } |
| 2867 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2868 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2869 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2870 | { |
| 2871 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2872 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2873 | unsigned int sel; |
| 2874 | |
| 2875 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2876 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2877 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2878 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2879 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2880 | return 1; |
| 2881 | } |
| 2882 | return 0; |
| 2883 | } |
| 2884 | |
| 2885 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2887 | .name = xname, \ |
| 2888 | .info = alc_test_pin_ctl_info, \ |
| 2889 | .get = alc_test_pin_ctl_get, \ |
| 2890 | .put = alc_test_pin_ctl_put, \ |
| 2891 | .private_value = nid \ |
| 2892 | } |
| 2893 | |
| 2894 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2895 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2896 | .name = xname, \ |
| 2897 | .info = alc_test_pin_src_info, \ |
| 2898 | .get = alc_test_pin_src_get, \ |
| 2899 | .put = alc_test_pin_src_put, \ |
| 2900 | .private_value = nid \ |
| 2901 | } |
| 2902 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2903 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2904 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2905 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2906 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2907 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2908 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2909 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2910 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2911 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2912 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2913 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2914 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2915 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2916 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2917 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2918 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2919 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2920 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2921 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2922 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2923 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2924 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2925 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2926 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2927 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2928 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2929 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2930 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2931 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2932 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2933 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2934 | { |
| 2935 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2936 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2937 | .info = alc_ch_mode_info, |
| 2938 | .get = alc_ch_mode_get, |
| 2939 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2940 | }, |
| 2941 | { } /* end */ |
| 2942 | }; |
| 2943 | |
| 2944 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2945 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2946 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2947 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2948 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2949 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2950 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2951 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2952 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2953 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2954 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2955 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2956 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2957 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2958 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2959 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2960 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2961 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2962 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2963 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2964 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2965 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2966 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2967 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2968 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2969 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2970 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2971 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2972 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2973 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2974 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2975 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2976 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2977 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2978 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2979 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2980 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2981 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2982 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2983 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2984 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2985 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2986 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2987 | /* Analog input/passthru */ |
| 2988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2989 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2990 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2992 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2993 | { } |
| 2994 | }; |
| 2995 | #endif |
| 2996 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2997 | /* |
| 2998 | */ |
| 2999 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3000 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 3001 | [ALC880_3ST] = "3stack", |
| 3002 | [ALC880_TCL_S700] = "tcl", |
| 3003 | [ALC880_3ST_DIG] = "3stack-digout", |
| 3004 | [ALC880_CLEVO] = "clevo", |
| 3005 | [ALC880_5ST] = "5stack", |
| 3006 | [ALC880_5ST_DIG] = "5stack-digout", |
| 3007 | [ALC880_W810] = "w810", |
| 3008 | [ALC880_Z71V] = "z71v", |
| 3009 | [ALC880_6ST] = "6stack", |
| 3010 | [ALC880_6ST_DIG] = "6stack-digout", |
| 3011 | [ALC880_ASUS] = "asus", |
| 3012 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 3013 | [ALC880_ASUS_DIG] = "asus-dig", |
| 3014 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 3015 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3016 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 3017 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3018 | [ALC880_F1734] = "F1734", |
| 3019 | [ALC880_LG] = "lg", |
| 3020 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3021 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3022 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3023 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 3024 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3025 | [ALC880_AUTO] = "auto", |
| 3026 | }; |
| 3027 | |
| 3028 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3029 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3030 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 3031 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 3032 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 3033 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 3034 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 3035 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 3036 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 3037 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3038 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 3039 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3040 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 3041 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 3042 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 3043 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 3044 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 3045 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 3046 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 3047 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 3048 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 3049 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 3050 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3051 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 3052 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 3053 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3054 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3055 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3056 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 3057 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3058 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 3059 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3060 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 3061 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 3062 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 3063 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3064 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3065 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3066 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3067 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3068 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3069 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3070 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3071 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3072 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3073 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3074 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3075 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3076 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Travis Place | 1d11604 | 2008-06-23 11:42:30 +0200 | [diff] [blame] | 3077 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3078 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3079 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3080 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3081 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3082 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3083 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3084 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3085 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3086 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3087 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3088 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3089 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3090 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3091 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3092 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3093 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3094 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3095 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3096 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3097 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3098 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3099 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3100 | {} |
| 3101 | }; |
| 3102 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3103 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3104 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3105 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3106 | static struct alc_config_preset alc880_presets[] = { |
| 3107 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3108 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3109 | .init_verbs = { alc880_volume_init_verbs, |
| 3110 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3111 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3112 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3113 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3114 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3115 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3116 | .input_mux = &alc880_capture_source, |
| 3117 | }, |
| 3118 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3119 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3120 | .init_verbs = { alc880_volume_init_verbs, |
| 3121 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3122 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3123 | .dac_nids = alc880_dac_nids, |
| 3124 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3125 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3126 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3127 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | .input_mux = &alc880_capture_source, |
| 3129 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3130 | [ALC880_TCL_S700] = { |
| 3131 | .mixers = { alc880_tcl_s700_mixer }, |
| 3132 | .init_verbs = { alc880_volume_init_verbs, |
| 3133 | alc880_pin_tcl_S700_init_verbs, |
| 3134 | alc880_gpio2_init_verbs }, |
| 3135 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3136 | .dac_nids = alc880_dac_nids, |
| 3137 | .hp_nid = 0x03, |
| 3138 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3139 | .channel_mode = alc880_2_jack_modes, |
| 3140 | .input_mux = &alc880_capture_source, |
| 3141 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3142 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3143 | .mixers = { alc880_three_stack_mixer, |
| 3144 | alc880_five_stack_mixer}, |
| 3145 | .init_verbs = { alc880_volume_init_verbs, |
| 3146 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3147 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3148 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3149 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3150 | .channel_mode = alc880_fivestack_modes, |
| 3151 | .input_mux = &alc880_capture_source, |
| 3152 | }, |
| 3153 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3154 | .mixers = { alc880_three_stack_mixer, |
| 3155 | alc880_five_stack_mixer }, |
| 3156 | .init_verbs = { alc880_volume_init_verbs, |
| 3157 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3158 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3159 | .dac_nids = alc880_dac_nids, |
| 3160 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3161 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3162 | .channel_mode = alc880_fivestack_modes, |
| 3163 | .input_mux = &alc880_capture_source, |
| 3164 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3165 | [ALC880_6ST] = { |
| 3166 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3167 | .init_verbs = { alc880_volume_init_verbs, |
| 3168 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3169 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3170 | .dac_nids = alc880_6st_dac_nids, |
| 3171 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3172 | .channel_mode = alc880_sixstack_modes, |
| 3173 | .input_mux = &alc880_6stack_capture_source, |
| 3174 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3175 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3176 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3177 | .init_verbs = { alc880_volume_init_verbs, |
| 3178 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3179 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3180 | .dac_nids = alc880_6st_dac_nids, |
| 3181 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3182 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3183 | .channel_mode = alc880_sixstack_modes, |
| 3184 | .input_mux = &alc880_6stack_capture_source, |
| 3185 | }, |
| 3186 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3187 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3188 | .init_verbs = { alc880_volume_init_verbs, |
| 3189 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3190 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3191 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3192 | .dac_nids = alc880_w810_dac_nids, |
| 3193 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3194 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3195 | .channel_mode = alc880_w810_modes, |
| 3196 | .input_mux = &alc880_capture_source, |
| 3197 | }, |
| 3198 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3200 | .init_verbs = { alc880_volume_init_verbs, |
| 3201 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3202 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3203 | .dac_nids = alc880_z71v_dac_nids, |
| 3204 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3205 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3206 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3207 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3208 | .input_mux = &alc880_capture_source, |
| 3209 | }, |
| 3210 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3211 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3212 | .init_verbs = { alc880_volume_init_verbs, |
| 3213 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3214 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3215 | .dac_nids = alc880_f1734_dac_nids, |
| 3216 | .hp_nid = 0x02, |
| 3217 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3218 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3219 | .input_mux = &alc880_f1734_capture_source, |
| 3220 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3221 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3222 | }, |
| 3223 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3224 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3225 | .init_verbs = { alc880_volume_init_verbs, |
| 3226 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3227 | alc880_gpio1_init_verbs }, |
| 3228 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3229 | .dac_nids = alc880_asus_dac_nids, |
| 3230 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3231 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3232 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3233 | .input_mux = &alc880_capture_source, |
| 3234 | }, |
| 3235 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3237 | .init_verbs = { alc880_volume_init_verbs, |
| 3238 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3239 | alc880_gpio1_init_verbs }, |
| 3240 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3241 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3242 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3244 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3245 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3246 | .input_mux = &alc880_capture_source, |
| 3247 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3248 | [ALC880_ASUS_DIG2] = { |
| 3249 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3250 | .init_verbs = { alc880_volume_init_verbs, |
| 3251 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3252 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3253 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3254 | .dac_nids = alc880_asus_dac_nids, |
| 3255 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3256 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3257 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3258 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3259 | .input_mux = &alc880_capture_source, |
| 3260 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3261 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3262 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3263 | .init_verbs = { alc880_volume_init_verbs, |
| 3264 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3265 | alc880_gpio1_init_verbs }, |
| 3266 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3267 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3268 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3269 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3270 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3271 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3272 | .input_mux = &alc880_capture_source, |
| 3273 | }, |
| 3274 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3275 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3276 | .init_verbs = { alc880_volume_init_verbs, |
| 3277 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3278 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3279 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3280 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3281 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3282 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3283 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3284 | .input_mux = &alc880_capture_source, |
| 3285 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3286 | [ALC880_UNIWILL] = { |
| 3287 | .mixers = { alc880_uniwill_mixer }, |
| 3288 | .init_verbs = { alc880_volume_init_verbs, |
| 3289 | alc880_uniwill_init_verbs }, |
| 3290 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3291 | .dac_nids = alc880_asus_dac_nids, |
| 3292 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3293 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3294 | .channel_mode = alc880_threestack_modes, |
| 3295 | .need_dac_fix = 1, |
| 3296 | .input_mux = &alc880_capture_source, |
| 3297 | .unsol_event = alc880_uniwill_unsol_event, |
| 3298 | .init_hook = alc880_uniwill_automute, |
| 3299 | }, |
| 3300 | [ALC880_UNIWILL_P53] = { |
| 3301 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3302 | .init_verbs = { alc880_volume_init_verbs, |
| 3303 | alc880_uniwill_p53_init_verbs }, |
| 3304 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3305 | .dac_nids = alc880_asus_dac_nids, |
| 3306 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3307 | .channel_mode = alc880_threestack_modes, |
| 3308 | .input_mux = &alc880_capture_source, |
| 3309 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3310 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3311 | }, |
| 3312 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3313 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3314 | alc880_pcbeep_mixer, }, |
| 3315 | .init_verbs = { alc880_volume_init_verbs, |
| 3316 | alc880_uniwill_p53_init_verbs, |
| 3317 | alc880_beep_init_verbs }, |
| 3318 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3319 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3320 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3321 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3322 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3323 | .input_mux = &alc880_capture_source, |
| 3324 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3325 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3326 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3327 | [ALC880_CLEVO] = { |
| 3328 | .mixers = { alc880_three_stack_mixer }, |
| 3329 | .init_verbs = { alc880_volume_init_verbs, |
| 3330 | alc880_pin_clevo_init_verbs }, |
| 3331 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3332 | .dac_nids = alc880_dac_nids, |
| 3333 | .hp_nid = 0x03, |
| 3334 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3335 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3336 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3337 | .input_mux = &alc880_capture_source, |
| 3338 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3339 | [ALC880_LG] = { |
| 3340 | .mixers = { alc880_lg_mixer }, |
| 3341 | .init_verbs = { alc880_volume_init_verbs, |
| 3342 | alc880_lg_init_verbs }, |
| 3343 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3344 | .dac_nids = alc880_lg_dac_nids, |
| 3345 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3346 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3347 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3348 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3349 | .input_mux = &alc880_lg_capture_source, |
| 3350 | .unsol_event = alc880_lg_unsol_event, |
| 3351 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3352 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3353 | .loopbacks = alc880_lg_loopbacks, |
| 3354 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3355 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3356 | [ALC880_LG_LW] = { |
| 3357 | .mixers = { alc880_lg_lw_mixer }, |
| 3358 | .init_verbs = { alc880_volume_init_verbs, |
| 3359 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3360 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3361 | .dac_nids = alc880_dac_nids, |
| 3362 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3363 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3364 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3365 | .input_mux = &alc880_lg_lw_capture_source, |
| 3366 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3367 | .init_hook = alc880_lg_lw_automute, |
| 3368 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3369 | [ALC880_MEDION_RIM] = { |
| 3370 | .mixers = { alc880_medion_rim_mixer }, |
| 3371 | .init_verbs = { alc880_volume_init_verbs, |
| 3372 | alc880_medion_rim_init_verbs, |
| 3373 | alc_gpio2_init_verbs }, |
| 3374 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3375 | .dac_nids = alc880_dac_nids, |
| 3376 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3377 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3378 | .channel_mode = alc880_2_jack_modes, |
| 3379 | .input_mux = &alc880_medion_rim_capture_source, |
| 3380 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3381 | .init_hook = alc880_medion_rim_automute, |
| 3382 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3383 | #ifdef CONFIG_SND_DEBUG |
| 3384 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3385 | .mixers = { alc880_test_mixer }, |
| 3386 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3387 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3388 | .dac_nids = alc880_test_dac_nids, |
| 3389 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3390 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3391 | .channel_mode = alc880_test_modes, |
| 3392 | .input_mux = &alc880_test_capture_source, |
| 3393 | }, |
| 3394 | #endif |
| 3395 | }; |
| 3396 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3397 | /* |
| 3398 | * Automatic parse of I/O pins from the BIOS configuration |
| 3399 | */ |
| 3400 | |
| 3401 | #define NUM_CONTROL_ALLOC 32 |
| 3402 | #define NUM_VERB_ALLOC 32 |
| 3403 | |
| 3404 | enum { |
| 3405 | ALC_CTL_WIDGET_VOL, |
| 3406 | ALC_CTL_WIDGET_MUTE, |
| 3407 | ALC_CTL_BIND_MUTE, |
| 3408 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3409 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3411 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3412 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3413 | }; |
| 3414 | |
| 3415 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3416 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3417 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3418 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3419 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3420 | |
| 3421 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3422 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3423 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | /* array + terminator */ |
| 3425 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3426 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | return -ENOMEM; |
| 3428 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3429 | memcpy(knew, spec->kctl_alloc, |
| 3430 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3431 | kfree(spec->kctl_alloc); |
| 3432 | } |
| 3433 | spec->kctl_alloc = knew; |
| 3434 | spec->num_kctl_alloc = num; |
| 3435 | } |
| 3436 | |
| 3437 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3438 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3439 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3440 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3441 | return -ENOMEM; |
| 3442 | knew->private_value = val; |
| 3443 | spec->num_kctl_used++; |
| 3444 | return 0; |
| 3445 | } |
| 3446 | |
| 3447 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3448 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3449 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3450 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3451 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3452 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3453 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3454 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3455 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3456 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3457 | #define ALC880_PIN_CD_NID 0x1c |
| 3458 | |
| 3459 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3460 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3461 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | { |
| 3463 | hda_nid_t nid; |
| 3464 | int assigned[4]; |
| 3465 | int i, j; |
| 3466 | |
| 3467 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3468 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3469 | |
| 3470 | /* check the pins hardwired to audio widget */ |
| 3471 | for (i = 0; i < cfg->line_outs; i++) { |
| 3472 | nid = cfg->line_out_pins[i]; |
| 3473 | if (alc880_is_fixed_pin(nid)) { |
| 3474 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3475 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3476 | assigned[idx] = 1; |
| 3477 | } |
| 3478 | } |
| 3479 | /* left pins can be connect to any audio widget */ |
| 3480 | for (i = 0; i < cfg->line_outs; i++) { |
| 3481 | nid = cfg->line_out_pins[i]; |
| 3482 | if (alc880_is_fixed_pin(nid)) |
| 3483 | continue; |
| 3484 | /* search for an empty channel */ |
| 3485 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3486 | if (!assigned[j]) { |
| 3487 | spec->multiout.dac_nids[i] = |
| 3488 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3489 | assigned[j] = 1; |
| 3490 | break; |
| 3491 | } |
| 3492 | } |
| 3493 | } |
| 3494 | spec->multiout.num_dacs = cfg->line_outs; |
| 3495 | return 0; |
| 3496 | } |
| 3497 | |
| 3498 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3499 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3500 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | { |
| 3502 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3503 | static const char *chname[4] = { |
| 3504 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3505 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3506 | hda_nid_t nid; |
| 3507 | int i, err; |
| 3508 | |
| 3509 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3510 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3511 | continue; |
| 3512 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3513 | if (i == 2) { |
| 3514 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3515 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3516 | "Center Playback Volume", |
| 3517 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3518 | HDA_OUTPUT)); |
| 3519 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3521 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3522 | "LFE Playback Volume", |
| 3523 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3524 | HDA_OUTPUT)); |
| 3525 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3526 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3527 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3528 | "Center Playback Switch", |
| 3529 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3530 | HDA_INPUT)); |
| 3531 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3532 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3533 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3534 | "LFE Playback Switch", |
| 3535 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3536 | HDA_INPUT)); |
| 3537 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3538 | return err; |
| 3539 | } else { |
| 3540 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3541 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3542 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3543 | HDA_OUTPUT)); |
| 3544 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | return err; |
| 3546 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3547 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3548 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3549 | HDA_INPUT)); |
| 3550 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3551 | return err; |
| 3552 | } |
| 3553 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3554 | return 0; |
| 3555 | } |
| 3556 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3557 | /* add playback controls for speaker and HP outputs */ |
| 3558 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3559 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3560 | { |
| 3561 | hda_nid_t nid; |
| 3562 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3563 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3564 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3565 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3566 | return 0; |
| 3567 | |
| 3568 | if (alc880_is_fixed_pin(pin)) { |
| 3569 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3570 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3571 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3572 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3573 | else |
| 3574 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3575 | /* control HP volume/switch on the output mixer amp */ |
| 3576 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3577 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3578 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3579 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3580 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3581 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3582 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3583 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3584 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3585 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3586 | return err; |
| 3587 | } else if (alc880_is_multi_pin(pin)) { |
| 3588 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3589 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3590 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3591 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3592 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3593 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3594 | return err; |
| 3595 | } |
| 3596 | return 0; |
| 3597 | } |
| 3598 | |
| 3599 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3600 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3601 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3602 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3603 | { |
| 3604 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3605 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3606 | |
| 3607 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3608 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3609 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3610 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3611 | return err; |
| 3612 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3613 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3614 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3615 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3616 | return err; |
| 3617 | return 0; |
| 3618 | } |
| 3619 | |
| 3620 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3621 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3622 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3623 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3624 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3625 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | |
| 3627 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3628 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3629 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3630 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3631 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3632 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3633 | if (err < 0) |
| 3634 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3635 | imux->items[imux->num_items].label = |
| 3636 | auto_pin_cfg_labels[i]; |
| 3637 | imux->items[imux->num_items].index = |
| 3638 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3639 | imux->num_items++; |
| 3640 | } |
| 3641 | } |
| 3642 | return 0; |
| 3643 | } |
| 3644 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3645 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3646 | unsigned int pin_type) |
| 3647 | { |
| 3648 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3649 | pin_type); |
| 3650 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3651 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3652 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3653 | } |
| 3654 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3655 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3656 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3657 | int dac_idx) |
| 3658 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3659 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3660 | /* need the manual connection? */ |
| 3661 | if (alc880_is_multi_pin(nid)) { |
| 3662 | struct alc_spec *spec = codec->spec; |
| 3663 | int idx = alc880_multi_pin_idx(nid); |
| 3664 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3665 | AC_VERB_SET_CONNECT_SEL, |
| 3666 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3667 | } |
| 3668 | } |
| 3669 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3670 | static int get_pin_type(int line_out_type) |
| 3671 | { |
| 3672 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3673 | return PIN_HP; |
| 3674 | else |
| 3675 | return PIN_OUT; |
| 3676 | } |
| 3677 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3678 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3679 | { |
| 3680 | struct alc_spec *spec = codec->spec; |
| 3681 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3682 | |
| 3683 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3684 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3685 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3686 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3687 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3688 | } |
| 3689 | } |
| 3690 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3691 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3692 | { |
| 3693 | struct alc_spec *spec = codec->spec; |
| 3694 | hda_nid_t pin; |
| 3695 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3696 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3697 | if (pin) /* connect to front */ |
| 3698 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3699 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3700 | if (pin) /* connect to front */ |
| 3701 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3702 | } |
| 3703 | |
| 3704 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3705 | { |
| 3706 | struct alc_spec *spec = codec->spec; |
| 3707 | int i; |
| 3708 | |
| 3709 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3710 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3711 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3712 | snd_hda_codec_write(codec, nid, 0, |
| 3713 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3714 | i <= AUTO_PIN_FRONT_MIC ? |
| 3715 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3716 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3717 | snd_hda_codec_write(codec, nid, 0, |
| 3718 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3719 | AMP_OUT_MUTE); |
| 3720 | } |
| 3721 | } |
| 3722 | } |
| 3723 | |
| 3724 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3725 | /* return 1 if successful, 0 if the proper config is not found, |
| 3726 | * or a negative error code |
| 3727 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3728 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3729 | { |
| 3730 | struct alc_spec *spec = codec->spec; |
| 3731 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3732 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3733 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3734 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3735 | alc880_ignore); |
| 3736 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3737 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3738 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3739 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3740 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3741 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3742 | if (err < 0) |
| 3743 | return err; |
| 3744 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3745 | if (err < 0) |
| 3746 | return err; |
| 3747 | err = alc880_auto_create_extra_out(spec, |
| 3748 | spec->autocfg.speaker_pins[0], |
| 3749 | "Speaker"); |
| 3750 | if (err < 0) |
| 3751 | return err; |
| 3752 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3753 | "Headphone"); |
| 3754 | if (err < 0) |
| 3755 | return err; |
| 3756 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3757 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | return err; |
| 3759 | |
| 3760 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3761 | |
| 3762 | if (spec->autocfg.dig_out_pin) |
| 3763 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3764 | if (spec->autocfg.dig_in_pin) |
| 3765 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3766 | |
| 3767 | if (spec->kctl_alloc) |
| 3768 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3769 | |
| 3770 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3771 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3772 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3773 | spec->input_mux = &spec->private_imux; |
| 3774 | |
| 3775 | return 1; |
| 3776 | } |
| 3777 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3778 | /* additional initialization for auto-configuration model */ |
| 3779 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3780 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3781 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3782 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3783 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3784 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3785 | if (spec->unsol_event) |
| 3786 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3787 | } |
| 3788 | |
| 3789 | /* |
| 3790 | * OK, here we have finally the patch for ALC880 |
| 3791 | */ |
| 3792 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3793 | static int patch_alc880(struct hda_codec *codec) |
| 3794 | { |
| 3795 | struct alc_spec *spec; |
| 3796 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3797 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3798 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3799 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3800 | if (spec == NULL) |
| 3801 | return -ENOMEM; |
| 3802 | |
| 3803 | codec->spec = spec; |
| 3804 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3805 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3806 | alc880_models, |
| 3807 | alc880_cfg_tbl); |
| 3808 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3809 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3810 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3811 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3812 | } |
| 3813 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3814 | if (board_config == ALC880_AUTO) { |
| 3815 | /* automatic parse from the BIOS config */ |
| 3816 | err = alc880_parse_auto_config(codec); |
| 3817 | if (err < 0) { |
| 3818 | alc_free(codec); |
| 3819 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3820 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3821 | printk(KERN_INFO |
| 3822 | "hda_codec: Cannot set up configuration " |
| 3823 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3824 | board_config = ALC880_3ST; |
| 3825 | } |
| 3826 | } |
| 3827 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3828 | if (board_config != ALC880_AUTO) |
| 3829 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3830 | |
| 3831 | spec->stream_name_analog = "ALC880 Analog"; |
| 3832 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3833 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3834 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3835 | |
| 3836 | spec->stream_name_digital = "ALC880 Digital"; |
| 3837 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3838 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3839 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3840 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3841 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3842 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3843 | /* get type */ |
| 3844 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3845 | if (wcap != AC_WID_AUD_IN) { |
| 3846 | spec->adc_nids = alc880_adc_nids_alt; |
| 3847 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3848 | spec->mixers[spec->num_mixers] = |
| 3849 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3850 | spec->num_mixers++; |
| 3851 | } else { |
| 3852 | spec->adc_nids = alc880_adc_nids; |
| 3853 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3854 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3855 | spec->num_mixers++; |
| 3856 | } |
| 3857 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3858 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3859 | spec->vmaster_nid = 0x0c; |
| 3860 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3861 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3862 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3863 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3864 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3865 | if (!spec->loopback.amplist) |
| 3866 | spec->loopback.amplist = alc880_loopbacks; |
| 3867 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3868 | |
| 3869 | return 0; |
| 3870 | } |
| 3871 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3872 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3873 | /* |
| 3874 | * ALC260 support |
| 3875 | */ |
| 3876 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3877 | static hda_nid_t alc260_dac_nids[1] = { |
| 3878 | /* front */ |
| 3879 | 0x02, |
| 3880 | }; |
| 3881 | |
| 3882 | static hda_nid_t alc260_adc_nids[1] = { |
| 3883 | /* ADC0 */ |
| 3884 | 0x04, |
| 3885 | }; |
| 3886 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3887 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3888 | /* ADC1 */ |
| 3889 | 0x05, |
| 3890 | }; |
| 3891 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3892 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3893 | /* ADC1, 0 */ |
| 3894 | 0x05, 0x04 |
| 3895 | }; |
| 3896 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3897 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3898 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3899 | */ |
| 3900 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3901 | /* ADC0, ADC1 */ |
| 3902 | 0x04, 0x05 |
| 3903 | }; |
| 3904 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3905 | #define ALC260_DIGOUT_NID 0x03 |
| 3906 | #define ALC260_DIGIN_NID 0x06 |
| 3907 | |
| 3908 | static struct hda_input_mux alc260_capture_source = { |
| 3909 | .num_items = 4, |
| 3910 | .items = { |
| 3911 | { "Mic", 0x0 }, |
| 3912 | { "Front Mic", 0x1 }, |
| 3913 | { "Line", 0x2 }, |
| 3914 | { "CD", 0x4 }, |
| 3915 | }, |
| 3916 | }; |
| 3917 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3918 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3919 | * headphone jack and the internal CD lines since these are the only pins at |
| 3920 | * which audio can appear. For flexibility, also allow the option of |
| 3921 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3922 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3923 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3924 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3925 | { |
| 3926 | .num_items = 3, |
| 3927 | .items = { |
| 3928 | { "Mic/Line", 0x0 }, |
| 3929 | { "CD", 0x4 }, |
| 3930 | { "Headphone", 0x2 }, |
| 3931 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3932 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3933 | { |
| 3934 | .num_items = 4, |
| 3935 | .items = { |
| 3936 | { "Mic/Line", 0x0 }, |
| 3937 | { "CD", 0x4 }, |
| 3938 | { "Headphone", 0x2 }, |
| 3939 | { "Mixer", 0x5 }, |
| 3940 | }, |
| 3941 | }, |
| 3942 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3943 | }; |
| 3944 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3945 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3946 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3947 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3948 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3949 | { |
| 3950 | .num_items = 4, |
| 3951 | .items = { |
| 3952 | { "Mic", 0x0 }, |
| 3953 | { "Line", 0x2 }, |
| 3954 | { "CD", 0x4 }, |
| 3955 | { "Headphone", 0x5 }, |
| 3956 | }, |
| 3957 | }, |
| 3958 | { |
| 3959 | .num_items = 5, |
| 3960 | .items = { |
| 3961 | { "Mic", 0x0 }, |
| 3962 | { "Line", 0x2 }, |
| 3963 | { "CD", 0x4 }, |
| 3964 | { "Headphone", 0x6 }, |
| 3965 | { "Mixer", 0x5 }, |
| 3966 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3967 | }, |
| 3968 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3969 | /* |
| 3970 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3971 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3972 | * element which allows changing the channel mode, so the verb list is |
| 3973 | * never used. |
| 3974 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3975 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3976 | { 2, NULL }, |
| 3977 | }; |
| 3978 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3979 | |
| 3980 | /* Mixer combinations |
| 3981 | * |
| 3982 | * basic: base_output + input + pc_beep + capture |
| 3983 | * HP: base_output + input + capture_alt |
| 3984 | * HP_3013: hp_3013 + input + capture |
| 3985 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3986 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3987 | */ |
| 3988 | |
| 3989 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3990 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3991 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3992 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3993 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3994 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3995 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3996 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3997 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3998 | |
| 3999 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4001 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4002 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4003 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4004 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4005 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4006 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4007 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4008 | { } /* end */ |
| 4009 | }; |
| 4010 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4011 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 4012 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4013 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4014 | { } /* end */ |
| 4015 | }; |
| 4016 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4017 | /* update HP, line and mono out pins according to the master switch */ |
| 4018 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 4019 | hda_nid_t hp, hda_nid_t line, |
| 4020 | hda_nid_t mono) |
| 4021 | { |
| 4022 | struct alc_spec *spec = codec->spec; |
| 4023 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 4024 | /* change HP and line-out pins */ |
| 4025 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4026 | val); |
| 4027 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4028 | val); |
| 4029 | /* mono (speaker) depending on the HP jack sense */ |
| 4030 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 4031 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4032 | val); |
| 4033 | } |
| 4034 | |
| 4035 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 4036 | struct snd_ctl_elem_value *ucontrol) |
| 4037 | { |
| 4038 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4039 | struct alc_spec *spec = codec->spec; |
| 4040 | *ucontrol->value.integer.value = spec->master_sw; |
| 4041 | return 0; |
| 4042 | } |
| 4043 | |
| 4044 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 4045 | struct snd_ctl_elem_value *ucontrol) |
| 4046 | { |
| 4047 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 4048 | struct alc_spec *spec = codec->spec; |
| 4049 | int val = !!*ucontrol->value.integer.value; |
| 4050 | hda_nid_t hp, line, mono; |
| 4051 | |
| 4052 | if (val == spec->master_sw) |
| 4053 | return 0; |
| 4054 | spec->master_sw = val; |
| 4055 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 4056 | line = (kcontrol->private_value >> 8) & 0xff; |
| 4057 | mono = kcontrol->private_value & 0xff; |
| 4058 | alc260_hp_master_update(codec, hp, line, mono); |
| 4059 | return 1; |
| 4060 | } |
| 4061 | |
| 4062 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 4063 | { |
| 4064 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4065 | .name = "Master Playback Switch", |
| 4066 | .info = snd_ctl_boolean_mono_info, |
| 4067 | .get = alc260_hp_master_sw_get, |
| 4068 | .put = alc260_hp_master_sw_put, |
| 4069 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4070 | }, |
| 4071 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4072 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4073 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4074 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4075 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4076 | HDA_OUTPUT), |
| 4077 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4078 | { } /* end */ |
| 4079 | }; |
| 4080 | |
| 4081 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4082 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4083 | {}, |
| 4084 | }; |
| 4085 | |
| 4086 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4087 | { |
| 4088 | struct alc_spec *spec = codec->spec; |
| 4089 | unsigned int present; |
| 4090 | |
| 4091 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4092 | AC_VERB_GET_PIN_SENSE, 0); |
| 4093 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4094 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4095 | } |
| 4096 | |
| 4097 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4098 | { |
| 4099 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4100 | alc260_hp_automute(codec); |
| 4101 | } |
| 4102 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4103 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4104 | { |
| 4105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4106 | .name = "Master Playback Switch", |
| 4107 | .info = snd_ctl_boolean_mono_info, |
| 4108 | .get = alc260_hp_master_sw_get, |
| 4109 | .put = alc260_hp_master_sw_put, |
| 4110 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4111 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4112 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4113 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4114 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4115 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4116 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4117 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4118 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4119 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4120 | { } /* end */ |
| 4121 | }; |
| 4122 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4123 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4124 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4125 | {}, |
| 4126 | }; |
| 4127 | |
| 4128 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4129 | { |
| 4130 | struct alc_spec *spec = codec->spec; |
| 4131 | unsigned int present; |
| 4132 | |
| 4133 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4134 | AC_VERB_GET_PIN_SENSE, 0); |
| 4135 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4136 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4137 | } |
| 4138 | |
| 4139 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4140 | unsigned int res) |
| 4141 | { |
| 4142 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4143 | alc260_hp_3013_automute(codec); |
| 4144 | } |
| 4145 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4146 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 4147 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4148 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4149 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4150 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4151 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4152 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4153 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4154 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4155 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4156 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4157 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4158 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4159 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4160 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4161 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4162 | { } /* end */ |
| 4163 | }; |
| 4164 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4165 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4166 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4167 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4168 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4169 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4170 | * revisions available in early 2006. Therefore for now allow the |
| 4171 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4172 | * that the lack of mic bias for this NID is intentional we could change the |
| 4173 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4174 | * |
| 4175 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4176 | * don't appear to make the mic bias available from the "line" jack, even |
| 4177 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4178 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4179 | * and the output jack. If this turns out to be the case for all such |
| 4180 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4181 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4182 | * |
| 4183 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4184 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4185 | * controls for such models. On models without a "mono speaker" the control |
| 4186 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4187 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4188 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4189 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4190 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4191 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4192 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4193 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4194 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4195 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4197 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4200 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4201 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4202 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4203 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4204 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4205 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4206 | { } /* end */ |
| 4207 | }; |
| 4208 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4209 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4210 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4211 | */ |
| 4212 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4213 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4214 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4215 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4216 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4217 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4218 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4219 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4220 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4221 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4222 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4223 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4224 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4225 | { } /* end */ |
| 4226 | }; |
| 4227 | |
| 4228 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4229 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4230 | */ |
| 4231 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4232 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4233 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4234 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4235 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4236 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4237 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4238 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4239 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4240 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4241 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4242 | { } /* end */ |
| 4243 | }; |
| 4244 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4245 | /* capture mixer elements */ |
| 4246 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4247 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4248 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4249 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4250 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4251 | { |
| 4252 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4253 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4254 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4255 | */ |
| 4256 | /* .name = "Capture Source", */ |
| 4257 | .name = "Input Source", |
| 4258 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4259 | .info = alc_mux_enum_info, |
| 4260 | .get = alc_mux_enum_get, |
| 4261 | .put = alc_mux_enum_put, |
| 4262 | }, |
| 4263 | { } /* end */ |
| 4264 | }; |
| 4265 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4266 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4267 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4268 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4269 | { |
| 4270 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4271 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4272 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4273 | */ |
| 4274 | /* .name = "Capture Source", */ |
| 4275 | .name = "Input Source", |
| 4276 | .count = 1, |
| 4277 | .info = alc_mux_enum_info, |
| 4278 | .get = alc_mux_enum_get, |
| 4279 | .put = alc_mux_enum_put, |
| 4280 | }, |
| 4281 | { } /* end */ |
| 4282 | }; |
| 4283 | |
| 4284 | /* |
| 4285 | * initialization verbs |
| 4286 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4287 | static struct hda_verb alc260_init_verbs[] = { |
| 4288 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4289 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4290 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4291 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4292 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4293 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4294 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4295 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4296 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4298 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4299 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4300 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4301 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4302 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4303 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4304 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4305 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4306 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4307 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4308 | /* set connection select to line in (default select for this ADC) */ |
| 4309 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4310 | /* mute capture amp left and right */ |
| 4311 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4312 | /* set connection select to line in (default select for this ADC) */ |
| 4313 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4314 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4315 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4316 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4317 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4318 | /* set vol=0 HP mixer amp left and right */ |
| 4319 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4320 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4321 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4322 | /* set vol=0 Mono mixer amp left and right */ |
| 4323 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4324 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4325 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4326 | /* unmute LINE-2 out pin */ |
| 4327 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4328 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4329 | * Line In 2 = 0x03 |
| 4330 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4331 | /* mute analog inputs */ |
| 4332 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4333 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4334 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4335 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4336 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4337 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4338 | /* mute Front out path */ |
| 4339 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4340 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4341 | /* mute Headphone out path */ |
| 4342 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4343 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4344 | /* mute Mono out path */ |
| 4345 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4346 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4347 | { } |
| 4348 | }; |
| 4349 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4350 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4351 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4352 | /* Headphone and output */ |
| 4353 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4354 | /* mono output */ |
| 4355 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4356 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4357 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4358 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4359 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4360 | /* Line In pin widget for input */ |
| 4361 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4362 | /* Line-2 pin widget for output */ |
| 4363 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4364 | /* CD pin widget for input */ |
| 4365 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4366 | /* unmute amp left and right */ |
| 4367 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4368 | /* set connection select to line in (default select for this ADC) */ |
| 4369 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4370 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4371 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4372 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4373 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4374 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4375 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4376 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4377 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4378 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4379 | * Line In 2 = 0x03 |
| 4380 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4381 | /* mute analog inputs */ |
| 4382 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4383 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4384 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4385 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4386 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4387 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4388 | /* Unmute Front out path */ |
| 4389 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4390 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4391 | /* Unmute Headphone out path */ |
| 4392 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4393 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4394 | /* Unmute Mono out path */ |
| 4395 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4396 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4397 | { } |
| 4398 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4399 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4400 | |
| 4401 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4402 | /* Line out and output */ |
| 4403 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4404 | /* mono output */ |
| 4405 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4406 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4407 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4408 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4409 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4410 | /* Line In pin widget for input */ |
| 4411 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4412 | /* Headphone pin widget for output */ |
| 4413 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4414 | /* CD pin widget for input */ |
| 4415 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4416 | /* unmute amp left and right */ |
| 4417 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4418 | /* set connection select to line in (default select for this ADC) */ |
| 4419 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4420 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4421 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4422 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4424 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4425 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4426 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4427 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4428 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4429 | * Line In 2 = 0x03 |
| 4430 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4431 | /* mute analog inputs */ |
| 4432 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4433 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4434 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4435 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4436 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4437 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4438 | /* Unmute Front out path */ |
| 4439 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4440 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4441 | /* Unmute Headphone out path */ |
| 4442 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4443 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4444 | /* Unmute Mono out path */ |
| 4445 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4446 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4447 | { } |
| 4448 | }; |
| 4449 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4450 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4451 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4452 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4453 | */ |
| 4454 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4455 | /* Disable all GPIOs */ |
| 4456 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4457 | /* Internal speaker is connected to headphone pin */ |
| 4458 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4459 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4460 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4461 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4462 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4463 | /* Ensure all other unused pins are disabled and muted. */ |
| 4464 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4465 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4466 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4467 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4468 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4469 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4470 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4471 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4472 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4473 | /* Disable digital (SPDIF) pins */ |
| 4474 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4475 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4476 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4477 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4478 | * when acting as an output. |
| 4479 | */ |
| 4480 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4481 | |
| 4482 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4483 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4484 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4485 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4486 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4487 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4489 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4490 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4491 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4492 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4493 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4494 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4495 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4496 | * If the pin mode is changed by the user the pin mode control will |
| 4497 | * take care of enabling the pin's input/output buffers as needed. |
| 4498 | * Therefore there's no need to enable the input buffer at this |
| 4499 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4500 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4501 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4502 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4503 | * mixer ctrl) |
| 4504 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4505 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4506 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4507 | /* Mute capture amp left and right */ |
| 4508 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4509 | /* Set ADC connection select to match default mixer setting - line |
| 4510 | * in (on mic1 pin) |
| 4511 | */ |
| 4512 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4513 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4514 | /* Do the same for the second ADC: mute capture input amp and |
| 4515 | * set ADC connection to line in (on mic1 pin) |
| 4516 | */ |
| 4517 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4518 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4519 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4520 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4521 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4522 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4523 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4524 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4525 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4526 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4527 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4528 | {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] | 4529 | |
| 4530 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4531 | }; |
| 4532 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4533 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4534 | * similar laptops (adapted from Fujitsu init verbs). |
| 4535 | */ |
| 4536 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4537 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4538 | * the headphone jack. Turn this on and rely on the standard mute |
| 4539 | * methods whenever the user wants to turn these outputs off. |
| 4540 | */ |
| 4541 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4542 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4543 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4544 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4545 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4546 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4547 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4548 | /* Line In jack is connected to Line1 pin */ |
| 4549 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4550 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4551 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4552 | /* Ensure all other unused pins are disabled and muted. */ |
| 4553 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4554 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4555 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4556 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4557 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4559 | /* Disable digital (SPDIF) pins */ |
| 4560 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4561 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4562 | |
| 4563 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4564 | * bus when acting as outputs. |
| 4565 | */ |
| 4566 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4567 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4568 | |
| 4569 | /* Start with output sum widgets muted and their output gains at min */ |
| 4570 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4571 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4572 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4573 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4574 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4575 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4576 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4577 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4578 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4579 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4580 | /* Unmute Line-out pin widget amp left and right |
| 4581 | * (no equiv mixer ctrl) |
| 4582 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4583 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4584 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4585 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4586 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4587 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4588 | * will take care of enabling the pin's input/output buffers as needed. |
| 4589 | * Therefore there's no need to enable the input buffer at this |
| 4590 | * stage. |
| 4591 | */ |
| 4592 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4593 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4594 | |
| 4595 | /* Mute capture amp left and right */ |
| 4596 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4597 | /* Set ADC connection select to match default mixer setting - mic |
| 4598 | * (on mic1 pin) |
| 4599 | */ |
| 4600 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4601 | |
| 4602 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4603 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4604 | */ |
| 4605 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4606 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4607 | |
| 4608 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4609 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4610 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4611 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4612 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4613 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4614 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4616 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4617 | |
| 4618 | { } |
| 4619 | }; |
| 4620 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4621 | static struct hda_verb alc260_will_verbs[] = { |
| 4622 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4623 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4624 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4625 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4626 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4627 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4628 | {} |
| 4629 | }; |
| 4630 | |
| 4631 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4632 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4633 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4634 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4635 | |
| 4636 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4637 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4638 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4639 | |
| 4640 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4641 | {} |
| 4642 | }; |
| 4643 | |
| 4644 | /* toggle speaker-output according to the hp-jack state */ |
| 4645 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4646 | { |
| 4647 | unsigned int present; |
| 4648 | |
| 4649 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4650 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4651 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4652 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4653 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4654 | AC_VERB_SET_GPIO_DATA, 1); |
| 4655 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4656 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4657 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4658 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4659 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4660 | AC_VERB_SET_GPIO_DATA, 0); |
| 4661 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4662 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4663 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4664 | } |
| 4665 | } |
| 4666 | |
| 4667 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4668 | unsigned int res) |
| 4669 | { |
| 4670 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4671 | alc260_replacer_672v_automute(codec); |
| 4672 | } |
| 4673 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4674 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4675 | * configuration. |
| 4676 | */ |
| 4677 | #ifdef CONFIG_SND_DEBUG |
| 4678 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4679 | 0x02, |
| 4680 | }; |
| 4681 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4682 | 0x04, 0x05, |
| 4683 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4684 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4685 | * the signal assignments are different. This assumes that the first ADC |
| 4686 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4687 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4688 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4689 | { |
| 4690 | .num_items = 7, |
| 4691 | .items = { |
| 4692 | { "MIC1 pin", 0x0 }, |
| 4693 | { "MIC2 pin", 0x1 }, |
| 4694 | { "LINE1 pin", 0x2 }, |
| 4695 | { "LINE2 pin", 0x3 }, |
| 4696 | { "CD pin", 0x4 }, |
| 4697 | { "LINE-OUT pin", 0x5 }, |
| 4698 | { "HP-OUT pin", 0x6 }, |
| 4699 | }, |
| 4700 | }, |
| 4701 | { |
| 4702 | .num_items = 8, |
| 4703 | .items = { |
| 4704 | { "MIC1 pin", 0x0 }, |
| 4705 | { "MIC2 pin", 0x1 }, |
| 4706 | { "LINE1 pin", 0x2 }, |
| 4707 | { "LINE2 pin", 0x3 }, |
| 4708 | { "CD pin", 0x4 }, |
| 4709 | { "Mixer", 0x5 }, |
| 4710 | { "LINE-OUT pin", 0x6 }, |
| 4711 | { "HP-OUT pin", 0x7 }, |
| 4712 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4713 | }, |
| 4714 | }; |
| 4715 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4716 | /* Output driver widgets */ |
| 4717 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4718 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4719 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4720 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4721 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4722 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4723 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4724 | /* Modes for retasking pin widgets |
| 4725 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4726 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4727 | * mention this restriction. At this stage it's not clear whether |
| 4728 | * this behaviour is intentional or is a hardware bug in chip |
| 4729 | * revisions available at least up until early 2006. Therefore for |
| 4730 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4731 | * choices, but if it turns out that the lack of mic bias for these |
| 4732 | * NIDs is intentional we could change their modes from |
| 4733 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4734 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4735 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4736 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4737 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4738 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4739 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4740 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4741 | |
| 4742 | /* Loopback mixer controls */ |
| 4743 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4744 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4745 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4746 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4747 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4748 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4749 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4750 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4751 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4752 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4753 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4754 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4755 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4756 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4757 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4758 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4759 | |
| 4760 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4761 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4762 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4763 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4764 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4765 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4766 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4767 | * is ambigious as to which NID is which; testing on laptops which |
| 4768 | * make this output available should provide clarification. |
| 4769 | */ |
| 4770 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4771 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4772 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4773 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4774 | * this output to turn on an external amplifier. |
| 4775 | */ |
| 4776 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4777 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4778 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4779 | { } /* end */ |
| 4780 | }; |
| 4781 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4782 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4783 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4784 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4785 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4786 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4787 | /* Enable retasking pins as output, initially without power amp */ |
| 4788 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4789 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4790 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4791 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4792 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4793 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4794 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4795 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4796 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4797 | * payload also sets the generation to 0, output to be in "consumer" |
| 4798 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4799 | * control. |
| 4800 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4801 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4802 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4803 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4804 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4805 | * OUT1 sum bus when acting as an output. |
| 4806 | */ |
| 4807 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4808 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4809 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4810 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4811 | |
| 4812 | /* Start with output sum widgets muted and their output gains at min */ |
| 4813 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4814 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4815 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4816 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4817 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4818 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4819 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4820 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4821 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4822 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4823 | /* Unmute retasking pin widget output buffers since the default |
| 4824 | * state appears to be output. As the pin mode is changed by the |
| 4825 | * user the pin mode control will take care of enabling the pin's |
| 4826 | * input/output buffers as needed. |
| 4827 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4828 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4829 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4830 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4831 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4832 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4833 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4834 | /* Also unmute the mono-out pin widget */ |
| 4835 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4836 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4837 | /* Mute capture amp left and right */ |
| 4838 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4839 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4840 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4841 | */ |
| 4842 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4843 | |
| 4844 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4845 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4846 | */ |
| 4847 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4848 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4849 | |
| 4850 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4851 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4852 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4853 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4854 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4855 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4856 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4858 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4859 | |
| 4860 | { } |
| 4861 | }; |
| 4862 | #endif |
| 4863 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4864 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4865 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4866 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4867 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4868 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4869 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4870 | /* |
| 4871 | * for BIOS auto-configuration |
| 4872 | */ |
| 4873 | |
| 4874 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4875 | const char *pfx) |
| 4876 | { |
| 4877 | hda_nid_t nid_vol; |
| 4878 | unsigned long vol_val, sw_val; |
| 4879 | char name[32]; |
| 4880 | int err; |
| 4881 | |
| 4882 | if (nid >= 0x0f && nid < 0x11) { |
| 4883 | nid_vol = nid - 0x7; |
| 4884 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4885 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4886 | } else if (nid == 0x11) { |
| 4887 | nid_vol = nid - 0x7; |
| 4888 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4889 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4890 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4891 | nid_vol = 0x08; |
| 4892 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4893 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4894 | } else |
| 4895 | return 0; /* N/A */ |
| 4896 | |
| 4897 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4898 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4899 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4900 | return err; |
| 4901 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4902 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4903 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4904 | return err; |
| 4905 | return 1; |
| 4906 | } |
| 4907 | |
| 4908 | /* add playback controls from the parsed DAC table */ |
| 4909 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4910 | const struct auto_pin_cfg *cfg) |
| 4911 | { |
| 4912 | hda_nid_t nid; |
| 4913 | int err; |
| 4914 | |
| 4915 | spec->multiout.num_dacs = 1; |
| 4916 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4917 | spec->multiout.dac_nids[0] = 0x02; |
| 4918 | |
| 4919 | nid = cfg->line_out_pins[0]; |
| 4920 | if (nid) { |
| 4921 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4922 | if (err < 0) |
| 4923 | return err; |
| 4924 | } |
| 4925 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4926 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4927 | if (nid) { |
| 4928 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4929 | if (err < 0) |
| 4930 | return err; |
| 4931 | } |
| 4932 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4933 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4934 | if (nid) { |
| 4935 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4936 | if (err < 0) |
| 4937 | return err; |
| 4938 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4939 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4940 | } |
| 4941 | |
| 4942 | /* create playback/capture controls for input pins */ |
| 4943 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4944 | const struct auto_pin_cfg *cfg) |
| 4945 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4946 | struct hda_input_mux *imux = &spec->private_imux; |
| 4947 | int i, err, idx; |
| 4948 | |
| 4949 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4950 | if (cfg->input_pins[i] >= 0x12) { |
| 4951 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4952 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4953 | auto_pin_cfg_labels[i], idx, |
| 4954 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4955 | if (err < 0) |
| 4956 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4957 | imux->items[imux->num_items].label = |
| 4958 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4959 | imux->items[imux->num_items].index = idx; |
| 4960 | imux->num_items++; |
| 4961 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4962 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4964 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4965 | auto_pin_cfg_labels[i], idx, |
| 4966 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4967 | if (err < 0) |
| 4968 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4969 | imux->items[imux->num_items].label = |
| 4970 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4971 | imux->items[imux->num_items].index = idx; |
| 4972 | imux->num_items++; |
| 4973 | } |
| 4974 | } |
| 4975 | return 0; |
| 4976 | } |
| 4977 | |
| 4978 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4979 | hda_nid_t nid, int pin_type, |
| 4980 | int sel_idx) |
| 4981 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4982 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4983 | /* need the manual connection? */ |
| 4984 | if (nid >= 0x12) { |
| 4985 | int idx = nid - 0x12; |
| 4986 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4987 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4988 | } |
| 4989 | } |
| 4990 | |
| 4991 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4992 | { |
| 4993 | struct alc_spec *spec = codec->spec; |
| 4994 | hda_nid_t nid; |
| 4995 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4996 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4997 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4998 | if (nid) { |
| 4999 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 5000 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 5001 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5002 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 5003 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5004 | if (nid) |
| 5005 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 5006 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 5007 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5008 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 5009 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5010 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5011 | |
| 5012 | #define ALC260_PIN_CD_NID 0x16 |
| 5013 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 5014 | { |
| 5015 | struct alc_spec *spec = codec->spec; |
| 5016 | int i; |
| 5017 | |
| 5018 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 5019 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 5020 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5021 | snd_hda_codec_write(codec, nid, 0, |
| 5022 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 5023 | i <= AUTO_PIN_FRONT_MIC ? |
| 5024 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5025 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5026 | snd_hda_codec_write(codec, nid, 0, |
| 5027 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5028 | AMP_OUT_MUTE); |
| 5029 | } |
| 5030 | } |
| 5031 | } |
| 5032 | |
| 5033 | /* |
| 5034 | * generic initialization of ADC, input mixers and output mixers |
| 5035 | */ |
| 5036 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 5037 | /* |
| 5038 | * Unmute ADC0-1 and set the default input to mic-in |
| 5039 | */ |
| 5040 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5041 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5042 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5043 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5044 | |
| 5045 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 5046 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5047 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5048 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5049 | */ |
| 5050 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5051 | /* mute analog inputs */ |
| 5052 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5053 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5054 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5055 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5056 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5057 | |
| 5058 | /* |
| 5059 | * Set up output mixers (0x08 - 0x0a) |
| 5060 | */ |
| 5061 | /* set vol=0 to output mixers */ |
| 5062 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5063 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5064 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5065 | /* set up input amps for analog loopback */ |
| 5066 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5067 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5069 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5070 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5071 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5072 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5073 | |
| 5074 | { } |
| 5075 | }; |
| 5076 | |
| 5077 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5078 | { |
| 5079 | struct alc_spec *spec = codec->spec; |
| 5080 | unsigned int wcap; |
| 5081 | int err; |
| 5082 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5083 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5084 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5085 | alc260_ignore); |
| 5086 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5087 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5088 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5089 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5090 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5091 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5092 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5093 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5094 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5095 | return err; |
| 5096 | |
| 5097 | spec->multiout.max_channels = 2; |
| 5098 | |
| 5099 | if (spec->autocfg.dig_out_pin) |
| 5100 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5101 | if (spec->kctl_alloc) |
| 5102 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5103 | |
| 5104 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5105 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5106 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5107 | spec->input_mux = &spec->private_imux; |
| 5108 | |
| 5109 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5110 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5111 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5112 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5113 | spec->adc_nids = alc260_adc_nids_alt; |
| 5114 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5115 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5116 | } else { |
| 5117 | spec->adc_nids = alc260_adc_nids; |
| 5118 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5119 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5120 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5121 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5122 | |
| 5123 | return 1; |
| 5124 | } |
| 5125 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5126 | /* additional initialization for auto-configuration model */ |
| 5127 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5128 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5129 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5130 | alc260_auto_init_multi_out(codec); |
| 5131 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5132 | if (spec->unsol_event) |
| 5133 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5134 | } |
| 5135 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5136 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5137 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5138 | { 0x07, HDA_INPUT, 0 }, |
| 5139 | { 0x07, HDA_INPUT, 1 }, |
| 5140 | { 0x07, HDA_INPUT, 2 }, |
| 5141 | { 0x07, HDA_INPUT, 3 }, |
| 5142 | { 0x07, HDA_INPUT, 4 }, |
| 5143 | { } /* end */ |
| 5144 | }; |
| 5145 | #endif |
| 5146 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5147 | /* |
| 5148 | * ALC260 configurations |
| 5149 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5150 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5151 | [ALC260_BASIC] = "basic", |
| 5152 | [ALC260_HP] = "hp", |
| 5153 | [ALC260_HP_3013] = "hp-3013", |
| 5154 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5155 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5156 | [ALC260_WILL] = "will", |
| 5157 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5158 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5159 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5160 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5161 | [ALC260_AUTO] = "auto", |
| 5162 | }; |
| 5163 | |
| 5164 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5165 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5166 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5167 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5168 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5169 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5170 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5171 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5172 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5173 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5174 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5175 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5176 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5177 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5178 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5179 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5180 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5181 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5182 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5183 | {} |
| 5184 | }; |
| 5185 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5186 | static struct alc_config_preset alc260_presets[] = { |
| 5187 | [ALC260_BASIC] = { |
| 5188 | .mixers = { alc260_base_output_mixer, |
| 5189 | alc260_input_mixer, |
| 5190 | alc260_pc_beep_mixer, |
| 5191 | alc260_capture_mixer }, |
| 5192 | .init_verbs = { alc260_init_verbs }, |
| 5193 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5194 | .dac_nids = alc260_dac_nids, |
| 5195 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5196 | .adc_nids = alc260_adc_nids, |
| 5197 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5198 | .channel_mode = alc260_modes, |
| 5199 | .input_mux = &alc260_capture_source, |
| 5200 | }, |
| 5201 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5202 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5203 | alc260_input_mixer, |
| 5204 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5205 | .init_verbs = { alc260_init_verbs, |
| 5206 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5207 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5208 | .dac_nids = alc260_dac_nids, |
| 5209 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5210 | .adc_nids = alc260_hp_adc_nids, |
| 5211 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5212 | .channel_mode = alc260_modes, |
| 5213 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5214 | .unsol_event = alc260_hp_unsol_event, |
| 5215 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5216 | }, |
| 5217 | [ALC260_HP_3013] = { |
| 5218 | .mixers = { alc260_hp_3013_mixer, |
| 5219 | alc260_input_mixer, |
| 5220 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5221 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5222 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5223 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5224 | .dac_nids = alc260_dac_nids, |
| 5225 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5226 | .adc_nids = alc260_hp_adc_nids, |
| 5227 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5228 | .channel_mode = alc260_modes, |
| 5229 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5230 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5231 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5232 | }, |
| 5233 | [ALC260_FUJITSU_S702X] = { |
| 5234 | .mixers = { alc260_fujitsu_mixer, |
| 5235 | alc260_capture_mixer }, |
| 5236 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5237 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5238 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5239 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5240 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5241 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5242 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5243 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5244 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5245 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5246 | [ALC260_ACER] = { |
| 5247 | .mixers = { alc260_acer_mixer, |
| 5248 | alc260_capture_mixer }, |
| 5249 | .init_verbs = { alc260_acer_init_verbs }, |
| 5250 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5251 | .dac_nids = alc260_dac_nids, |
| 5252 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5253 | .adc_nids = alc260_dual_adc_nids, |
| 5254 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5255 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5256 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5257 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5258 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5259 | [ALC260_WILL] = { |
| 5260 | .mixers = { alc260_will_mixer, |
| 5261 | alc260_capture_mixer }, |
| 5262 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5263 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5264 | .dac_nids = alc260_dac_nids, |
| 5265 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5266 | .adc_nids = alc260_adc_nids, |
| 5267 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5268 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5269 | .channel_mode = alc260_modes, |
| 5270 | .input_mux = &alc260_capture_source, |
| 5271 | }, |
| 5272 | [ALC260_REPLACER_672V] = { |
| 5273 | .mixers = { alc260_replacer_672v_mixer, |
| 5274 | alc260_capture_mixer }, |
| 5275 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5276 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5277 | .dac_nids = alc260_dac_nids, |
| 5278 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5279 | .adc_nids = alc260_adc_nids, |
| 5280 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5281 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5282 | .channel_mode = alc260_modes, |
| 5283 | .input_mux = &alc260_capture_source, |
| 5284 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5285 | .init_hook = alc260_replacer_672v_automute, |
| 5286 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5287 | #ifdef CONFIG_SND_DEBUG |
| 5288 | [ALC260_TEST] = { |
| 5289 | .mixers = { alc260_test_mixer, |
| 5290 | alc260_capture_mixer }, |
| 5291 | .init_verbs = { alc260_test_init_verbs }, |
| 5292 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5293 | .dac_nids = alc260_test_dac_nids, |
| 5294 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5295 | .adc_nids = alc260_test_adc_nids, |
| 5296 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5297 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5298 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5299 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5300 | }, |
| 5301 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5302 | }; |
| 5303 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5304 | static int patch_alc260(struct hda_codec *codec) |
| 5305 | { |
| 5306 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5307 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5308 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5309 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5310 | if (spec == NULL) |
| 5311 | return -ENOMEM; |
| 5312 | |
| 5313 | codec->spec = spec; |
| 5314 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5315 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5316 | alc260_models, |
| 5317 | alc260_cfg_tbl); |
| 5318 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5319 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5320 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5321 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5322 | } |
| 5323 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5324 | if (board_config == ALC260_AUTO) { |
| 5325 | /* automatic parse from the BIOS config */ |
| 5326 | err = alc260_parse_auto_config(codec); |
| 5327 | if (err < 0) { |
| 5328 | alc_free(codec); |
| 5329 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5330 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5331 | printk(KERN_INFO |
| 5332 | "hda_codec: Cannot set up configuration " |
| 5333 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5334 | board_config = ALC260_BASIC; |
| 5335 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5336 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5337 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5338 | if (board_config != ALC260_AUTO) |
| 5339 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5340 | |
| 5341 | spec->stream_name_analog = "ALC260 Analog"; |
| 5342 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5343 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5344 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5345 | spec->stream_name_digital = "ALC260 Digital"; |
| 5346 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5347 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5348 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5349 | spec->vmaster_nid = 0x08; |
| 5350 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5351 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5352 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5353 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5354 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5355 | if (!spec->loopback.amplist) |
| 5356 | spec->loopback.amplist = alc260_loopbacks; |
| 5357 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5358 | |
| 5359 | return 0; |
| 5360 | } |
| 5361 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5363 | /* |
| 5364 | * ALC882 support |
| 5365 | * |
| 5366 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5367 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5368 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5369 | * 6-channel independent captures. |
| 5370 | * |
| 5371 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5372 | * driver yet). |
| 5373 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5374 | #define ALC882_DIGOUT_NID 0x06 |
| 5375 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5376 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5377 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5378 | { 8, NULL } |
| 5379 | }; |
| 5380 | |
| 5381 | static hda_nid_t alc882_dac_nids[4] = { |
| 5382 | /* front, rear, clfe, rear_surr */ |
| 5383 | 0x02, 0x03, 0x04, 0x05 |
| 5384 | }; |
| 5385 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5386 | /* identical with ALC880 */ |
| 5387 | #define alc882_adc_nids alc880_adc_nids |
| 5388 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5389 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5390 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5391 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5392 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5393 | /* input MUX */ |
| 5394 | /* FIXME: should be a matrix-type input source selection */ |
| 5395 | |
| 5396 | static struct hda_input_mux alc882_capture_source = { |
| 5397 | .num_items = 4, |
| 5398 | .items = { |
| 5399 | { "Mic", 0x0 }, |
| 5400 | { "Front Mic", 0x1 }, |
| 5401 | { "Line", 0x2 }, |
| 5402 | { "CD", 0x4 }, |
| 5403 | }, |
| 5404 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5405 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5406 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5407 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5408 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5409 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5410 | { |
| 5411 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5412 | struct alc_spec *spec = codec->spec; |
| 5413 | const struct hda_input_mux *imux = spec->input_mux; |
| 5414 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5415 | hda_nid_t nid = spec->capsrc_nids ? |
| 5416 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5417 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5418 | unsigned int i, idx; |
| 5419 | |
| 5420 | idx = ucontrol->value.enumerated.item[0]; |
| 5421 | if (idx >= imux->num_items) |
| 5422 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5423 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5424 | return 0; |
| 5425 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5426 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5427 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5428 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5429 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5430 | } |
| 5431 | *cur_val = idx; |
| 5432 | return 1; |
| 5433 | } |
| 5434 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5435 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5436 | * 2ch mode |
| 5437 | */ |
| 5438 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5439 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5440 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5441 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5442 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5443 | { } /* end */ |
| 5444 | }; |
| 5445 | |
| 5446 | /* |
| 5447 | * 6ch mode |
| 5448 | */ |
| 5449 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5450 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5451 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5452 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5453 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5454 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5455 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5456 | { } /* end */ |
| 5457 | }; |
| 5458 | |
| 5459 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5460 | { 2, alc882_3ST_ch2_init }, |
| 5461 | { 6, alc882_3ST_ch6_init }, |
| 5462 | }; |
| 5463 | |
| 5464 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5465 | * 6ch mode |
| 5466 | */ |
| 5467 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5468 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5469 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5470 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5471 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5472 | { } /* end */ |
| 5473 | }; |
| 5474 | |
| 5475 | /* |
| 5476 | * 8ch mode |
| 5477 | */ |
| 5478 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5479 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5480 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5481 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5482 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5483 | { } /* end */ |
| 5484 | }; |
| 5485 | |
| 5486 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5487 | { 6, alc882_sixstack_ch6_init }, |
| 5488 | { 8, alc882_sixstack_ch8_init }, |
| 5489 | }; |
| 5490 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5491 | /* |
| 5492 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5493 | */ |
| 5494 | |
| 5495 | /* |
| 5496 | * 2ch mode |
| 5497 | */ |
| 5498 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5499 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5500 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5501 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5502 | { } /* end */ |
| 5503 | }; |
| 5504 | |
| 5505 | /* |
| 5506 | * 6ch mode |
| 5507 | */ |
| 5508 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5509 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5510 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5511 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5512 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5513 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5514 | { } /* end */ |
| 5515 | }; |
| 5516 | |
| 5517 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5518 | { 2, alc885_mbp_ch2_init }, |
| 5519 | { 6, alc885_mbp_ch6_init }, |
| 5520 | }; |
| 5521 | |
| 5522 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5523 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5524 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5525 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5526 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5527 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5528 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5529 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5530 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5531 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5532 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5533 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5534 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5535 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5536 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5537 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5538 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5539 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5540 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5541 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5542 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5543 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5544 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5545 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5546 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5547 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5548 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5549 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5550 | { } /* end */ |
| 5551 | }; |
| 5552 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5553 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5554 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5555 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5556 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5557 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5558 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5559 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5561 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5562 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5563 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5564 | { } /* end */ |
| 5565 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5566 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5567 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5568 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5569 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5570 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5571 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5572 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5573 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5574 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5575 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5576 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5577 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5578 | { } /* end */ |
| 5579 | }; |
| 5580 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5581 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5582 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5583 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5584 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5585 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5586 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5587 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5588 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5589 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5590 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5591 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5592 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5593 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5594 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5595 | { } /* end */ |
| 5596 | }; |
| 5597 | |
| 5598 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5599 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5600 | */ |
| 5601 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5602 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5603 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5604 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5605 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5606 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5607 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5608 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5609 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5610 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5611 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5612 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5613 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5614 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5615 | { } /* end */ |
| 5616 | }; |
| 5617 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5618 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5619 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5620 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5622 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5623 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5624 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5625 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5626 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5627 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5628 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5629 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5630 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5631 | { } /* end */ |
| 5632 | }; |
| 5633 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5634 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5635 | { |
| 5636 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5637 | .name = "Channel Mode", |
| 5638 | .info = alc_ch_mode_info, |
| 5639 | .get = alc_ch_mode_get, |
| 5640 | .put = alc_ch_mode_put, |
| 5641 | }, |
| 5642 | { } /* end */ |
| 5643 | }; |
| 5644 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5645 | static struct hda_verb alc882_init_verbs[] = { |
| 5646 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5649 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5650 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5651 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5652 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5653 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5654 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5655 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5656 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5657 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5658 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5659 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5660 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5661 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5662 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5663 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5664 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5665 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5666 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5667 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5668 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5669 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5670 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5671 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5672 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5673 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5674 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5675 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5676 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5677 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5678 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5679 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5680 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5681 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5682 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5684 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5685 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5688 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5689 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5690 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5691 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5692 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5693 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5694 | |
| 5695 | /* FIXME: use matrix-type input source selection */ |
| 5696 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5697 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5698 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5699 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5702 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5703 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5704 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5705 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5707 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5708 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5712 | /* ADC1: mute amp left and right */ |
| 5713 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5714 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5715 | /* ADC2: mute amp left and right */ |
| 5716 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5717 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5718 | /* ADC3: mute amp left and right */ |
| 5719 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5720 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5721 | |
| 5722 | { } |
| 5723 | }; |
| 5724 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5725 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5726 | /* change to EAPD mode */ |
| 5727 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5728 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5729 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5730 | }; |
| 5731 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5732 | /* Mac Pro test */ |
| 5733 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5734 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5735 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5736 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5737 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5738 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5739 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5740 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5741 | { } /* end */ |
| 5742 | }; |
| 5743 | |
| 5744 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5745 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5747 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5748 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5749 | /* Front Pin: output 0 (0x0c) */ |
| 5750 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5752 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5753 | /* Front Mic pin: input vref at 80% */ |
| 5754 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5755 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5756 | /* Speaker: output */ |
| 5757 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5758 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5759 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5760 | /* Headphone output (output 0 - 0x0c) */ |
| 5761 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5762 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5763 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5764 | |
| 5765 | /* FIXME: use matrix-type input source selection */ |
| 5766 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5767 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5768 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5769 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5770 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5771 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5772 | /* Input mixer2 */ |
| 5773 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5774 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5775 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5776 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5777 | /* Input mixer3 */ |
| 5778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5780 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5781 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5782 | /* ADC1: mute amp left and right */ |
| 5783 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5784 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5785 | /* ADC2: mute amp left and right */ |
| 5786 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5787 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5788 | /* ADC3: mute amp left and right */ |
| 5789 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5790 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5791 | |
| 5792 | { } |
| 5793 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5794 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5795 | /* Macbook Pro rev3 */ |
| 5796 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5797 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5798 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5799 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5800 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5801 | /* Rear mixer */ |
| 5802 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5803 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5805 | /* Front Pin: output 0 (0x0c) */ |
| 5806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5808 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5809 | /* HP Pin: output 0 (0x0d) */ |
| 5810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5812 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5813 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5814 | /* Mic (rear) pin: input vref at 80% */ |
| 5815 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5817 | /* Front Mic pin: input vref at 80% */ |
| 5818 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5820 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5821 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5823 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5824 | |
| 5825 | /* FIXME: use matrix-type input source selection */ |
| 5826 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5827 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5828 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5829 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5830 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5831 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5832 | /* Input mixer2 */ |
| 5833 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5834 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5835 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5836 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5837 | /* Input mixer3 */ |
| 5838 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5839 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5840 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5841 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5842 | /* ADC1: mute amp left and right */ |
| 5843 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5844 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5845 | /* ADC2: mute amp left and right */ |
| 5846 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5847 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5848 | /* ADC3: mute amp left and right */ |
| 5849 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5850 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5851 | |
| 5852 | { } |
| 5853 | }; |
| 5854 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5855 | /* iMac 24 mixer. */ |
| 5856 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5857 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5858 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5859 | { } /* end */ |
| 5860 | }; |
| 5861 | |
| 5862 | /* iMac 24 init verbs. */ |
| 5863 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5864 | /* Internal speakers: output 0 (0x0c) */ |
| 5865 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5866 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5867 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5868 | /* Internal speakers: output 0 (0x0c) */ |
| 5869 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5870 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5871 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5872 | /* Headphone: output 0 (0x0c) */ |
| 5873 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5874 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5875 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5876 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5877 | /* Front Mic: input vref at 80% */ |
| 5878 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5879 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5880 | { } |
| 5881 | }; |
| 5882 | |
| 5883 | /* Toggle speaker-output according to the hp-jack state */ |
| 5884 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5885 | { |
| 5886 | unsigned int present; |
| 5887 | |
| 5888 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5889 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5890 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5891 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5892 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5893 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5894 | } |
| 5895 | |
| 5896 | /* Processes unsolicited events. */ |
| 5897 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5898 | unsigned int res) |
| 5899 | { |
| 5900 | /* Headphone insertion or removal. */ |
| 5901 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5902 | alc885_imac24_automute(codec); |
| 5903 | } |
| 5904 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5905 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5906 | { |
| 5907 | unsigned int present; |
| 5908 | |
| 5909 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5910 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5911 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5912 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5913 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5914 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5915 | |
| 5916 | } |
| 5917 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5918 | unsigned int res) |
| 5919 | { |
| 5920 | /* Headphone insertion or removal. */ |
| 5921 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5922 | alc885_mbp3_automute(codec); |
| 5923 | } |
| 5924 | |
| 5925 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5926 | static struct hda_verb alc882_targa_verbs[] = { |
| 5927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5928 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5929 | |
| 5930 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5931 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5932 | |
| 5933 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5934 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5935 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5936 | |
| 5937 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5938 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5939 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5940 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5941 | { } /* end */ |
| 5942 | }; |
| 5943 | |
| 5944 | /* toggle speaker-output according to the hp-jack state */ |
| 5945 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5946 | { |
| 5947 | unsigned int present; |
| 5948 | |
| 5949 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5950 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5951 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5952 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5953 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5954 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5955 | } |
| 5956 | |
| 5957 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5958 | { |
| 5959 | /* Looks like the unsol event is incompatible with the standard |
| 5960 | * definition. 4bit tag is placed at 26 bit! |
| 5961 | */ |
| 5962 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5963 | alc882_targa_automute(codec); |
| 5964 | } |
| 5965 | } |
| 5966 | |
| 5967 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5968 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5969 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5970 | |
| 5971 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5972 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5973 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5974 | |
| 5975 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5976 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5977 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5978 | |
| 5979 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5980 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5981 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5982 | { } /* end */ |
| 5983 | }; |
| 5984 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5985 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5986 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5987 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5988 | |
| 5989 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5990 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5991 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5992 | |
| 5993 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5994 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5995 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5996 | |
| 5997 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5998 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5999 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 6000 | { } /* end */ |
| 6001 | }; |
| 6002 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6003 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 6004 | { |
| 6005 | unsigned int gpiostate, gpiomask, gpiodir; |
| 6006 | |
| 6007 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 6008 | AC_VERB_GET_GPIO_DATA, 0); |
| 6009 | |
| 6010 | if (!muted) |
| 6011 | gpiostate |= (1 << pin); |
| 6012 | else |
| 6013 | gpiostate &= ~(1 << pin); |
| 6014 | |
| 6015 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 6016 | AC_VERB_GET_GPIO_MASK, 0); |
| 6017 | gpiomask |= (1 << pin); |
| 6018 | |
| 6019 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 6020 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 6021 | gpiodir |= (1 << pin); |
| 6022 | |
| 6023 | |
| 6024 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6025 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 6026 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6027 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 6028 | |
| 6029 | msleep(1); |
| 6030 | |
| 6031 | snd_hda_codec_write(codec, codec->afg, 0, |
| 6032 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 6033 | } |
| 6034 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6035 | /* set up GPIO at initialization */ |
| 6036 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 6037 | { |
| 6038 | alc882_gpio_mute(codec, 0, 0); |
| 6039 | alc882_gpio_mute(codec, 1, 0); |
| 6040 | } |
| 6041 | |
| 6042 | /* set up GPIO and update auto-muting at initialization */ |
| 6043 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 6044 | { |
| 6045 | alc885_macpro_init_hook(codec); |
| 6046 | alc885_imac24_automute(codec); |
| 6047 | } |
| 6048 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6049 | /* |
| 6050 | * generic initialization of ADC, input mixers and output mixers |
| 6051 | */ |
| 6052 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 6053 | /* |
| 6054 | * Unmute ADC0-2 and set the default input to mic-in |
| 6055 | */ |
| 6056 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6057 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6058 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6059 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6060 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6061 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6062 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6063 | /* 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] | 6064 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6065 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6066 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6067 | */ |
| 6068 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6071 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6072 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6073 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6074 | |
| 6075 | /* |
| 6076 | * Set up output mixers (0x0c - 0x0f) |
| 6077 | */ |
| 6078 | /* set vol=0 to output mixers */ |
| 6079 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6080 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6081 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6082 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6083 | /* set up input amps for analog loopback */ |
| 6084 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6085 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6086 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6087 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6088 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6089 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6090 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6091 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6093 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6094 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6095 | |
| 6096 | /* FIXME: use matrix-type input source selection */ |
| 6097 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6098 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6099 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6100 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6101 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6102 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6103 | /* Input mixer2 */ |
| 6104 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6105 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6106 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6107 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6108 | /* Input mixer3 */ |
| 6109 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6110 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6111 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6113 | |
| 6114 | { } |
| 6115 | }; |
| 6116 | |
| 6117 | /* capture mixer elements */ |
| 6118 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6119 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6120 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6121 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6122 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6123 | { |
| 6124 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6125 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6126 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6127 | */ |
| 6128 | /* .name = "Capture Source", */ |
| 6129 | .name = "Input Source", |
| 6130 | .count = 2, |
| 6131 | .info = alc882_mux_enum_info, |
| 6132 | .get = alc882_mux_enum_get, |
| 6133 | .put = alc882_mux_enum_put, |
| 6134 | }, |
| 6135 | { } /* end */ |
| 6136 | }; |
| 6137 | |
| 6138 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6139 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6140 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6141 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6142 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6143 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6144 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6145 | { |
| 6146 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6147 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6148 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6149 | */ |
| 6150 | /* .name = "Capture Source", */ |
| 6151 | .name = "Input Source", |
| 6152 | .count = 3, |
| 6153 | .info = alc882_mux_enum_info, |
| 6154 | .get = alc882_mux_enum_get, |
| 6155 | .put = alc882_mux_enum_put, |
| 6156 | }, |
| 6157 | { } /* end */ |
| 6158 | }; |
| 6159 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6160 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6161 | #define alc882_loopbacks alc880_loopbacks |
| 6162 | #endif |
| 6163 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6164 | /* pcm configuration: identiacal with ALC880 */ |
| 6165 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6166 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6167 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6168 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6169 | |
| 6170 | /* |
| 6171 | * configuration and preset |
| 6172 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6173 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6174 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6175 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6176 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6177 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6178 | [ALC882_TARGA] = "targa", |
| 6179 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6180 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6181 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6182 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6183 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6184 | [ALC882_AUTO] = "auto", |
| 6185 | }; |
| 6186 | |
| 6187 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6188 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6189 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6190 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6191 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6192 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6193 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6194 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6195 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Travis Place | 3e0e469 | 2008-06-20 16:51:45 +0200 | [diff] [blame] | 6196 | SND_PCI_QUIRK(0x106b, 0x00a0, "Apple iMac 24''", ALC885_IMAC24), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6197 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6198 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6199 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6200 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6201 | {} |
| 6202 | }; |
| 6203 | |
| 6204 | static struct alc_config_preset alc882_presets[] = { |
| 6205 | [ALC882_3ST_DIG] = { |
| 6206 | .mixers = { alc882_base_mixer }, |
| 6207 | .init_verbs = { alc882_init_verbs }, |
| 6208 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6209 | .dac_nids = alc882_dac_nids, |
| 6210 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6211 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6212 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6213 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6214 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6215 | .input_mux = &alc882_capture_source, |
| 6216 | }, |
| 6217 | [ALC882_6ST_DIG] = { |
| 6218 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6219 | .init_verbs = { alc882_init_verbs }, |
| 6220 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6221 | .dac_nids = alc882_dac_nids, |
| 6222 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6223 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6224 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6225 | .channel_mode = alc882_sixstack_modes, |
| 6226 | .input_mux = &alc882_capture_source, |
| 6227 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6228 | [ALC882_ARIMA] = { |
| 6229 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6230 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6231 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6232 | .dac_nids = alc882_dac_nids, |
| 6233 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6234 | .channel_mode = alc882_sixstack_modes, |
| 6235 | .input_mux = &alc882_capture_source, |
| 6236 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6237 | [ALC882_W2JC] = { |
| 6238 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6239 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6240 | alc880_gpio1_init_verbs }, |
| 6241 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6242 | .dac_nids = alc882_dac_nids, |
| 6243 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6244 | .channel_mode = alc880_threestack_modes, |
| 6245 | .need_dac_fix = 1, |
| 6246 | .input_mux = &alc882_capture_source, |
| 6247 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6248 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6249 | [ALC885_MBP3] = { |
| 6250 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6251 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6252 | alc880_gpio1_init_verbs }, |
| 6253 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6254 | .dac_nids = alc882_dac_nids, |
| 6255 | .channel_mode = alc885_mbp_6ch_modes, |
| 6256 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6257 | .input_mux = &alc882_capture_source, |
| 6258 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6259 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6260 | .unsol_event = alc885_mbp3_unsol_event, |
| 6261 | .init_hook = alc885_mbp3_automute, |
| 6262 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6263 | [ALC885_MACPRO] = { |
| 6264 | .mixers = { alc882_macpro_mixer }, |
| 6265 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6266 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6267 | .dac_nids = alc882_dac_nids, |
| 6268 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6269 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6270 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6271 | .channel_mode = alc882_ch_modes, |
| 6272 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6273 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6274 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6275 | [ALC885_IMAC24] = { |
| 6276 | .mixers = { alc885_imac24_mixer }, |
| 6277 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6278 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6279 | .dac_nids = alc882_dac_nids, |
| 6280 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6281 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6282 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6283 | .channel_mode = alc882_ch_modes, |
| 6284 | .input_mux = &alc882_capture_source, |
| 6285 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6286 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6287 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6288 | [ALC882_TARGA] = { |
| 6289 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6290 | alc882_capture_mixer }, |
| 6291 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6292 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6293 | .dac_nids = alc882_dac_nids, |
| 6294 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6295 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6296 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6297 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6298 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6299 | .channel_mode = alc882_3ST_6ch_modes, |
| 6300 | .need_dac_fix = 1, |
| 6301 | .input_mux = &alc882_capture_source, |
| 6302 | .unsol_event = alc882_targa_unsol_event, |
| 6303 | .init_hook = alc882_targa_automute, |
| 6304 | }, |
| 6305 | [ALC882_ASUS_A7J] = { |
| 6306 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6307 | alc882_capture_mixer }, |
| 6308 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6309 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6310 | .dac_nids = alc882_dac_nids, |
| 6311 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6312 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6313 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6314 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6315 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6316 | .channel_mode = alc882_3ST_6ch_modes, |
| 6317 | .need_dac_fix = 1, |
| 6318 | .input_mux = &alc882_capture_source, |
| 6319 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6320 | [ALC882_ASUS_A7M] = { |
| 6321 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6322 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6323 | alc880_gpio1_init_verbs, |
| 6324 | alc882_asus_a7m_verbs }, |
| 6325 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6326 | .dac_nids = alc882_dac_nids, |
| 6327 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6328 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6329 | .channel_mode = alc880_threestack_modes, |
| 6330 | .need_dac_fix = 1, |
| 6331 | .input_mux = &alc882_capture_source, |
| 6332 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6333 | }; |
| 6334 | |
| 6335 | |
| 6336 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6337 | * Pin config fixes |
| 6338 | */ |
| 6339 | enum { |
| 6340 | PINFIX_ABIT_AW9D_MAX |
| 6341 | }; |
| 6342 | |
| 6343 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6344 | { 0x15, 0x01080104 }, /* side */ |
| 6345 | { 0x16, 0x01011012 }, /* rear */ |
| 6346 | { 0x17, 0x01016011 }, /* clfe */ |
| 6347 | { } |
| 6348 | }; |
| 6349 | |
| 6350 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6351 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6352 | }; |
| 6353 | |
| 6354 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6355 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6356 | {} |
| 6357 | }; |
| 6358 | |
| 6359 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6360 | * BIOS auto configuration |
| 6361 | */ |
| 6362 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6363 | hda_nid_t nid, int pin_type, |
| 6364 | int dac_idx) |
| 6365 | { |
| 6366 | /* set as output */ |
| 6367 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6368 | int idx; |
| 6369 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6370 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6371 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6372 | idx = 4; |
| 6373 | else |
| 6374 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6375 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6376 | |
| 6377 | } |
| 6378 | |
| 6379 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6380 | { |
| 6381 | struct alc_spec *spec = codec->spec; |
| 6382 | int i; |
| 6383 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6384 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6385 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6386 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6387 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6388 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6389 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6390 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6391 | } |
| 6392 | } |
| 6393 | |
| 6394 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6395 | { |
| 6396 | struct alc_spec *spec = codec->spec; |
| 6397 | hda_nid_t pin; |
| 6398 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6399 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6400 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6401 | /* use dac 0 */ |
| 6402 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6403 | pin = spec->autocfg.speaker_pins[0]; |
| 6404 | if (pin) |
| 6405 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6406 | } |
| 6407 | |
| 6408 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6409 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6410 | |
| 6411 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6412 | { |
| 6413 | struct alc_spec *spec = codec->spec; |
| 6414 | int i; |
| 6415 | |
| 6416 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6417 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6418 | unsigned int vref; |
| 6419 | if (!nid) |
| 6420 | continue; |
| 6421 | vref = PIN_IN; |
| 6422 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
Kailang Yang | 531240f | 2008-05-27 12:10:25 +0200 | [diff] [blame] | 6423 | unsigned int pincap; |
| 6424 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
| 6425 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6426 | AC_PINCAP_VREF_80) |
| 6427 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6428 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6429 | snd_hda_codec_write(codec, nid, 0, |
| 6430 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6431 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6432 | snd_hda_codec_write(codec, nid, 0, |
| 6433 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6434 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6435 | } |
| 6436 | } |
| 6437 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6438 | /* add mic boosts if needed */ |
| 6439 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6440 | { |
| 6441 | struct alc_spec *spec = codec->spec; |
| 6442 | int err; |
| 6443 | hda_nid_t nid; |
| 6444 | |
| 6445 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6446 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6447 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6448 | "Mic Boost", |
| 6449 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6450 | if (err < 0) |
| 6451 | return err; |
| 6452 | } |
| 6453 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6454 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6455 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6456 | "Front Mic Boost", |
| 6457 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6458 | if (err < 0) |
| 6459 | return err; |
| 6460 | } |
| 6461 | return 0; |
| 6462 | } |
| 6463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6464 | /* almost identical with ALC880 parser... */ |
| 6465 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6466 | { |
| 6467 | struct alc_spec *spec = codec->spec; |
| 6468 | int err = alc880_parse_auto_config(codec); |
| 6469 | |
| 6470 | if (err < 0) |
| 6471 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6472 | else if (!err) |
| 6473 | return 0; /* no config found */ |
| 6474 | |
| 6475 | err = alc_auto_add_mic_boost(codec); |
| 6476 | if (err < 0) |
| 6477 | return err; |
| 6478 | |
| 6479 | /* hack - override the init verbs */ |
| 6480 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6481 | |
| 6482 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6483 | } |
| 6484 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6485 | /* additional initialization for auto-configuration model */ |
| 6486 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6487 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6488 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6489 | alc882_auto_init_multi_out(codec); |
| 6490 | alc882_auto_init_hp_out(codec); |
| 6491 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6492 | if (spec->unsol_event) |
| 6493 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6494 | } |
| 6495 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6496 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6497 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6498 | static int patch_alc882(struct hda_codec *codec) |
| 6499 | { |
| 6500 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6501 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6502 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6503 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6504 | if (spec == NULL) |
| 6505 | return -ENOMEM; |
| 6506 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6507 | codec->spec = spec; |
| 6508 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6509 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6510 | alc882_models, |
| 6511 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6512 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6513 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6514 | /* Pick up systems that don't supply PCI SSID */ |
| 6515 | switch (codec->subsystem_id) { |
| 6516 | case 0x106b0c00: /* Mac Pro */ |
| 6517 | board_config = ALC885_MACPRO; |
| 6518 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6519 | case 0x106b1000: /* iMac 24 */ |
| 6520 | board_config = ALC885_IMAC24; |
| 6521 | break; |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6522 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6523 | case 0x106b2c00: /* Macbook Pro rev3 */ |
Takashi Iwai | c7e0757 | 2008-06-26 14:42:51 +0200 | [diff] [blame] | 6524 | case 0x106b3600: /* Macbook 3.1 */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6525 | board_config = ALC885_MBP3; |
| 6526 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6527 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6528 | /* ALC889A is handled better as ALC888-compatible */ |
| 6529 | if (codec->revision_id == 0x100103) { |
| 6530 | alc_free(codec); |
| 6531 | return patch_alc883(codec); |
| 6532 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6533 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6534 | "trying auto-probe from BIOS...\n"); |
| 6535 | board_config = ALC882_AUTO; |
| 6536 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6537 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6538 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6539 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6540 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6541 | if (board_config == ALC882_AUTO) { |
| 6542 | /* automatic parse from the BIOS config */ |
| 6543 | err = alc882_parse_auto_config(codec); |
| 6544 | if (err < 0) { |
| 6545 | alc_free(codec); |
| 6546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6547 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6548 | printk(KERN_INFO |
| 6549 | "hda_codec: Cannot set up configuration " |
| 6550 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6551 | board_config = ALC882_3ST_DIG; |
| 6552 | } |
| 6553 | } |
| 6554 | |
| 6555 | if (board_config != ALC882_AUTO) |
| 6556 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6557 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 6558 | if (codec->vendor_id == 0x10ec0885) { |
| 6559 | spec->stream_name_analog = "ALC885 Analog"; |
| 6560 | spec->stream_name_digital = "ALC885 Digital"; |
| 6561 | } else { |
| 6562 | spec->stream_name_analog = "ALC882 Analog"; |
| 6563 | spec->stream_name_digital = "ALC882 Digital"; |
| 6564 | } |
| 6565 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6566 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6567 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6568 | /* FIXME: setup DAC5 */ |
| 6569 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6570 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6572 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6573 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6574 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6575 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6576 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6577 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6578 | /* get type */ |
| 6579 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6580 | if (wcap != AC_WID_AUD_IN) { |
| 6581 | spec->adc_nids = alc882_adc_nids_alt; |
| 6582 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6583 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6584 | spec->mixers[spec->num_mixers] = |
| 6585 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6586 | spec->num_mixers++; |
| 6587 | } else { |
| 6588 | spec->adc_nids = alc882_adc_nids; |
| 6589 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6590 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6591 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6592 | spec->num_mixers++; |
| 6593 | } |
| 6594 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6595 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6596 | spec->vmaster_nid = 0x0c; |
| 6597 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6598 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6599 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6600 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6601 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6602 | if (!spec->loopback.amplist) |
| 6603 | spec->loopback.amplist = alc882_loopbacks; |
| 6604 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6605 | |
| 6606 | return 0; |
| 6607 | } |
| 6608 | |
| 6609 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6610 | * ALC883 support |
| 6611 | * |
| 6612 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6613 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6614 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6615 | * 6-channel independent captures. |
| 6616 | * |
| 6617 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6618 | * driver yet). |
| 6619 | */ |
| 6620 | #define ALC883_DIGOUT_NID 0x06 |
| 6621 | #define ALC883_DIGIN_NID 0x0a |
| 6622 | |
| 6623 | static hda_nid_t alc883_dac_nids[4] = { |
| 6624 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6625 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6626 | }; |
| 6627 | |
| 6628 | static hda_nid_t alc883_adc_nids[2] = { |
| 6629 | /* ADC1-2 */ |
| 6630 | 0x08, 0x09, |
| 6631 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6632 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6633 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6634 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6635 | /* input MUX */ |
| 6636 | /* FIXME: should be a matrix-type input source selection */ |
| 6637 | |
| 6638 | static struct hda_input_mux alc883_capture_source = { |
| 6639 | .num_items = 4, |
| 6640 | .items = { |
| 6641 | { "Mic", 0x0 }, |
| 6642 | { "Front Mic", 0x1 }, |
| 6643 | { "Line", 0x2 }, |
| 6644 | { "CD", 0x4 }, |
| 6645 | }, |
| 6646 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6647 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6648 | static struct hda_input_mux alc883_3stack_6ch_intel = { |
| 6649 | .num_items = 4, |
| 6650 | .items = { |
| 6651 | { "Mic", 0x1 }, |
| 6652 | { "Front Mic", 0x0 }, |
| 6653 | { "Line", 0x2 }, |
| 6654 | { "CD", 0x4 }, |
| 6655 | }, |
| 6656 | }; |
| 6657 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6658 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6659 | .num_items = 2, |
| 6660 | .items = { |
| 6661 | { "Mic", 0x1 }, |
| 6662 | { "Line", 0x2 }, |
| 6663 | }, |
| 6664 | }; |
| 6665 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6666 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6667 | .num_items = 4, |
| 6668 | .items = { |
| 6669 | { "Mic", 0x0 }, |
| 6670 | { "iMic", 0x1 }, |
| 6671 | { "Line", 0x2 }, |
| 6672 | { "CD", 0x4 }, |
| 6673 | }, |
| 6674 | }; |
| 6675 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6676 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6677 | .num_items = 2, |
| 6678 | .items = { |
| 6679 | { "Mic", 0x0 }, |
| 6680 | { "Int Mic", 0x1 }, |
| 6681 | }, |
| 6682 | }; |
| 6683 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6684 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6685 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6686 | /* ALC883 has the ALC882-type input selection */ |
| 6687 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6688 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6689 | /* |
| 6690 | * 2ch mode |
| 6691 | */ |
| 6692 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6693 | { 2, NULL } |
| 6694 | }; |
| 6695 | |
| 6696 | /* |
| 6697 | * 2ch mode |
| 6698 | */ |
| 6699 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6700 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6701 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6702 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6703 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6704 | { } /* end */ |
| 6705 | }; |
| 6706 | |
| 6707 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6708 | * 4ch mode |
| 6709 | */ |
| 6710 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6711 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6712 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6713 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6714 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6715 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6716 | { } /* end */ |
| 6717 | }; |
| 6718 | |
| 6719 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6720 | * 6ch mode |
| 6721 | */ |
| 6722 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6723 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6724 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6725 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6726 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6727 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6728 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6729 | { } /* end */ |
| 6730 | }; |
| 6731 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6732 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6733 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6734 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6735 | { 6, alc883_3ST_ch6_init }, |
| 6736 | }; |
| 6737 | |
| 6738 | /* |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 6739 | * 2ch mode |
| 6740 | */ |
| 6741 | static struct hda_verb alc883_3ST_ch2_intel_init[] = { |
| 6742 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6743 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6744 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6745 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6746 | { } /* end */ |
| 6747 | }; |
| 6748 | |
| 6749 | /* |
| 6750 | * 4ch mode |
| 6751 | */ |
| 6752 | static struct hda_verb alc883_3ST_ch4_intel_init[] = { |
| 6753 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6754 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6755 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6756 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6757 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6758 | { } /* end */ |
| 6759 | }; |
| 6760 | |
| 6761 | /* |
| 6762 | * 6ch mode |
| 6763 | */ |
| 6764 | static struct hda_verb alc883_3ST_ch6_intel_init[] = { |
| 6765 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6766 | { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6767 | { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6768 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6769 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6770 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6771 | { } /* end */ |
| 6772 | }; |
| 6773 | |
| 6774 | static struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = { |
| 6775 | { 2, alc883_3ST_ch2_intel_init }, |
| 6776 | { 4, alc883_3ST_ch4_intel_init }, |
| 6777 | { 6, alc883_3ST_ch6_intel_init }, |
| 6778 | }; |
| 6779 | |
| 6780 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6781 | * 6ch mode |
| 6782 | */ |
| 6783 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6784 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6785 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6786 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6787 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6788 | { } /* end */ |
| 6789 | }; |
| 6790 | |
| 6791 | /* |
| 6792 | * 8ch mode |
| 6793 | */ |
| 6794 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6795 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6796 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6797 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6798 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6799 | { } /* end */ |
| 6800 | }; |
| 6801 | |
| 6802 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6803 | { 6, alc883_sixstack_ch6_init }, |
| 6804 | { 8, alc883_sixstack_ch8_init }, |
| 6805 | }; |
| 6806 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6807 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6808 | /* eanable EAPD on medion laptop */ |
| 6809 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6810 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6811 | { } |
| 6812 | }; |
| 6813 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6814 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6815 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6816 | */ |
| 6817 | |
| 6818 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6819 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6820 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6821 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6822 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6823 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6824 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6825 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6826 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6827 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6828 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6830 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6831 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6832 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6833 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6834 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6835 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6836 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6837 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6838 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6839 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6840 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6841 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6842 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6843 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6844 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6845 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6846 | { |
| 6847 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6848 | /* .name = "Capture Source", */ |
| 6849 | .name = "Input Source", |
| 6850 | .count = 2, |
| 6851 | .info = alc883_mux_enum_info, |
| 6852 | .get = alc883_mux_enum_get, |
| 6853 | .put = alc883_mux_enum_put, |
| 6854 | }, |
| 6855 | { } /* end */ |
| 6856 | }; |
| 6857 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6858 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6859 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6860 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6861 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6862 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6863 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6864 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6865 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6866 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6870 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6871 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6872 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6873 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6874 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6875 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6876 | { |
| 6877 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6878 | /* .name = "Capture Source", */ |
| 6879 | .name = "Input Source", |
| 6880 | .count = 2, |
| 6881 | .info = alc883_mux_enum_info, |
| 6882 | .get = alc883_mux_enum_get, |
| 6883 | .put = alc883_mux_enum_put, |
| 6884 | }, |
| 6885 | { } /* end */ |
| 6886 | }; |
| 6887 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 6888 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6889 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6890 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6891 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6892 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6893 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6894 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6895 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6896 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6897 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6898 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6899 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6900 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6901 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6902 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6903 | { |
| 6904 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6905 | /* .name = "Capture Source", */ |
| 6906 | .name = "Input Source", |
| 6907 | .count = 2, |
| 6908 | .info = alc883_mux_enum_info, |
| 6909 | .get = alc883_mux_enum_get, |
| 6910 | .put = alc883_mux_enum_put, |
| 6911 | }, |
| 6912 | { } /* end */ |
| 6913 | }; |
| 6914 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6915 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6916 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6917 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6918 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6919 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6920 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6921 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6922 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6923 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6924 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6925 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6926 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6927 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6928 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6929 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6930 | { |
| 6931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6932 | /* .name = "Capture Source", */ |
| 6933 | .name = "Input Source", |
| 6934 | .count = 2, |
| 6935 | .info = alc883_mux_enum_info, |
| 6936 | .get = alc883_mux_enum_get, |
| 6937 | .put = alc883_mux_enum_put, |
| 6938 | }, |
| 6939 | { } /* end */ |
| 6940 | }; |
| 6941 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6942 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6943 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6944 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6945 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6946 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6947 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6948 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6949 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6950 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6951 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6952 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6953 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6954 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6955 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6956 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6957 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6958 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6959 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6961 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6962 | { |
| 6963 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6964 | /* .name = "Capture Source", */ |
| 6965 | .name = "Input Source", |
| 6966 | .count = 2, |
| 6967 | .info = alc883_mux_enum_info, |
| 6968 | .get = alc883_mux_enum_get, |
| 6969 | .put = alc883_mux_enum_put, |
| 6970 | }, |
| 6971 | { } /* end */ |
| 6972 | }; |
| 6973 | |
| 6974 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6975 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6976 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6977 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6978 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6980 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6981 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6982 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6983 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6985 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6986 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6987 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6989 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6991 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6992 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6993 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6994 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6995 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6996 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6997 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6998 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6999 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7000 | { |
| 7001 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7002 | /* .name = "Capture Source", */ |
| 7003 | .name = "Input Source", |
| 7004 | .count = 2, |
| 7005 | .info = alc883_mux_enum_info, |
| 7006 | .get = alc883_mux_enum_get, |
| 7007 | .put = alc883_mux_enum_put, |
| 7008 | }, |
| 7009 | { } /* end */ |
| 7010 | }; |
| 7011 | |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7012 | static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { |
| 7013 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7014 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7015 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7016 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, |
| 7018 | HDA_OUTPUT), |
| 7019 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7020 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7021 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7022 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7023 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7024 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7025 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7026 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7028 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 7029 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7030 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7031 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
| 7032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7033 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7034 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7035 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7036 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7037 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7038 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7039 | { |
| 7040 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7041 | /* .name = "Capture Source", */ |
| 7042 | .name = "Input Source", |
| 7043 | .count = 2, |
| 7044 | .info = alc883_mux_enum_info, |
| 7045 | .get = alc883_mux_enum_get, |
| 7046 | .put = alc883_mux_enum_put, |
| 7047 | }, |
| 7048 | { } /* end */ |
| 7049 | }; |
| 7050 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 7051 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7052 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame^] | 7053 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7054 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame^] | 7055 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7056 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7057 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 0701e06 | 2008-06-27 16:30:57 +0200 | [diff] [blame^] | 7058 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7059 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7061 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7063 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7064 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7065 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7066 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7067 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7068 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7069 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7070 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7071 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7072 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 7073 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7074 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7075 | |
| 7076 | { |
| 7077 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7078 | /* .name = "Capture Source", */ |
| 7079 | .name = "Input Source", |
| 7080 | .count = 1, |
| 7081 | .info = alc883_mux_enum_info, |
| 7082 | .get = alc883_mux_enum_get, |
| 7083 | .put = alc883_mux_enum_put, |
| 7084 | }, |
| 7085 | { } /* end */ |
| 7086 | }; |
| 7087 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7088 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 7089 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7090 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7091 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7092 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7093 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 7094 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 7095 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7096 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 7097 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 7098 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7099 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7100 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7101 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7102 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7103 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7104 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7105 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7106 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7107 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7108 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7109 | { |
| 7110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7111 | /* .name = "Capture Source", */ |
| 7112 | .name = "Input Source", |
| 7113 | .count = 2, |
| 7114 | .info = alc883_mux_enum_info, |
| 7115 | .get = alc883_mux_enum_get, |
| 7116 | .put = alc883_mux_enum_put, |
| 7117 | }, |
| 7118 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7119 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7120 | |
| 7121 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 7122 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7123 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7124 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7125 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7126 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7127 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 7128 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7129 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7130 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7131 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 7132 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7133 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7134 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7135 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7136 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7137 | { |
| 7138 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7139 | /* .name = "Capture Source", */ |
| 7140 | .name = "Input Source", |
| 7141 | .count = 2, |
| 7142 | .info = alc883_mux_enum_info, |
| 7143 | .get = alc883_mux_enum_get, |
| 7144 | .put = alc883_mux_enum_put, |
| 7145 | }, |
| 7146 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7147 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7148 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7149 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 7150 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7151 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 7152 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 7153 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7154 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 7155 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7156 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7157 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7158 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7159 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7160 | { |
| 7161 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7162 | /* .name = "Capture Source", */ |
| 7163 | .name = "Input Source", |
| 7164 | .count = 1, |
| 7165 | .info = alc883_mux_enum_info, |
| 7166 | .get = alc883_mux_enum_get, |
| 7167 | .put = alc883_mux_enum_put, |
| 7168 | }, |
| 7169 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7170 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7171 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7172 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7173 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7174 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7175 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7176 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7177 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7178 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7179 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7180 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7181 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7182 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7183 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7184 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7185 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7186 | { |
| 7187 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7188 | /* .name = "Capture Source", */ |
| 7189 | .name = "Input Source", |
| 7190 | .count = 2, |
| 7191 | .info = alc883_mux_enum_info, |
| 7192 | .get = alc883_mux_enum_get, |
| 7193 | .put = alc883_mux_enum_put, |
| 7194 | }, |
| 7195 | { } /* end */ |
| 7196 | }; |
| 7197 | |
| 7198 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7199 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7200 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7201 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7206 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7207 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7208 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7209 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7210 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7211 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7212 | { |
| 7213 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7214 | /* .name = "Capture Source", */ |
| 7215 | .name = "Input Source", |
| 7216 | .count = 2, |
| 7217 | .info = alc883_mux_enum_info, |
| 7218 | .get = alc883_mux_enum_get, |
| 7219 | .put = alc883_mux_enum_put, |
| 7220 | }, |
| 7221 | { } /* end */ |
| 7222 | }; |
| 7223 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7224 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7225 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7226 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7227 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7228 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7229 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7230 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7231 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7232 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7233 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7234 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7235 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7236 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7237 | { |
| 7238 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7239 | /* .name = "Capture Source", */ |
| 7240 | .name = "Input Source", |
| 7241 | .count = 2, |
| 7242 | .info = alc883_mux_enum_info, |
| 7243 | .get = alc883_mux_enum_get, |
| 7244 | .put = alc883_mux_enum_put, |
| 7245 | }, |
| 7246 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7247 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7248 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7249 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7250 | { |
| 7251 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7252 | .name = "Channel Mode", |
| 7253 | .info = alc_ch_mode_info, |
| 7254 | .get = alc_ch_mode_get, |
| 7255 | .put = alc_ch_mode_put, |
| 7256 | }, |
| 7257 | { } /* end */ |
| 7258 | }; |
| 7259 | |
| 7260 | static struct hda_verb alc883_init_verbs[] = { |
| 7261 | /* ADC1: mute amp left and right */ |
| 7262 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7263 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7264 | /* ADC2: mute amp left and right */ |
| 7265 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7266 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7267 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7268 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7269 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7270 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7271 | /* Rear mixer */ |
| 7272 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7273 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7274 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7275 | /* CLFE mixer */ |
| 7276 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7279 | /* Side mixer */ |
| 7280 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7282 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7283 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7284 | /* mute analog input loopbacks */ |
| 7285 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7286 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7287 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7288 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7289 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7290 | |
| 7291 | /* Front Pin: output 0 (0x0c) */ |
| 7292 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7293 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7294 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7295 | /* Rear Pin: output 1 (0x0d) */ |
| 7296 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7297 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7299 | /* CLFE Pin: output 2 (0x0e) */ |
| 7300 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7301 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7302 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7303 | /* Side Pin: output 3 (0x0f) */ |
| 7304 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7305 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7306 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7307 | /* Mic (rear) pin: input vref at 80% */ |
| 7308 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7309 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7310 | /* Front Mic pin: input vref at 80% */ |
| 7311 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7313 | /* Line In pin: input */ |
| 7314 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7315 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7316 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7317 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7318 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7319 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7320 | /* CD pin widget for input */ |
| 7321 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7322 | |
| 7323 | /* FIXME: use matrix-type input source selection */ |
| 7324 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7325 | /* Input mixer2 */ |
| 7326 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7327 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7328 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7329 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7330 | /* Input mixer3 */ |
| 7331 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7332 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7333 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7334 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7335 | { } |
| 7336 | }; |
| 7337 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7338 | /* toggle speaker-output according to the hp-jack state */ |
| 7339 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7340 | { |
| 7341 | unsigned int present; |
| 7342 | |
| 7343 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7344 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7345 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7346 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7347 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7348 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7349 | } |
| 7350 | |
| 7351 | /* auto-toggle front mic */ |
| 7352 | /* |
| 7353 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7354 | { |
| 7355 | unsigned int present; |
| 7356 | unsigned char bits; |
| 7357 | |
| 7358 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7359 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7360 | bits = present ? HDA_AMP_MUTE : 0; |
| 7361 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7362 | } |
| 7363 | */ |
| 7364 | |
| 7365 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7366 | { |
| 7367 | alc883_mitac_hp_automute(codec); |
| 7368 | /* alc883_mitac_mic_automute(codec); */ |
| 7369 | } |
| 7370 | |
| 7371 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7372 | unsigned int res) |
| 7373 | { |
| 7374 | switch (res >> 26) { |
| 7375 | case ALC880_HP_EVENT: |
| 7376 | alc883_mitac_hp_automute(codec); |
| 7377 | break; |
| 7378 | case ALC880_MIC_EVENT: |
| 7379 | /* alc883_mitac_mic_automute(codec); */ |
| 7380 | break; |
| 7381 | } |
| 7382 | } |
| 7383 | |
| 7384 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7385 | /* HP */ |
| 7386 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7387 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7388 | /* Subwoofer */ |
| 7389 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7390 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7391 | |
| 7392 | /* enable unsolicited event */ |
| 7393 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7394 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7395 | |
| 7396 | { } /* end */ |
| 7397 | }; |
| 7398 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7399 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7400 | /* HP */ |
| 7401 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7402 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7403 | /* Int speaker */ |
| 7404 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7405 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7406 | |
| 7407 | /* enable unsolicited event */ |
| 7408 | {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] | 7409 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7410 | |
| 7411 | { } /* end */ |
| 7412 | }; |
| 7413 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7414 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7415 | /* HP */ |
| 7416 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7417 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7418 | /* Subwoofer */ |
| 7419 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7420 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7421 | |
| 7422 | /* enable unsolicited event */ |
| 7423 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7424 | |
| 7425 | { } /* end */ |
| 7426 | }; |
| 7427 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7428 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7429 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7430 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7431 | |
| 7432 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7433 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7434 | |
| 7435 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7436 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7437 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7438 | |
| 7439 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7440 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7441 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7442 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7443 | |
| 7444 | { } /* end */ |
| 7445 | }; |
| 7446 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7447 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7448 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7449 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7450 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7451 | { } /* end */ |
| 7452 | }; |
| 7453 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7454 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7455 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7456 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7457 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7458 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7459 | { } /* end */ |
| 7460 | }; |
| 7461 | |
| 7462 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7463 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7464 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7465 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7466 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7467 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7468 | { } /* end */ |
| 7469 | }; |
| 7470 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7471 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7472 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7473 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7474 | |
| 7475 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7476 | |
| 7477 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7478 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7479 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7480 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7481 | { } /* end */ |
| 7482 | }; |
| 7483 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7484 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7485 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7486 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7487 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7488 | { } |
| 7489 | }; |
| 7490 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7491 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7492 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7493 | { } |
| 7494 | }; |
| 7495 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7496 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7497 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7498 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7499 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7500 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7501 | { } |
| 7502 | }; |
| 7503 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7504 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7505 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7506 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7507 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7508 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7509 | { } |
| 7510 | }; |
| 7511 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7512 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7513 | { 2, alc888_3st_hp_2ch_init }, |
| 7514 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7515 | }; |
| 7516 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7517 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7518 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7519 | { |
| 7520 | unsigned int present; |
| 7521 | |
| 7522 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7523 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7524 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7525 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7526 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7527 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7528 | } |
| 7529 | |
| 7530 | /* toggle RCA according to the front-jack state */ |
| 7531 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7532 | { |
| 7533 | unsigned int present; |
| 7534 | |
| 7535 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7536 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7537 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7538 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7539 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7540 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7541 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7542 | unsigned int res) |
| 7543 | { |
| 7544 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7545 | alc888_lenovo_ms7195_front_automute(codec); |
| 7546 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7547 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7548 | } |
| 7549 | |
| 7550 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7551 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7552 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7553 | |
| 7554 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7555 | |
| 7556 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7557 | { } /* end */ |
| 7558 | }; |
| 7559 | |
| 7560 | /* toggle speaker-output according to the hp-jack state */ |
| 7561 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7562 | { |
| 7563 | unsigned int present; |
| 7564 | |
| 7565 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7566 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7567 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7568 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7569 | } |
| 7570 | |
| 7571 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7572 | unsigned int res) |
| 7573 | { |
| 7574 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7575 | alc883_medion_md2_automute(codec); |
| 7576 | } |
| 7577 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7578 | /* toggle speaker-output according to the hp-jack state */ |
| 7579 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7580 | { |
| 7581 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7582 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7583 | |
| 7584 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7585 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7586 | bits = present ? HDA_AMP_MUTE : 0; |
| 7587 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7588 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7589 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7590 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7591 | } |
| 7592 | |
| 7593 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7594 | { |
| 7595 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7596 | alc883_tagra_automute(codec); |
| 7597 | } |
| 7598 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7599 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7600 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7601 | { |
| 7602 | unsigned int present; |
| 7603 | unsigned char bits; |
| 7604 | |
| 7605 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7606 | & AC_PINSENSE_PRESENCE; |
| 7607 | bits = present ? HDA_AMP_MUTE : 0; |
| 7608 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7609 | HDA_AMP_MUTE, bits); |
| 7610 | } |
| 7611 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7612 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7613 | { |
| 7614 | unsigned int present; |
| 7615 | |
| 7616 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7617 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7618 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7619 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7620 | } |
| 7621 | |
| 7622 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7623 | { |
| 7624 | alc883_clevo_m720_hp_automute(codec); |
| 7625 | alc883_clevo_m720_mic_automute(codec); |
| 7626 | } |
| 7627 | |
| 7628 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7629 | unsigned int res) |
| 7630 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7631 | switch (res >> 26) { |
| 7632 | case ALC880_HP_EVENT: |
| 7633 | alc883_clevo_m720_hp_automute(codec); |
| 7634 | break; |
| 7635 | case ALC880_MIC_EVENT: |
| 7636 | alc883_clevo_m720_mic_automute(codec); |
| 7637 | break; |
| 7638 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7639 | } |
| 7640 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7641 | /* toggle speaker-output according to the hp-jack state */ |
| 7642 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7643 | { |
| 7644 | unsigned int present; |
| 7645 | unsigned char bits; |
| 7646 | |
| 7647 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7648 | & AC_PINSENSE_PRESENCE; |
| 7649 | bits = present ? HDA_AMP_MUTE : 0; |
| 7650 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7651 | HDA_AMP_MUTE, bits); |
| 7652 | } |
| 7653 | |
| 7654 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7655 | unsigned int res) |
| 7656 | { |
| 7657 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7658 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7659 | } |
| 7660 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7661 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7662 | { |
| 7663 | unsigned int present; |
| 7664 | unsigned char bits; |
| 7665 | |
| 7666 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7667 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7668 | bits = present ? 0x80 : 0; |
| 7669 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7670 | 0x80, bits); |
| 7671 | } |
| 7672 | |
| 7673 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7674 | unsigned int res) |
| 7675 | { |
| 7676 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7677 | alc883_haier_w66_automute(codec); |
| 7678 | } |
| 7679 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7680 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7681 | { |
| 7682 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7683 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7684 | |
| 7685 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7686 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7687 | bits = present ? HDA_AMP_MUTE : 0; |
| 7688 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7689 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7690 | } |
| 7691 | |
| 7692 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7693 | { |
| 7694 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7695 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7696 | |
| 7697 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7698 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7699 | bits = present ? HDA_AMP_MUTE : 0; |
| 7700 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7701 | HDA_AMP_MUTE, bits); |
| 7702 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7703 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7704 | } |
| 7705 | |
| 7706 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7707 | unsigned int res) |
| 7708 | { |
| 7709 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7710 | alc883_lenovo_101e_all_automute(codec); |
| 7711 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7712 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7713 | } |
| 7714 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7715 | /* toggle speaker-output according to the hp-jack state */ |
| 7716 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7717 | { |
| 7718 | unsigned int present; |
| 7719 | |
| 7720 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7721 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7722 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7723 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7724 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7725 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7726 | } |
| 7727 | |
| 7728 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7729 | unsigned int res) |
| 7730 | { |
| 7731 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7732 | alc883_acer_aspire_automute(codec); |
| 7733 | } |
| 7734 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7735 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7736 | /* HP Pin: output 0 (0x0c) */ |
| 7737 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7738 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7739 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7740 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7741 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7742 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7743 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7744 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7745 | /* eanable EAPD on medion laptop */ |
| 7746 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7747 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7748 | /* enable unsolicited event */ |
| 7749 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7750 | { } |
| 7751 | }; |
| 7752 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7753 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7754 | { |
| 7755 | unsigned int present; |
| 7756 | |
| 7757 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7758 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7759 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7760 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7761 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7762 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7763 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7764 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7765 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7766 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7767 | } |
| 7768 | |
| 7769 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7770 | unsigned int res) |
| 7771 | { |
| 7772 | switch (res >> 26) { |
| 7773 | case ALC880_HP_EVENT: |
| 7774 | printk("hp_event\n"); |
| 7775 | alc888_6st_dell_front_automute(codec); |
| 7776 | break; |
| 7777 | } |
| 7778 | } |
| 7779 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7780 | /* |
| 7781 | * generic initialization of ADC, input mixers and output mixers |
| 7782 | */ |
| 7783 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7784 | /* |
| 7785 | * Unmute ADC0-2 and set the default input to mic-in |
| 7786 | */ |
| 7787 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7788 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7789 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7790 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7791 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7792 | /* 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] | 7793 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7794 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7795 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7796 | */ |
| 7797 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7798 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7799 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7800 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7801 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7802 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7803 | |
| 7804 | /* |
| 7805 | * Set up output mixers (0x0c - 0x0f) |
| 7806 | */ |
| 7807 | /* set vol=0 to output mixers */ |
| 7808 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7809 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7810 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7811 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7812 | /* set up input amps for analog loopback */ |
| 7813 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7814 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7815 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7816 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7817 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7818 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7819 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7820 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7821 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7822 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7823 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7824 | |
| 7825 | /* FIXME: use matrix-type input source selection */ |
| 7826 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7827 | /* Input mixer1 */ |
| 7828 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7829 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7830 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7831 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7832 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7833 | /* Input mixer2 */ |
| 7834 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7835 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7836 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7837 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7838 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7839 | |
| 7840 | { } |
| 7841 | }; |
| 7842 | |
| 7843 | /* capture mixer elements */ |
| 7844 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7845 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7846 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7847 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7848 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7849 | { |
| 7850 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7851 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7852 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7853 | */ |
| 7854 | /* .name = "Capture Source", */ |
| 7855 | .name = "Input Source", |
| 7856 | .count = 2, |
| 7857 | .info = alc882_mux_enum_info, |
| 7858 | .get = alc882_mux_enum_get, |
| 7859 | .put = alc882_mux_enum_put, |
| 7860 | }, |
| 7861 | { } /* end */ |
| 7862 | }; |
| 7863 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7864 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7865 | #define alc883_loopbacks alc880_loopbacks |
| 7866 | #endif |
| 7867 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7868 | /* pcm configuration: identiacal with ALC880 */ |
| 7869 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7870 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7871 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7872 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7873 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7874 | |
| 7875 | /* |
| 7876 | * configuration and preset |
| 7877 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7878 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7879 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7880 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7881 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7882 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7883 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7884 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7885 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7886 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7887 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7888 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7889 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7890 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7891 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7892 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7893 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7894 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7895 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7896 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7897 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7898 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7899 | [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7900 | [ALC883_AUTO] = "auto", |
| 7901 | }; |
| 7902 | |
| 7903 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7904 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7905 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7906 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7907 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7908 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7909 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7910 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7911 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7912 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 7913 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7914 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Travis Place | 97ec710 | 2008-05-23 18:31:46 +0200 | [diff] [blame] | 7915 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7916 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7917 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7918 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7919 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7920 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7921 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7922 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7923 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7924 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7925 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7926 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7927 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7928 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7929 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7930 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7931 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7932 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7933 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7934 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7935 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7936 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7937 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7938 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7939 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7940 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7941 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7942 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7943 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7944 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 7945 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7946 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7947 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7948 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7949 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7950 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7951 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7952 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7953 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7954 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7955 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7956 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7957 | SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), |
| 7958 | SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7959 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7960 | {} |
| 7961 | }; |
| 7962 | |
| 7963 | static struct alc_config_preset alc883_presets[] = { |
| 7964 | [ALC883_3ST_2ch_DIG] = { |
| 7965 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7966 | .init_verbs = { alc883_init_verbs }, |
| 7967 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7968 | .dac_nids = alc883_dac_nids, |
| 7969 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7970 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7971 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7972 | .channel_mode = alc883_3ST_2ch_modes, |
| 7973 | .input_mux = &alc883_capture_source, |
| 7974 | }, |
| 7975 | [ALC883_3ST_6ch_DIG] = { |
| 7976 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7977 | .init_verbs = { alc883_init_verbs }, |
| 7978 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7979 | .dac_nids = alc883_dac_nids, |
| 7980 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7981 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7982 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7983 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7984 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7985 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7986 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7987 | [ALC883_3ST_6ch] = { |
| 7988 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7989 | .init_verbs = { alc883_init_verbs }, |
| 7990 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7991 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7992 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7993 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7994 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7995 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7996 | }, |
Jiang zhe | 17bba1b | 2008-06-04 12:11:07 +0200 | [diff] [blame] | 7997 | [ALC883_3ST_6ch_INTEL] = { |
| 7998 | .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer }, |
| 7999 | .init_verbs = { alc883_init_verbs }, |
| 8000 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8001 | .dac_nids = alc883_dac_nids, |
| 8002 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8003 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8004 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), |
| 8005 | .channel_mode = alc883_3ST_6ch_intel_modes, |
| 8006 | .need_dac_fix = 1, |
| 8007 | .input_mux = &alc883_3stack_6ch_intel, |
| 8008 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8009 | [ALC883_6ST_DIG] = { |
| 8010 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 8011 | .init_verbs = { alc883_init_verbs }, |
| 8012 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8013 | .dac_nids = alc883_dac_nids, |
| 8014 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8015 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8016 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8017 | .channel_mode = alc883_sixstack_modes, |
| 8018 | .input_mux = &alc883_capture_source, |
| 8019 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8020 | [ALC883_TARGA_DIG] = { |
| 8021 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 8022 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8023 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8024 | .dac_nids = alc883_dac_nids, |
| 8025 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8026 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8027 | .channel_mode = alc883_3ST_6ch_modes, |
| 8028 | .need_dac_fix = 1, |
| 8029 | .input_mux = &alc883_capture_source, |
| 8030 | .unsol_event = alc883_tagra_unsol_event, |
| 8031 | .init_hook = alc883_tagra_automute, |
| 8032 | }, |
| 8033 | [ALC883_TARGA_2ch_DIG] = { |
| 8034 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8035 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 8036 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8037 | .dac_nids = alc883_dac_nids, |
| 8038 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8039 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8040 | .channel_mode = alc883_3ST_2ch_modes, |
| 8041 | .input_mux = &alc883_capture_source, |
| 8042 | .unsol_event = alc883_tagra_unsol_event, |
| 8043 | .init_hook = alc883_tagra_automute, |
| 8044 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8045 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8046 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8047 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 8048 | * and the headphone jack. Turn this on and rely on the |
| 8049 | * standard mute methods whenever the user wants to turn |
| 8050 | * these outputs off. |
| 8051 | */ |
| 8052 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 8053 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8054 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 8055 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8056 | .channel_mode = alc883_3ST_2ch_modes, |
| 8057 | .input_mux = &alc883_capture_source, |
| 8058 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8059 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8060 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8061 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8062 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8063 | .dac_nids = alc883_dac_nids, |
| 8064 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 8065 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8066 | .channel_mode = alc883_3ST_2ch_modes, |
| 8067 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8068 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 8069 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 8070 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8071 | [ALC883_MEDION] = { |
| 8072 | .mixers = { alc883_fivestack_mixer, |
| 8073 | alc883_chmode_mixer }, |
| 8074 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8075 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8076 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8077 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 8078 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8079 | .channel_mode = alc883_sixstack_modes, |
| 8080 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8081 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8082 | [ALC883_MEDION_MD2] = { |
| 8083 | .mixers = { alc883_medion_md2_mixer}, |
| 8084 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 8085 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8086 | .dac_nids = alc883_dac_nids, |
| 8087 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8088 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8089 | .channel_mode = alc883_3ST_2ch_modes, |
| 8090 | .input_mux = &alc883_capture_source, |
| 8091 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8092 | .init_hook = alc883_medion_md2_automute, |
| 8093 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8094 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 8095 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8096 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 8097 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8098 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 8099 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8100 | .channel_mode = alc883_3ST_2ch_modes, |
| 8101 | .input_mux = &alc883_capture_source, |
| 8102 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8103 | [ALC883_CLEVO_M720] = { |
| 8104 | .mixers = { alc883_clevo_m720_mixer }, |
| 8105 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8106 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8107 | .dac_nids = alc883_dac_nids, |
| 8108 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8109 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8110 | .channel_mode = alc883_3ST_2ch_modes, |
| 8111 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 8112 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 8113 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 8114 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8115 | [ALC883_LENOVO_101E_2ch] = { |
| 8116 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 8117 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 8118 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8119 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8120 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8121 | .channel_mode = alc883_3ST_2ch_modes, |
| 8122 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 8123 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 8124 | .init_hook = alc883_lenovo_101e_all_automute, |
| 8125 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8126 | [ALC883_LENOVO_NB0763] = { |
| 8127 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 8128 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 8129 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8130 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8131 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8132 | .channel_mode = alc883_3ST_2ch_modes, |
| 8133 | .need_dac_fix = 1, |
| 8134 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 8135 | .unsol_event = alc883_medion_md2_unsol_event, |
| 8136 | .init_hook = alc883_medion_md2_automute, |
| 8137 | }, |
| 8138 | [ALC888_LENOVO_MS7195_DIG] = { |
| 8139 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 8140 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 8141 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8142 | .dac_nids = alc883_dac_nids, |
| 8143 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8144 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 8145 | .channel_mode = alc883_3ST_6ch_modes, |
| 8146 | .need_dac_fix = 1, |
| 8147 | .input_mux = &alc883_capture_source, |
| 8148 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 8149 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8150 | }, |
| 8151 | [ALC883_HAIER_W66] = { |
| 8152 | .mixers = { alc883_tagra_2ch_mixer}, |
| 8153 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 8154 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8155 | .dac_nids = alc883_dac_nids, |
| 8156 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 8157 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8158 | .channel_mode = alc883_3ST_2ch_modes, |
| 8159 | .input_mux = &alc883_capture_source, |
| 8160 | .unsol_event = alc883_haier_w66_unsol_event, |
| 8161 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8162 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8163 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 8164 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8165 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8166 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8167 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 8168 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 8169 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 8170 | .need_dac_fix = 1, |
| 8171 | .input_mux = &alc883_capture_source, |
| 8172 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8173 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 8174 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8175 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 8176 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8177 | .dac_nids = alc883_dac_nids, |
| 8178 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 8179 | .dig_in_nid = ALC883_DIGIN_NID, |
| 8180 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 8181 | .channel_mode = alc883_sixstack_modes, |
| 8182 | .input_mux = &alc883_capture_source, |
| 8183 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8184 | .init_hook = alc888_6st_dell_front_automute, |
| 8185 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8186 | [ALC883_MITAC] = { |
| 8187 | .mixers = { alc883_mitac_mixer }, |
| 8188 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8189 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8190 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8191 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8192 | .channel_mode = alc883_3ST_2ch_modes, |
| 8193 | .input_mux = &alc883_capture_source, |
| 8194 | .unsol_event = alc883_mitac_unsol_event, |
| 8195 | .init_hook = alc883_mitac_automute, |
| 8196 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8197 | [ALC883_FUJITSU_PI2515] = { |
| 8198 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8199 | .init_verbs = { alc883_init_verbs, |
| 8200 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8201 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8202 | .dac_nids = alc883_dac_nids, |
| 8203 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8204 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8205 | .channel_mode = alc883_3ST_2ch_modes, |
| 8206 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8207 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8208 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8209 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8210 | }; |
| 8211 | |
| 8212 | |
| 8213 | /* |
| 8214 | * BIOS auto configuration |
| 8215 | */ |
| 8216 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8217 | hda_nid_t nid, int pin_type, |
| 8218 | int dac_idx) |
| 8219 | { |
| 8220 | /* set as output */ |
| 8221 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8222 | int idx; |
| 8223 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8224 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8225 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8226 | idx = 4; |
| 8227 | else |
| 8228 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8229 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8230 | |
| 8231 | } |
| 8232 | |
| 8233 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8234 | { |
| 8235 | struct alc_spec *spec = codec->spec; |
| 8236 | int i; |
| 8237 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8238 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8239 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8240 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8241 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8242 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8243 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8244 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8245 | } |
| 8246 | } |
| 8247 | |
| 8248 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8249 | { |
| 8250 | struct alc_spec *spec = codec->spec; |
| 8251 | hda_nid_t pin; |
| 8252 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8253 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8254 | if (pin) /* connect to front */ |
| 8255 | /* use dac 0 */ |
| 8256 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8257 | pin = spec->autocfg.speaker_pins[0]; |
| 8258 | if (pin) |
| 8259 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8260 | } |
| 8261 | |
| 8262 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8263 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8264 | |
| 8265 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8266 | { |
| 8267 | struct alc_spec *spec = codec->spec; |
| 8268 | int i; |
| 8269 | |
| 8270 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8271 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8272 | if (alc883_is_input_pin(nid)) { |
| 8273 | snd_hda_codec_write(codec, nid, 0, |
| 8274 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8275 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8276 | PIN_VREF80 : PIN_IN)); |
| 8277 | if (nid != ALC883_PIN_CD_NID) |
| 8278 | snd_hda_codec_write(codec, nid, 0, |
| 8279 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8280 | AMP_OUT_MUTE); |
| 8281 | } |
| 8282 | } |
| 8283 | } |
| 8284 | |
| 8285 | /* almost identical with ALC880 parser... */ |
| 8286 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8287 | { |
| 8288 | struct alc_spec *spec = codec->spec; |
| 8289 | int err = alc880_parse_auto_config(codec); |
| 8290 | |
| 8291 | if (err < 0) |
| 8292 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8293 | else if (!err) |
| 8294 | return 0; /* no config found */ |
| 8295 | |
| 8296 | err = alc_auto_add_mic_boost(codec); |
| 8297 | if (err < 0) |
| 8298 | return err; |
| 8299 | |
| 8300 | /* hack - override the init verbs */ |
| 8301 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8302 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8303 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8304 | |
| 8305 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8306 | } |
| 8307 | |
| 8308 | /* additional initialization for auto-configuration model */ |
| 8309 | static void alc883_auto_init(struct hda_codec *codec) |
| 8310 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8311 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8312 | alc883_auto_init_multi_out(codec); |
| 8313 | alc883_auto_init_hp_out(codec); |
| 8314 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8315 | if (spec->unsol_event) |
| 8316 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8317 | } |
| 8318 | |
| 8319 | static int patch_alc883(struct hda_codec *codec) |
| 8320 | { |
| 8321 | struct alc_spec *spec; |
| 8322 | int err, board_config; |
| 8323 | |
| 8324 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8325 | if (spec == NULL) |
| 8326 | return -ENOMEM; |
| 8327 | |
| 8328 | codec->spec = spec; |
| 8329 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 8330 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 8331 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8332 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8333 | alc883_models, |
| 8334 | alc883_cfg_tbl); |
| 8335 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8336 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8337 | "trying auto-probe from BIOS...\n"); |
| 8338 | board_config = ALC883_AUTO; |
| 8339 | } |
| 8340 | |
| 8341 | if (board_config == ALC883_AUTO) { |
| 8342 | /* automatic parse from the BIOS config */ |
| 8343 | err = alc883_parse_auto_config(codec); |
| 8344 | if (err < 0) { |
| 8345 | alc_free(codec); |
| 8346 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8347 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8348 | printk(KERN_INFO |
| 8349 | "hda_codec: Cannot set up configuration " |
| 8350 | "from BIOS. Using base mode...\n"); |
| 8351 | board_config = ALC883_3ST_2ch_DIG; |
| 8352 | } |
| 8353 | } |
| 8354 | |
| 8355 | if (board_config != ALC883_AUTO) |
| 8356 | setup_preset(spec, &alc883_presets[board_config]); |
| 8357 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 8358 | switch (codec->vendor_id) { |
| 8359 | case 0x10ec0888: |
| 8360 | spec->stream_name_analog = "ALC888 Analog"; |
| 8361 | spec->stream_name_digital = "ALC888 Digital"; |
| 8362 | break; |
| 8363 | case 0x10ec0889: |
| 8364 | spec->stream_name_analog = "ALC889 Analog"; |
| 8365 | spec->stream_name_digital = "ALC889 Digital"; |
| 8366 | break; |
| 8367 | default: |
| 8368 | spec->stream_name_analog = "ALC883 Analog"; |
| 8369 | spec->stream_name_digital = "ALC883 Digital"; |
| 8370 | break; |
| 8371 | } |
| 8372 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8373 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8374 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8375 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8376 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8377 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8378 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8379 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8380 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8381 | spec->adc_nids = alc883_adc_nids; |
| 8382 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8383 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8384 | spec->vmaster_nid = 0x0c; |
| 8385 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8386 | codec->patch_ops = alc_patch_ops; |
| 8387 | if (board_config == ALC883_AUTO) |
| 8388 | spec->init_hook = alc883_auto_init; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 8389 | else if (codec->vendor_id == 0x10ec0888) |
| 8390 | spec->init_hook = alc888_coef_init; |
| 8391 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8393 | if (!spec->loopback.amplist) |
| 8394 | spec->loopback.amplist = alc883_loopbacks; |
| 8395 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8396 | |
| 8397 | return 0; |
| 8398 | } |
| 8399 | |
| 8400 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8401 | * ALC262 support |
| 8402 | */ |
| 8403 | |
| 8404 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8405 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8406 | |
| 8407 | #define alc262_dac_nids alc260_dac_nids |
| 8408 | #define alc262_adc_nids alc882_adc_nids |
| 8409 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8410 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8411 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8412 | |
| 8413 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8414 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8415 | |
| 8416 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8417 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8418 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8419 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8420 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8421 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8422 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8423 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8424 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8425 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8426 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8427 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8428 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8429 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8430 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8431 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8432 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8433 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8434 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8435 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8436 | }; |
| 8437 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8438 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8439 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8440 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8441 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8442 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8443 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8444 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8445 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8446 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8447 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8448 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8449 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8450 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8451 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8452 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8453 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8454 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8455 | { } /* end */ |
| 8456 | }; |
| 8457 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8458 | /* update HP, line and mono-out pins according to the master switch */ |
| 8459 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8460 | { |
| 8461 | struct alc_spec *spec = codec->spec; |
| 8462 | int val = spec->master_sw; |
| 8463 | |
| 8464 | /* HP & line-out */ |
| 8465 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8466 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8467 | val ? PIN_HP : 0); |
| 8468 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8469 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8470 | val ? PIN_HP : 0); |
| 8471 | /* mono (speaker) depending on the HP jack sense */ |
| 8472 | val = val && !spec->jack_present; |
| 8473 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8474 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8475 | val ? PIN_OUT : 0); |
| 8476 | } |
| 8477 | |
| 8478 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8479 | { |
| 8480 | struct alc_spec *spec = codec->spec; |
| 8481 | unsigned int presence; |
| 8482 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8483 | AC_VERB_GET_PIN_SENSE, 0); |
| 8484 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8485 | alc262_hp_master_update(codec); |
| 8486 | } |
| 8487 | |
| 8488 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8489 | { |
| 8490 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8491 | return; |
| 8492 | alc262_hp_bpc_automute(codec); |
| 8493 | } |
| 8494 | |
| 8495 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8496 | { |
| 8497 | struct alc_spec *spec = codec->spec; |
| 8498 | unsigned int presence; |
| 8499 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8500 | AC_VERB_GET_PIN_SENSE, 0); |
| 8501 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8502 | alc262_hp_master_update(codec); |
| 8503 | } |
| 8504 | |
| 8505 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8506 | unsigned int res) |
| 8507 | { |
| 8508 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8509 | return; |
| 8510 | alc262_hp_wildwest_automute(codec); |
| 8511 | } |
| 8512 | |
| 8513 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8514 | struct snd_ctl_elem_value *ucontrol) |
| 8515 | { |
| 8516 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8517 | struct alc_spec *spec = codec->spec; |
| 8518 | *ucontrol->value.integer.value = spec->master_sw; |
| 8519 | return 0; |
| 8520 | } |
| 8521 | |
| 8522 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8523 | struct snd_ctl_elem_value *ucontrol) |
| 8524 | { |
| 8525 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8526 | struct alc_spec *spec = codec->spec; |
| 8527 | int val = !!*ucontrol->value.integer.value; |
| 8528 | |
| 8529 | if (val == spec->master_sw) |
| 8530 | return 0; |
| 8531 | spec->master_sw = val; |
| 8532 | alc262_hp_master_update(codec); |
| 8533 | return 1; |
| 8534 | } |
| 8535 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8536 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8537 | { |
| 8538 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8539 | .name = "Master Playback Switch", |
| 8540 | .info = snd_ctl_boolean_mono_info, |
| 8541 | .get = alc262_hp_master_sw_get, |
| 8542 | .put = alc262_hp_master_sw_put, |
| 8543 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8544 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8545 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8546 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8547 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8548 | HDA_OUTPUT), |
| 8549 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8550 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8551 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8552 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8553 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8554 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8555 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8556 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8557 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8558 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8559 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8560 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8561 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8562 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8563 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8564 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8565 | { } /* end */ |
| 8566 | }; |
| 8567 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8568 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8569 | { |
| 8570 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8571 | .name = "Master Playback Switch", |
| 8572 | .info = snd_ctl_boolean_mono_info, |
| 8573 | .get = alc262_hp_master_sw_get, |
| 8574 | .put = alc262_hp_master_sw_put, |
| 8575 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8576 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8577 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8578 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8579 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8580 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8581 | HDA_OUTPUT), |
| 8582 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8583 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8584 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8585 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8586 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8587 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8588 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8590 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8591 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8592 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8593 | { } /* end */ |
| 8594 | }; |
| 8595 | |
| 8596 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8597 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8598 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8599 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8600 | { } /* end */ |
| 8601 | }; |
| 8602 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8603 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8604 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8605 | { |
| 8606 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8607 | |
| 8608 | if (force || !spec->sense_updated) { |
| 8609 | unsigned int present; |
| 8610 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8611 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8612 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8613 | spec->sense_updated = 1; |
| 8614 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8615 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8616 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8617 | } |
| 8618 | |
| 8619 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8620 | unsigned int res) |
| 8621 | { |
| 8622 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8623 | return; |
| 8624 | alc262_hp_t5735_automute(codec, 1); |
| 8625 | } |
| 8626 | |
| 8627 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8628 | { |
| 8629 | alc262_hp_t5735_automute(codec, 1); |
| 8630 | } |
| 8631 | |
| 8632 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8633 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8634 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8635 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8636 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8637 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8638 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8639 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8640 | { } /* end */ |
| 8641 | }; |
| 8642 | |
| 8643 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8644 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8645 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8646 | |
| 8647 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8648 | { } |
| 8649 | }; |
| 8650 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8651 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8652 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8653 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8654 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8655 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8656 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8657 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8658 | { } /* end */ |
| 8659 | }; |
| 8660 | |
| 8661 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8662 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8663 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8664 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8665 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8666 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8667 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8668 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8669 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8670 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8671 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8672 | {} |
| 8673 | }; |
| 8674 | |
| 8675 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8676 | .num_items = 1, |
| 8677 | .items = { |
| 8678 | { "Line", 0x1 }, |
| 8679 | }, |
| 8680 | }; |
| 8681 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8682 | /* bind hp and internal speaker mute (with plug check) */ |
| 8683 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8684 | struct snd_ctl_elem_value *ucontrol) |
| 8685 | { |
| 8686 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8687 | long *valp = ucontrol->value.integer.value; |
| 8688 | int change; |
| 8689 | |
| 8690 | /* change hp mute */ |
| 8691 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8692 | HDA_AMP_MUTE, |
| 8693 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8694 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8695 | HDA_AMP_MUTE, |
| 8696 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8697 | if (change) { |
| 8698 | /* change speaker according to HP jack state */ |
| 8699 | struct alc_spec *spec = codec->spec; |
| 8700 | unsigned int mute; |
| 8701 | if (spec->jack_present) |
| 8702 | mute = HDA_AMP_MUTE; |
| 8703 | else |
| 8704 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8705 | HDA_OUTPUT, 0); |
| 8706 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8707 | HDA_AMP_MUTE, mute); |
| 8708 | } |
| 8709 | return change; |
| 8710 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8711 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8712 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8713 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8714 | { |
| 8715 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8716 | .name = "Master Playback Switch", |
| 8717 | .info = snd_hda_mixer_amp_switch_info, |
| 8718 | .get = snd_hda_mixer_amp_switch_get, |
| 8719 | .put = alc262_sony_master_sw_put, |
| 8720 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8721 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8722 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8723 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8724 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8725 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8726 | { } /* end */ |
| 8727 | }; |
| 8728 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8729 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8730 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8731 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8733 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8734 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8735 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8736 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8737 | { } /* end */ |
| 8738 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8739 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8740 | #define alc262_capture_mixer alc882_capture_mixer |
| 8741 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8742 | |
| 8743 | /* |
| 8744 | * generic initialization of ADC, input mixers and output mixers |
| 8745 | */ |
| 8746 | static struct hda_verb alc262_init_verbs[] = { |
| 8747 | /* |
| 8748 | * Unmute ADC0-2 and set the default input to mic-in |
| 8749 | */ |
| 8750 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8751 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8752 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8753 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8754 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8755 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8756 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8757 | /* 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] | 8758 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8759 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8760 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8761 | */ |
| 8762 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8763 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8764 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8765 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8766 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8767 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8768 | |
| 8769 | /* |
| 8770 | * Set up output mixers (0x0c - 0x0e) |
| 8771 | */ |
| 8772 | /* set vol=0 to output mixers */ |
| 8773 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8774 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8775 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8776 | /* set up input amps for analog loopback */ |
| 8777 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8778 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8779 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8780 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8781 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8782 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8783 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8784 | |
| 8785 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8786 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8787 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8788 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8789 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8790 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8791 | |
| 8792 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8794 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8795 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8796 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8797 | |
| 8798 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8799 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8800 | |
| 8801 | /* FIXME: use matrix-type input source selection */ |
| 8802 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8803 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8804 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8805 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8806 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8807 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8808 | /* Input mixer2 */ |
| 8809 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8810 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8811 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8812 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8813 | /* Input mixer3 */ |
| 8814 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8815 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8816 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8817 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8818 | |
| 8819 | { } |
| 8820 | }; |
| 8821 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8822 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8823 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8824 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8825 | {} |
| 8826 | }; |
| 8827 | |
| 8828 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8829 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8830 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8832 | |
| 8833 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8834 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8835 | {} |
| 8836 | }; |
| 8837 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8838 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8839 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8840 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8841 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8842 | |
| 8843 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8844 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame] | 8845 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8846 | }; |
| 8847 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8848 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8849 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8850 | { |
| 8851 | struct alc_spec *spec = codec->spec; |
| 8852 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8853 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8854 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8855 | /* need to execute and sync at first */ |
| 8856 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8857 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8858 | AC_VERB_GET_PIN_SENSE, 0); |
| 8859 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8860 | if (spec->jack_present) { |
| 8861 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8862 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8863 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8864 | } else { |
| 8865 | /* unmute internal speaker if necessary */ |
| 8866 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8867 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8868 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8869 | } |
| 8870 | } |
| 8871 | |
| 8872 | /* unsolicited event for HP jack sensing */ |
| 8873 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8874 | unsigned int res) |
| 8875 | { |
| 8876 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8877 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8878 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8879 | } |
| 8880 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8881 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8882 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8883 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8884 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8885 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8886 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8887 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8888 | AC_VERB_GET_PIN_SENSE, 0); |
| 8889 | present = (present & 0x80000000) != 0; |
| 8890 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8891 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8892 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8893 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8894 | } else { |
| 8895 | /* unmute internal speaker if necessary */ |
| 8896 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8897 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8898 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8899 | } |
| 8900 | } |
| 8901 | |
| 8902 | /* unsolicited event for HP jack sensing */ |
| 8903 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8904 | unsigned int res) |
| 8905 | { |
| 8906 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8907 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8908 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8909 | } |
| 8910 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8911 | /* |
| 8912 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8913 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8914 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8915 | */ |
| 8916 | |
| 8917 | #define ALC_HP_EVENT 0x37 |
| 8918 | |
| 8919 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8920 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8922 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8923 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8924 | {} |
| 8925 | }; |
| 8926 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8927 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8928 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8929 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8930 | {} |
| 8931 | }; |
| 8932 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8933 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8934 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8935 | .items = { |
| 8936 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8937 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8938 | { "CD", 0x4 }, |
| 8939 | }, |
| 8940 | }; |
| 8941 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8942 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8943 | .num_items = 5, |
| 8944 | .items = { |
| 8945 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8946 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8947 | { "Line", 0x2 }, |
| 8948 | { "CD", 0x4 }, |
| 8949 | { "AUX IN", 0x6 }, |
| 8950 | }, |
| 8951 | }; |
| 8952 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8953 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8954 | .num_items = 4, |
| 8955 | .items = { |
| 8956 | { "Mic", 0x0 }, |
| 8957 | { "Front Mic", 0x2 }, |
| 8958 | { "Line", 0x1 }, |
| 8959 | { "CD", 0x4 }, |
| 8960 | }, |
| 8961 | }; |
| 8962 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8963 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8964 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8965 | { |
| 8966 | struct alc_spec *spec = codec->spec; |
| 8967 | unsigned int mute; |
| 8968 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8969 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8970 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8971 | /* need to execute and sync at first */ |
| 8972 | 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] | 8973 | /* check laptop HP jack */ |
| 8974 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8975 | AC_VERB_GET_PIN_SENSE, 0); |
| 8976 | /* need to execute and sync at first */ |
| 8977 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8978 | /* check docking HP jack */ |
| 8979 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 8980 | AC_VERB_GET_PIN_SENSE, 0); |
| 8981 | if (present & AC_PINSENSE_PRESENCE) |
| 8982 | spec->jack_present = 1; |
| 8983 | else |
| 8984 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8985 | spec->sense_updated = 1; |
| 8986 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8987 | /* unmute internal speaker only if both HPs are unplugged and |
| 8988 | * master switch is on |
| 8989 | */ |
| 8990 | if (spec->jack_present) |
| 8991 | mute = HDA_AMP_MUTE; |
| 8992 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8993 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8994 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8995 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8996 | } |
| 8997 | |
| 8998 | /* unsolicited event for HP jack sensing */ |
| 8999 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 9000 | unsigned int res) |
| 9001 | { |
| 9002 | if ((res >> 26) != ALC_HP_EVENT) |
| 9003 | return; |
| 9004 | alc262_fujitsu_automute(codec, 1); |
| 9005 | } |
| 9006 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9007 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 9008 | { |
| 9009 | alc262_fujitsu_automute(codec, 1); |
| 9010 | } |
| 9011 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9012 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9013 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 9014 | .ops = &snd_hda_bind_vol, |
| 9015 | .values = { |
| 9016 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 9017 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 9018 | 0 |
| 9019 | }, |
| 9020 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9021 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9022 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9023 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 9024 | { |
| 9025 | struct alc_spec *spec = codec->spec; |
| 9026 | unsigned int mute; |
| 9027 | |
| 9028 | if (force || !spec->sense_updated) { |
| 9029 | unsigned int present_int_hp; |
| 9030 | /* need to execute and sync at first */ |
| 9031 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9032 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 9033 | AC_VERB_GET_PIN_SENSE, 0); |
| 9034 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 9035 | spec->sense_updated = 1; |
| 9036 | } |
| 9037 | if (spec->jack_present) { |
| 9038 | /* mute internal speaker */ |
| 9039 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9040 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9041 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9042 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 9043 | } else { |
| 9044 | /* unmute internal speaker if necessary */ |
| 9045 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 9046 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9047 | HDA_AMP_MUTE, mute); |
| 9048 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 9049 | HDA_AMP_MUTE, mute); |
| 9050 | } |
| 9051 | } |
| 9052 | |
| 9053 | /* unsolicited event for HP jack sensing */ |
| 9054 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 9055 | unsigned int res) |
| 9056 | { |
| 9057 | if ((res >> 26) != ALC_HP_EVENT) |
| 9058 | return; |
| 9059 | alc262_lenovo_3000_automute(codec, 1); |
| 9060 | } |
| 9061 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9062 | /* bind hp and internal speaker mute (with plug check) */ |
| 9063 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9064 | struct snd_ctl_elem_value *ucontrol) |
| 9065 | { |
| 9066 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9067 | long *valp = ucontrol->value.integer.value; |
| 9068 | int change; |
| 9069 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 9070 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9071 | HDA_AMP_MUTE, |
| 9072 | valp ? 0 : HDA_AMP_MUTE); |
| 9073 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9074 | HDA_AMP_MUTE, |
| 9075 | valp ? 0 : HDA_AMP_MUTE); |
| 9076 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 9077 | if (change) |
| 9078 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9079 | return change; |
| 9080 | } |
| 9081 | |
| 9082 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 9083 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9084 | { |
| 9085 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9086 | .name = "Master Playback Switch", |
| 9087 | .info = snd_hda_mixer_amp_switch_info, |
| 9088 | .get = snd_hda_mixer_amp_switch_get, |
| 9089 | .put = alc262_fujitsu_master_sw_put, |
| 9090 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9091 | }, |
| 9092 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9093 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 9094 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 9095 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9096 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9097 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9098 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9099 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9100 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9101 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9102 | { } /* end */ |
| 9103 | }; |
| 9104 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9105 | /* bind hp and internal speaker mute (with plug check) */ |
| 9106 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9107 | struct snd_ctl_elem_value *ucontrol) |
| 9108 | { |
| 9109 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9110 | long *valp = ucontrol->value.integer.value; |
| 9111 | int change; |
| 9112 | |
| 9113 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 9114 | HDA_AMP_MUTE, |
| 9115 | valp ? 0 : HDA_AMP_MUTE); |
| 9116 | |
| 9117 | if (change) |
| 9118 | alc262_lenovo_3000_automute(codec, 0); |
| 9119 | return change; |
| 9120 | } |
| 9121 | |
| 9122 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 9123 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 9124 | { |
| 9125 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9126 | .name = "Master Playback Switch", |
| 9127 | .info = snd_hda_mixer_amp_switch_info, |
| 9128 | .get = snd_hda_mixer_amp_switch_get, |
| 9129 | .put = alc262_lenovo_3000_master_sw_put, |
| 9130 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 9131 | }, |
| 9132 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 9133 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 9134 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9135 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 9136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 9137 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 9138 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 9139 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 9140 | { } /* end */ |
| 9141 | }; |
| 9142 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9143 | /* additional init verbs for Benq laptops */ |
| 9144 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 9145 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9146 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 9147 | {} |
| 9148 | }; |
| 9149 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9150 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 9151 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9152 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9153 | |
| 9154 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 9155 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 9156 | {} |
| 9157 | }; |
| 9158 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9159 | /* Samsung Q1 Ultra Vista model setup */ |
| 9160 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9161 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 9162 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9163 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 9164 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 9165 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9166 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9167 | { } /* end */ |
| 9168 | }; |
| 9169 | |
| 9170 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9171 | /* output mixer */ |
| 9172 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9173 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9174 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9175 | /* speaker */ |
| 9176 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9177 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9178 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9179 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9180 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9181 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9182 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9183 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9184 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9185 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 9186 | /* internal mic */ |
| 9187 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9188 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9189 | /* ADC, choose mic */ |
| 9190 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9191 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9192 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9193 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9194 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9195 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9196 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9197 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9198 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 9199 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9200 | {} |
| 9201 | }; |
| 9202 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9203 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9204 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9205 | { |
| 9206 | struct alc_spec *spec = codec->spec; |
| 9207 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9208 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9209 | mute = 0; |
| 9210 | /* auto-mute only when HP is used as HP */ |
| 9211 | if (!spec->cur_mux[0]) { |
| 9212 | unsigned int present; |
| 9213 | /* need to execute and sync at first */ |
| 9214 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9215 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9216 | AC_VERB_GET_PIN_SENSE, 0); |
| 9217 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9218 | if (spec->jack_present) |
| 9219 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9220 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9221 | /* mute/unmute internal speaker */ |
| 9222 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9223 | HDA_AMP_MUTE, mute); |
| 9224 | /* mute/unmute HP */ |
| 9225 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9226 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9227 | } |
| 9228 | |
| 9229 | /* unsolicited event for HP jack sensing */ |
| 9230 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9231 | unsigned int res) |
| 9232 | { |
| 9233 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9234 | return; |
| 9235 | alc262_ultra_automute(codec); |
| 9236 | } |
| 9237 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9238 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9239 | .num_items = 2, |
| 9240 | .items = { |
| 9241 | { "Mic", 0x1 }, |
| 9242 | { "Headphone", 0x7 }, |
| 9243 | }, |
| 9244 | }; |
| 9245 | |
| 9246 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9247 | struct snd_ctl_elem_value *ucontrol) |
| 9248 | { |
| 9249 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9250 | struct alc_spec *spec = codec->spec; |
| 9251 | int ret; |
| 9252 | |
| 9253 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9254 | if (!ret) |
| 9255 | return 0; |
| 9256 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9257 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9258 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9259 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9260 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9261 | return ret; |
| 9262 | } |
| 9263 | |
| 9264 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9265 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9266 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9267 | { |
| 9268 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9269 | .name = "Capture Source", |
| 9270 | .info = alc882_mux_enum_info, |
| 9271 | .get = alc882_mux_enum_get, |
| 9272 | .put = alc262_ultra_mux_enum_put, |
| 9273 | }, |
| 9274 | { } /* end */ |
| 9275 | }; |
| 9276 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9277 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9278 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9279 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9280 | { |
| 9281 | hda_nid_t nid; |
| 9282 | int err; |
| 9283 | |
| 9284 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9285 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9286 | spec->multiout.dac_nids[0] = 2; |
| 9287 | |
| 9288 | nid = cfg->line_out_pins[0]; |
| 9289 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9290 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9291 | "Front Playback Volume", |
| 9292 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9293 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9294 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9295 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9296 | "Front Playback Switch", |
| 9297 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9298 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9299 | return err; |
| 9300 | } |
| 9301 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9302 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9303 | if (nid) { |
| 9304 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9305 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9306 | "Speaker Playback Volume", |
| 9307 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9308 | HDA_OUTPUT)); |
| 9309 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9310 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9311 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9312 | "Speaker Playback Switch", |
| 9313 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9314 | HDA_OUTPUT)); |
| 9315 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9316 | return err; |
| 9317 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9318 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9319 | "Speaker Playback Switch", |
| 9320 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9321 | HDA_OUTPUT)); |
| 9322 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9323 | return err; |
| 9324 | } |
| 9325 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9326 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9327 | if (nid) { |
| 9328 | /* spec->multiout.hp_nid = 2; */ |
| 9329 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9330 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9331 | "Headphone Playback Volume", |
| 9332 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9333 | HDA_OUTPUT)); |
| 9334 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9335 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9336 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9337 | "Headphone Playback Switch", |
| 9338 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9339 | HDA_OUTPUT)); |
| 9340 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9341 | return err; |
| 9342 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9343 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9344 | "Headphone Playback Switch", |
| 9345 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9346 | HDA_OUTPUT)); |
| 9347 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9348 | return err; |
| 9349 | } |
| 9350 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9351 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9352 | } |
| 9353 | |
| 9354 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9355 | #define alc262_auto_create_analog_input_ctls \ |
| 9356 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9357 | |
| 9358 | /* |
| 9359 | * generic initialization of ADC, input mixers and output mixers |
| 9360 | */ |
| 9361 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9362 | /* |
| 9363 | * Unmute ADC0-2 and set the default input to mic-in |
| 9364 | */ |
| 9365 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9367 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9368 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9369 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9370 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9371 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9372 | /* 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] | 9373 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9374 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9375 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9376 | */ |
| 9377 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9378 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9379 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9380 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9381 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9382 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9383 | |
| 9384 | /* |
| 9385 | * Set up output mixers (0x0c - 0x0f) |
| 9386 | */ |
| 9387 | /* set vol=0 to output mixers */ |
| 9388 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9389 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9390 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9391 | |
| 9392 | /* set up input amps for analog loopback */ |
| 9393 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9394 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9395 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9396 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9397 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9398 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9399 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9400 | |
| 9401 | /* FIXME: use matrix-type input source selection */ |
| 9402 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9403 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9404 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9405 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9406 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9407 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9408 | /* Input mixer2 */ |
| 9409 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9410 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9411 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9412 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9413 | /* Input mixer3 */ |
| 9414 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9415 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9416 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9417 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9418 | |
| 9419 | { } |
| 9420 | }; |
| 9421 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9422 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9423 | /* |
| 9424 | * Unmute ADC0-2 and set the default input to mic-in |
| 9425 | */ |
| 9426 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9427 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9428 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9429 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9430 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9431 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9432 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9433 | /* 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] | 9434 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9435 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9436 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9437 | */ |
| 9438 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9439 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9440 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9441 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9442 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9443 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9444 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9445 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9446 | |
| 9447 | /* |
| 9448 | * Set up output mixers (0x0c - 0x0e) |
| 9449 | */ |
| 9450 | /* set vol=0 to output mixers */ |
| 9451 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9452 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9453 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9454 | |
| 9455 | /* set up input amps for analog loopback */ |
| 9456 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9463 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9464 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9465 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9466 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9467 | |
| 9468 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9469 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9470 | |
| 9471 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9472 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9473 | |
| 9474 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9475 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9476 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9477 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9478 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9479 | |
| 9480 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9481 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9482 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9483 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9484 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9485 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9486 | |
| 9487 | |
| 9488 | /* FIXME: use matrix-type input source selection */ |
| 9489 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9490 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9491 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9492 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9493 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9494 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9495 | /* Input mixer2 */ |
| 9496 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9497 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9498 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9499 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9500 | /* Input mixer3 */ |
| 9501 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9502 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9503 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9504 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9505 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9506 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9507 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9508 | { } |
| 9509 | }; |
| 9510 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9511 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9512 | /* |
| 9513 | * Unmute ADC0-2 and set the default input to mic-in |
| 9514 | */ |
| 9515 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9516 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9517 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9518 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9519 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9520 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9521 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9522 | /* 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] | 9523 | * mixer widget |
| 9524 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9525 | * panel mic (mic 2) |
| 9526 | */ |
| 9527 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9528 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9529 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9530 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9531 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9532 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9533 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9534 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9535 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9536 | /* |
| 9537 | * Set up output mixers (0x0c - 0x0e) |
| 9538 | */ |
| 9539 | /* set vol=0 to output mixers */ |
| 9540 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9541 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9542 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9543 | |
| 9544 | /* set up input amps for analog loopback */ |
| 9545 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9546 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9547 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9548 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9549 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9550 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9551 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9552 | |
| 9553 | |
| 9554 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9555 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9556 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9557 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9558 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9559 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9560 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9561 | |
| 9562 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9563 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9564 | |
| 9565 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9566 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9567 | |
| 9568 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9569 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9571 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9572 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9573 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9574 | |
| 9575 | /* FIXME: use matrix-type input source selection */ |
| 9576 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9577 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9578 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9579 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9580 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9581 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9582 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9583 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9584 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9585 | /* Input mixer2 */ |
| 9586 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9587 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9588 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9589 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9590 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9591 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9592 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9593 | /* Input mixer3 */ |
| 9594 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9595 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9596 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9597 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9598 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9599 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9600 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9601 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9602 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9603 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9604 | { } |
| 9605 | }; |
| 9606 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9607 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9608 | #define alc262_loopbacks alc880_loopbacks |
| 9609 | #endif |
| 9610 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9611 | /* pcm configuration: identiacal with ALC880 */ |
| 9612 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9613 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9614 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9615 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9616 | |
| 9617 | /* |
| 9618 | * BIOS auto configuration |
| 9619 | */ |
| 9620 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9621 | { |
| 9622 | struct alc_spec *spec = codec->spec; |
| 9623 | int err; |
| 9624 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9625 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9626 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9627 | alc262_ignore); |
| 9628 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9629 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9630 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9631 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9632 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9633 | if (err < 0) |
| 9634 | return err; |
| 9635 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9636 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9637 | return err; |
| 9638 | |
| 9639 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9640 | |
| 9641 | if (spec->autocfg.dig_out_pin) |
| 9642 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9643 | if (spec->autocfg.dig_in_pin) |
| 9644 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9645 | |
| 9646 | if (spec->kctl_alloc) |
| 9647 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9648 | |
| 9649 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9650 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9651 | spec->input_mux = &spec->private_imux; |
| 9652 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9653 | err = alc_auto_add_mic_boost(codec); |
| 9654 | if (err < 0) |
| 9655 | return err; |
| 9656 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9657 | return 1; |
| 9658 | } |
| 9659 | |
| 9660 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9661 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9662 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9663 | |
| 9664 | |
| 9665 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9666 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9667 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9668 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9669 | alc262_auto_init_multi_out(codec); |
| 9670 | alc262_auto_init_hp_out(codec); |
| 9671 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9672 | if (spec->unsol_event) |
| 9673 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9674 | } |
| 9675 | |
| 9676 | /* |
| 9677 | * configuration and preset |
| 9678 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9679 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9680 | [ALC262_BASIC] = "basic", |
| 9681 | [ALC262_HIPPO] = "hippo", |
| 9682 | [ALC262_HIPPO_1] = "hippo_1", |
| 9683 | [ALC262_FUJITSU] = "fujitsu", |
| 9684 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9685 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9686 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9687 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9688 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9689 | [ALC262_BENQ_T31] = "benq-t31", |
| 9690 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9691 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9692 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9693 | [ALC262_AUTO] = "auto", |
| 9694 | }; |
| 9695 | |
| 9696 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9697 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9698 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9699 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9700 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9701 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9702 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9703 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9704 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9705 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9706 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9707 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9708 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9709 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9710 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9711 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9712 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9713 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9714 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9715 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9716 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9717 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9718 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9719 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9720 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9721 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9722 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9723 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9724 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Akio Idehara | 36ca6e1 | 2008-06-09 22:57:40 +0900 | [diff] [blame] | 9725 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
| 9726 | ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9727 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9728 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9729 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9730 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9731 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9732 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9733 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9734 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9735 | {} |
| 9736 | }; |
| 9737 | |
| 9738 | static struct alc_config_preset alc262_presets[] = { |
| 9739 | [ALC262_BASIC] = { |
| 9740 | .mixers = { alc262_base_mixer }, |
| 9741 | .init_verbs = { alc262_init_verbs }, |
| 9742 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9743 | .dac_nids = alc262_dac_nids, |
| 9744 | .hp_nid = 0x03, |
| 9745 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9746 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9747 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9748 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9749 | [ALC262_HIPPO] = { |
| 9750 | .mixers = { alc262_base_mixer }, |
| 9751 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9752 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9753 | .dac_nids = alc262_dac_nids, |
| 9754 | .hp_nid = 0x03, |
| 9755 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9756 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9757 | .channel_mode = alc262_modes, |
| 9758 | .input_mux = &alc262_capture_source, |
| 9759 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9760 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9761 | }, |
| 9762 | [ALC262_HIPPO_1] = { |
| 9763 | .mixers = { alc262_hippo1_mixer }, |
| 9764 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9765 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9766 | .dac_nids = alc262_dac_nids, |
| 9767 | .hp_nid = 0x02, |
| 9768 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9769 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9770 | .channel_mode = alc262_modes, |
| 9771 | .input_mux = &alc262_capture_source, |
| 9772 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9773 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9774 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9775 | [ALC262_FUJITSU] = { |
| 9776 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9777 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9778 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9779 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9780 | .dac_nids = alc262_dac_nids, |
| 9781 | .hp_nid = 0x03, |
| 9782 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9783 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9784 | .channel_mode = alc262_modes, |
| 9785 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9786 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9787 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9788 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9789 | [ALC262_HP_BPC] = { |
| 9790 | .mixers = { alc262_HP_BPC_mixer }, |
| 9791 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9792 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9793 | .dac_nids = alc262_dac_nids, |
| 9794 | .hp_nid = 0x03, |
| 9795 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9796 | .channel_mode = alc262_modes, |
| 9797 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9798 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9799 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9800 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9801 | [ALC262_HP_BPC_D7000_WF] = { |
| 9802 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9803 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9804 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9805 | .dac_nids = alc262_dac_nids, |
| 9806 | .hp_nid = 0x03, |
| 9807 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9808 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9809 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9810 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9811 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9812 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9813 | [ALC262_HP_BPC_D7000_WL] = { |
| 9814 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9815 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9816 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9817 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9818 | .dac_nids = alc262_dac_nids, |
| 9819 | .hp_nid = 0x03, |
| 9820 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9821 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9822 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9823 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9824 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9825 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9826 | [ALC262_HP_TC_T5735] = { |
| 9827 | .mixers = { alc262_hp_t5735_mixer }, |
| 9828 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9829 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9830 | .dac_nids = alc262_dac_nids, |
| 9831 | .hp_nid = 0x03, |
| 9832 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9833 | .channel_mode = alc262_modes, |
| 9834 | .input_mux = &alc262_capture_source, |
| 9835 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9836 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9837 | }, |
| 9838 | [ALC262_HP_RP5700] = { |
| 9839 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9840 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9841 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9842 | .dac_nids = alc262_dac_nids, |
| 9843 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9844 | .channel_mode = alc262_modes, |
| 9845 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9846 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9847 | [ALC262_BENQ_ED8] = { |
| 9848 | .mixers = { alc262_base_mixer }, |
| 9849 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9850 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9851 | .dac_nids = alc262_dac_nids, |
| 9852 | .hp_nid = 0x03, |
| 9853 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9854 | .channel_mode = alc262_modes, |
| 9855 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9856 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9857 | [ALC262_SONY_ASSAMD] = { |
| 9858 | .mixers = { alc262_sony_mixer }, |
| 9859 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9860 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9861 | .dac_nids = alc262_dac_nids, |
| 9862 | .hp_nid = 0x02, |
| 9863 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9864 | .channel_mode = alc262_modes, |
| 9865 | .input_mux = &alc262_capture_source, |
| 9866 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9867 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9868 | }, |
| 9869 | [ALC262_BENQ_T31] = { |
| 9870 | .mixers = { alc262_benq_t31_mixer }, |
| 9871 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9872 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9873 | .dac_nids = alc262_dac_nids, |
| 9874 | .hp_nid = 0x03, |
| 9875 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9876 | .channel_mode = alc262_modes, |
| 9877 | .input_mux = &alc262_capture_source, |
| 9878 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9879 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9880 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9881 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9882 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9883 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9884 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9885 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9886 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9887 | .channel_mode = alc262_modes, |
| 9888 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9889 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9890 | .capsrc_nids = alc262_capsrc_nids, |
| 9891 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9892 | .unsol_event = alc262_ultra_unsol_event, |
| 9893 | .init_hook = alc262_ultra_automute, |
| 9894 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9895 | [ALC262_LENOVO_3000] = { |
| 9896 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9897 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9898 | alc262_lenovo_3000_unsol_verbs }, |
| 9899 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9900 | .dac_nids = alc262_dac_nids, |
| 9901 | .hp_nid = 0x03, |
| 9902 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9903 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9904 | .channel_mode = alc262_modes, |
| 9905 | .input_mux = &alc262_fujitsu_capture_source, |
| 9906 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9907 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9908 | }; |
| 9909 | |
| 9910 | static int patch_alc262(struct hda_codec *codec) |
| 9911 | { |
| 9912 | struct alc_spec *spec; |
| 9913 | int board_config; |
| 9914 | int err; |
| 9915 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9916 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9917 | if (spec == NULL) |
| 9918 | return -ENOMEM; |
| 9919 | |
| 9920 | codec->spec = spec; |
| 9921 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9922 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9923 | * under-run |
| 9924 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9925 | { |
| 9926 | int tmp; |
| 9927 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9928 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9929 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9930 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9931 | } |
| 9932 | #endif |
| 9933 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 9934 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 9935 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9936 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9937 | alc262_models, |
| 9938 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9939 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9940 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9941 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9942 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9943 | board_config = ALC262_AUTO; |
| 9944 | } |
| 9945 | |
| 9946 | if (board_config == ALC262_AUTO) { |
| 9947 | /* automatic parse from the BIOS config */ |
| 9948 | err = alc262_parse_auto_config(codec); |
| 9949 | if (err < 0) { |
| 9950 | alc_free(codec); |
| 9951 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9952 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9953 | printk(KERN_INFO |
| 9954 | "hda_codec: Cannot set up configuration " |
| 9955 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9956 | board_config = ALC262_BASIC; |
| 9957 | } |
| 9958 | } |
| 9959 | |
| 9960 | if (board_config != ALC262_AUTO) |
| 9961 | setup_preset(spec, &alc262_presets[board_config]); |
| 9962 | |
| 9963 | spec->stream_name_analog = "ALC262 Analog"; |
| 9964 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9965 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9966 | |
| 9967 | spec->stream_name_digital = "ALC262 Digital"; |
| 9968 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9969 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9970 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9971 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9972 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9973 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9974 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9975 | /* get type */ |
| 9976 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9977 | if (wcap != AC_WID_AUD_IN) { |
| 9978 | spec->adc_nids = alc262_adc_nids_alt; |
| 9979 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9980 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9981 | spec->mixers[spec->num_mixers] = |
| 9982 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9983 | spec->num_mixers++; |
| 9984 | } else { |
| 9985 | spec->adc_nids = alc262_adc_nids; |
| 9986 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9987 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9988 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9989 | spec->num_mixers++; |
| 9990 | } |
| 9991 | } |
| 9992 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9993 | spec->vmaster_nid = 0x0c; |
| 9994 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9995 | codec->patch_ops = alc_patch_ops; |
| 9996 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9997 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9998 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9999 | if (!spec->loopback.amplist) |
| 10000 | spec->loopback.amplist = alc262_loopbacks; |
| 10001 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 10002 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10003 | return 0; |
| 10004 | } |
| 10005 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10006 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10007 | * ALC268 channel source setting (2 channel) |
| 10008 | */ |
| 10009 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 10010 | #define alc268_modes alc260_modes |
| 10011 | |
| 10012 | static hda_nid_t alc268_dac_nids[2] = { |
| 10013 | /* front, hp */ |
| 10014 | 0x02, 0x03 |
| 10015 | }; |
| 10016 | |
| 10017 | static hda_nid_t alc268_adc_nids[2] = { |
| 10018 | /* ADC0-1 */ |
| 10019 | 0x08, 0x07 |
| 10020 | }; |
| 10021 | |
| 10022 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 10023 | /* ADC0 */ |
| 10024 | 0x08 |
| 10025 | }; |
| 10026 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10027 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 10028 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10029 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 10030 | /* output mixer control */ |
| 10031 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10032 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10033 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10034 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10035 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10036 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10037 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10038 | { } |
| 10039 | }; |
| 10040 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10041 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 10042 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 10043 | .ops = &snd_hda_bind_sw, |
| 10044 | .values = { |
| 10045 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 10046 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 10047 | 0 |
| 10048 | }, |
| 10049 | }; |
| 10050 | |
| 10051 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 10052 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 10053 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 10054 | { } |
| 10055 | }; |
| 10056 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10057 | static struct hda_verb alc268_eapd_verbs[] = { |
| 10058 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10059 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10060 | { } |
| 10061 | }; |
| 10062 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10063 | /* Toshiba specific */ |
| 10064 | #define alc268_toshiba_automute alc262_hippo_automute |
| 10065 | |
| 10066 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 10067 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10068 | { } /* end */ |
| 10069 | }; |
| 10070 | |
| 10071 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10072 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 10073 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 10074 | .ops = &snd_hda_bind_vol, |
| 10075 | .values = { |
| 10076 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 10077 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 10078 | 0 |
| 10079 | }, |
| 10080 | }; |
| 10081 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10082 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10083 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 10084 | { |
| 10085 | struct alc_spec *spec = codec->spec; |
| 10086 | unsigned int mute; |
| 10087 | |
| 10088 | if (force || !spec->sense_updated) { |
| 10089 | unsigned int present; |
| 10090 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 10091 | AC_VERB_GET_PIN_SENSE, 0); |
| 10092 | spec->jack_present = (present & 0x80000000) != 0; |
| 10093 | spec->sense_updated = 1; |
| 10094 | } |
| 10095 | if (spec->jack_present) |
| 10096 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 10097 | else /* unmute internal speaker if necessary */ |
| 10098 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 10099 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 10100 | HDA_AMP_MUTE, mute); |
| 10101 | } |
| 10102 | |
| 10103 | |
| 10104 | /* bind hp and internal speaker mute (with plug check) */ |
| 10105 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 10106 | struct snd_ctl_elem_value *ucontrol) |
| 10107 | { |
| 10108 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 10109 | long *valp = ucontrol->value.integer.value; |
| 10110 | int change; |
| 10111 | |
| 10112 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 10113 | HDA_AMP_MUTE, |
| 10114 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 10115 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 10116 | HDA_AMP_MUTE, |
| 10117 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 10118 | if (change) |
| 10119 | alc268_acer_automute(codec, 0); |
| 10120 | return change; |
| 10121 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10122 | |
| 10123 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 10124 | /* output mixer control */ |
| 10125 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 10126 | { |
| 10127 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10128 | .name = "Master Playback Switch", |
| 10129 | .info = snd_hda_mixer_amp_switch_info, |
| 10130 | .get = snd_hda_mixer_amp_switch_get, |
| 10131 | .put = alc268_acer_master_sw_put, |
| 10132 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 10133 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 10134 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10135 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10136 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10137 | { } |
| 10138 | }; |
| 10139 | |
| 10140 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10141 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 10142 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10143 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10144 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10145 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10146 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10147 | |
| 10148 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10149 | { } |
| 10150 | }; |
| 10151 | |
| 10152 | /* unsolicited event for HP jack sensing */ |
| 10153 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 10154 | unsigned int res) |
| 10155 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10156 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10157 | return; |
| 10158 | alc268_toshiba_automute(codec); |
| 10159 | } |
| 10160 | |
| 10161 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 10162 | unsigned int res) |
| 10163 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10164 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10165 | return; |
| 10166 | alc268_acer_automute(codec, 1); |
| 10167 | } |
| 10168 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10169 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 10170 | { |
| 10171 | alc268_acer_automute(codec, 1); |
| 10172 | } |
| 10173 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10174 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 10175 | /* output mixer control */ |
| 10176 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10177 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10178 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10179 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10180 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10181 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 10182 | { } |
| 10183 | }; |
| 10184 | |
| 10185 | static struct hda_verb alc268_dell_verbs[] = { |
| 10186 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10187 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10188 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10189 | { } |
| 10190 | }; |
| 10191 | |
| 10192 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 10193 | static void alc268_dell_automute(struct hda_codec *codec) |
| 10194 | { |
| 10195 | unsigned int present; |
| 10196 | unsigned int mute; |
| 10197 | |
| 10198 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 10199 | if (present & 0x80000000) |
| 10200 | mute = HDA_AMP_MUTE; |
| 10201 | else |
| 10202 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 10203 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10204 | HDA_AMP_MUTE, mute); |
| 10205 | } |
| 10206 | |
| 10207 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10208 | unsigned int res) |
| 10209 | { |
| 10210 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10211 | return; |
| 10212 | alc268_dell_automute(codec); |
| 10213 | } |
| 10214 | |
| 10215 | #define alc268_dell_init_hook alc268_dell_automute |
| 10216 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10217 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10218 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10219 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10220 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10221 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10222 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10223 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10224 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10225 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10226 | { } |
| 10227 | }; |
| 10228 | |
| 10229 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10230 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10231 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10232 | { } |
| 10233 | }; |
| 10234 | |
| 10235 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10236 | { |
| 10237 | unsigned int present; |
| 10238 | |
| 10239 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10240 | & AC_PINSENSE_PRESENCE; |
| 10241 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10242 | present ? 0 : PIN_OUT); |
| 10243 | } |
| 10244 | |
| 10245 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10246 | { |
| 10247 | unsigned int present; |
| 10248 | |
| 10249 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10250 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10251 | snd_hda_codec_write(codec, 0x23, 0, |
| 10252 | AC_VERB_SET_CONNECT_SEL, |
| 10253 | present ? 0x00 : 0x01); |
| 10254 | } |
| 10255 | |
| 10256 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10257 | { |
| 10258 | alc267_quanta_il1_hp_automute(codec); |
| 10259 | alc267_quanta_il1_mic_automute(codec); |
| 10260 | } |
| 10261 | |
| 10262 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10263 | unsigned int res) |
| 10264 | { |
| 10265 | switch (res >> 26) { |
| 10266 | case ALC880_HP_EVENT: |
| 10267 | alc267_quanta_il1_hp_automute(codec); |
| 10268 | break; |
| 10269 | case ALC880_MIC_EVENT: |
| 10270 | alc267_quanta_il1_mic_automute(codec); |
| 10271 | break; |
| 10272 | } |
| 10273 | } |
| 10274 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10275 | /* |
| 10276 | * generic initialization of ADC, input mixers and output mixers |
| 10277 | */ |
| 10278 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10279 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10280 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10281 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10282 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10283 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10284 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10285 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10286 | |
| 10287 | /* |
| 10288 | * Set up output mixers (0x0c - 0x0e) |
| 10289 | */ |
| 10290 | /* set vol=0 to output mixers */ |
| 10291 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10292 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10293 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10294 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10295 | |
| 10296 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10297 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10298 | |
| 10299 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10300 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10301 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10302 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10303 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10304 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10305 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10306 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10307 | |
| 10308 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10309 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10310 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10311 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10312 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10313 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10314 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10315 | |
| 10316 | /* set PCBEEP vol = 0, mute connections */ |
| 10317 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10318 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10319 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10320 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10321 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10322 | |
| 10323 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10324 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10325 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10326 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10327 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10328 | { } |
| 10329 | }; |
| 10330 | |
| 10331 | /* |
| 10332 | * generic initialization of ADC, input mixers and output mixers |
| 10333 | */ |
| 10334 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10335 | /* set output DAC */ |
| 10336 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10337 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10338 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10339 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10340 | |
| 10341 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10342 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10343 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10344 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10345 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10346 | |
| 10347 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10348 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10349 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10351 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10352 | |
| 10353 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10354 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10355 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10356 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10357 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10358 | /* set PCBEEP vol = 0, mute connections */ |
| 10359 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10360 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10361 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10362 | |
| 10363 | { } |
| 10364 | }; |
| 10365 | |
| 10366 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10367 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10368 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10369 | |
| 10370 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10371 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10372 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10373 | { |
| 10374 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10375 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10376 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10377 | */ |
| 10378 | /* .name = "Capture Source", */ |
| 10379 | .name = "Input Source", |
| 10380 | .count = 1, |
| 10381 | .info = alc268_mux_enum_info, |
| 10382 | .get = alc268_mux_enum_get, |
| 10383 | .put = alc268_mux_enum_put, |
| 10384 | }, |
| 10385 | { } /* end */ |
| 10386 | }; |
| 10387 | |
| 10388 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10389 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10390 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10391 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10392 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10393 | { |
| 10394 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10395 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10396 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10397 | */ |
| 10398 | /* .name = "Capture Source", */ |
| 10399 | .name = "Input Source", |
| 10400 | .count = 2, |
| 10401 | .info = alc268_mux_enum_info, |
| 10402 | .get = alc268_mux_enum_get, |
| 10403 | .put = alc268_mux_enum_put, |
| 10404 | }, |
| 10405 | { } /* end */ |
| 10406 | }; |
| 10407 | |
| 10408 | static struct hda_input_mux alc268_capture_source = { |
| 10409 | .num_items = 4, |
| 10410 | .items = { |
| 10411 | { "Mic", 0x0 }, |
| 10412 | { "Front Mic", 0x1 }, |
| 10413 | { "Line", 0x2 }, |
| 10414 | { "CD", 0x3 }, |
| 10415 | }, |
| 10416 | }; |
| 10417 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10418 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10419 | .num_items = 3, |
| 10420 | .items = { |
| 10421 | { "Mic", 0x0 }, |
| 10422 | { "Internal Mic", 0x6 }, |
| 10423 | { "Line", 0x2 }, |
| 10424 | }, |
| 10425 | }; |
| 10426 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10427 | #ifdef CONFIG_SND_DEBUG |
| 10428 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10429 | /* Volume widgets */ |
| 10430 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10431 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10432 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10433 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10434 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10435 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10436 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10437 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10438 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10439 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10440 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10441 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10442 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10443 | /* The below appears problematic on some hardwares */ |
| 10444 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10445 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10446 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10447 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10448 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10449 | |
| 10450 | /* Modes for retasking pin widgets */ |
| 10451 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10452 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10453 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10454 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10455 | |
| 10456 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10457 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10458 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10459 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10460 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10461 | |
| 10462 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10463 | * The ALC268 does not have an SPDIF input. |
| 10464 | */ |
| 10465 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10466 | |
| 10467 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10468 | * this output to turn on an external amplifier. |
| 10469 | */ |
| 10470 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10471 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10472 | |
| 10473 | { } /* end */ |
| 10474 | }; |
| 10475 | #endif |
| 10476 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10477 | /* create input playback/capture controls for the given pin */ |
| 10478 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10479 | const char *ctlname, int idx) |
| 10480 | { |
| 10481 | char name[32]; |
| 10482 | int err; |
| 10483 | |
| 10484 | sprintf(name, "%s Playback Volume", ctlname); |
| 10485 | if (nid == 0x14) { |
| 10486 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10487 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10488 | HDA_OUTPUT)); |
| 10489 | if (err < 0) |
| 10490 | return err; |
| 10491 | } else if (nid == 0x15) { |
| 10492 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10493 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10494 | HDA_OUTPUT)); |
| 10495 | if (err < 0) |
| 10496 | return err; |
| 10497 | } else |
| 10498 | return -1; |
| 10499 | sprintf(name, "%s Playback Switch", ctlname); |
| 10500 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10501 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10502 | if (err < 0) |
| 10503 | return err; |
| 10504 | return 0; |
| 10505 | } |
| 10506 | |
| 10507 | /* add playback controls from the parsed DAC table */ |
| 10508 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10509 | const struct auto_pin_cfg *cfg) |
| 10510 | { |
| 10511 | hda_nid_t nid; |
| 10512 | int err; |
| 10513 | |
| 10514 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10515 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10516 | spec->multiout.dac_nids[0] = 2; |
| 10517 | spec->multiout.dac_nids[1] = 3; |
| 10518 | |
| 10519 | nid = cfg->line_out_pins[0]; |
| 10520 | if (nid) |
| 10521 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10522 | |
| 10523 | nid = cfg->speaker_pins[0]; |
| 10524 | if (nid == 0x1d) { |
| 10525 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10526 | "Speaker Playback Volume", |
| 10527 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10528 | if (err < 0) |
| 10529 | return err; |
| 10530 | } |
| 10531 | nid = cfg->hp_pins[0]; |
| 10532 | if (nid) |
| 10533 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10534 | |
| 10535 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10536 | if (nid == 0x16) { |
| 10537 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10538 | "Mono Playback Switch", |
| 10539 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10540 | if (err < 0) |
| 10541 | return err; |
| 10542 | } |
| 10543 | return 0; |
| 10544 | } |
| 10545 | |
| 10546 | /* create playback/capture controls for input pins */ |
| 10547 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10548 | const struct auto_pin_cfg *cfg) |
| 10549 | { |
| 10550 | struct hda_input_mux *imux = &spec->private_imux; |
| 10551 | int i, idx1; |
| 10552 | |
| 10553 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10554 | switch(cfg->input_pins[i]) { |
| 10555 | case 0x18: |
| 10556 | idx1 = 0; /* Mic 1 */ |
| 10557 | break; |
| 10558 | case 0x19: |
| 10559 | idx1 = 1; /* Mic 2 */ |
| 10560 | break; |
| 10561 | case 0x1a: |
| 10562 | idx1 = 2; /* Line In */ |
| 10563 | break; |
| 10564 | case 0x1c: |
| 10565 | idx1 = 3; /* CD */ |
| 10566 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10567 | case 0x12: |
| 10568 | case 0x13: |
| 10569 | idx1 = 6; /* digital mics */ |
| 10570 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10571 | default: |
| 10572 | continue; |
| 10573 | } |
| 10574 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10575 | imux->items[imux->num_items].index = idx1; |
| 10576 | imux->num_items++; |
| 10577 | } |
| 10578 | return 0; |
| 10579 | } |
| 10580 | |
| 10581 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10582 | { |
| 10583 | struct alc_spec *spec = codec->spec; |
| 10584 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10585 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10586 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10587 | unsigned int dac_vol1, dac_vol2; |
| 10588 | |
| 10589 | if (speaker_nid) { |
| 10590 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10591 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10592 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10593 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10594 | AMP_IN_UNMUTE(1)); |
| 10595 | snd_hda_codec_write(codec, 0x10, 0, |
| 10596 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10597 | AMP_IN_UNMUTE(1)); |
| 10598 | } else { |
| 10599 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10600 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10601 | snd_hda_codec_write(codec, 0x10, 0, |
| 10602 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10603 | } |
| 10604 | |
| 10605 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10606 | if (line_nid == 0x14) |
| 10607 | dac_vol2 = AMP_OUT_ZERO; |
| 10608 | else if (line_nid == 0x15) |
| 10609 | dac_vol1 = AMP_OUT_ZERO; |
| 10610 | if (hp_nid == 0x14) |
| 10611 | dac_vol2 = AMP_OUT_ZERO; |
| 10612 | else if (hp_nid == 0x15) |
| 10613 | dac_vol1 = AMP_OUT_ZERO; |
| 10614 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10615 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10616 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10617 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10618 | |
| 10619 | snd_hda_codec_write(codec, 0x02, 0, |
| 10620 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10621 | snd_hda_codec_write(codec, 0x03, 0, |
| 10622 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10623 | } |
| 10624 | |
| 10625 | /* pcm configuration: identiacal with ALC880 */ |
| 10626 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10627 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10628 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10629 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10630 | |
| 10631 | /* |
| 10632 | * BIOS auto configuration |
| 10633 | */ |
| 10634 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10635 | { |
| 10636 | struct alc_spec *spec = codec->spec; |
| 10637 | int err; |
| 10638 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10639 | |
| 10640 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10641 | alc268_ignore); |
| 10642 | if (err < 0) |
| 10643 | return err; |
| 10644 | if (!spec->autocfg.line_outs) |
| 10645 | return 0; /* can't find valid BIOS pin config */ |
| 10646 | |
| 10647 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10648 | if (err < 0) |
| 10649 | return err; |
| 10650 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10651 | if (err < 0) |
| 10652 | return err; |
| 10653 | |
| 10654 | spec->multiout.max_channels = 2; |
| 10655 | |
| 10656 | /* digital only support output */ |
| 10657 | if (spec->autocfg.dig_out_pin) |
| 10658 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10659 | |
| 10660 | if (spec->kctl_alloc) |
| 10661 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10662 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10663 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10664 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10665 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10666 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10667 | spec->num_mux_defs = 1; |
| 10668 | spec->input_mux = &spec->private_imux; |
| 10669 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10670 | err = alc_auto_add_mic_boost(codec); |
| 10671 | if (err < 0) |
| 10672 | return err; |
| 10673 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10674 | return 1; |
| 10675 | } |
| 10676 | |
| 10677 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10678 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10679 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10680 | |
| 10681 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10682 | static void alc268_auto_init(struct hda_codec *codec) |
| 10683 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10684 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10685 | alc268_auto_init_multi_out(codec); |
| 10686 | alc268_auto_init_hp_out(codec); |
| 10687 | alc268_auto_init_mono_speaker_out(codec); |
| 10688 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10689 | if (spec->unsol_event) |
| 10690 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10691 | } |
| 10692 | |
| 10693 | /* |
| 10694 | * configuration and preset |
| 10695 | */ |
| 10696 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10697 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10698 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10699 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10700 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10701 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10702 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10703 | #ifdef CONFIG_SND_DEBUG |
| 10704 | [ALC268_TEST] = "test", |
| 10705 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10706 | [ALC268_AUTO] = "auto", |
| 10707 | }; |
| 10708 | |
| 10709 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10710 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10711 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10712 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10713 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10714 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10715 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10716 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10717 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10718 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10719 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 10720 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10721 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10722 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10723 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10724 | {} |
| 10725 | }; |
| 10726 | |
| 10727 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10728 | [ALC267_QUANTA_IL1] = { |
| 10729 | .mixers = { alc267_quanta_il1_mixer }, |
| 10730 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10731 | alc267_quanta_il1_verbs }, |
| 10732 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10733 | .dac_nids = alc268_dac_nids, |
| 10734 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10735 | .adc_nids = alc268_adc_nids_alt, |
| 10736 | .hp_nid = 0x03, |
| 10737 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10738 | .channel_mode = alc268_modes, |
| 10739 | .input_mux = &alc268_capture_source, |
| 10740 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 10741 | .init_hook = alc267_quanta_il1_automute, |
| 10742 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10743 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10744 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10745 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10746 | .init_verbs = { alc268_base_init_verbs }, |
| 10747 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10748 | .dac_nids = alc268_dac_nids, |
| 10749 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10750 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10751 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10752 | .hp_nid = 0x03, |
| 10753 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10754 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10755 | .channel_mode = alc268_modes, |
| 10756 | .input_mux = &alc268_capture_source, |
| 10757 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10758 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10759 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10760 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10761 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10762 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10763 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10764 | .dac_nids = alc268_dac_nids, |
| 10765 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10766 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10767 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10768 | .hp_nid = 0x03, |
| 10769 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10770 | .channel_mode = alc268_modes, |
| 10771 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10772 | .unsol_event = alc268_toshiba_unsol_event, |
| 10773 | .init_hook = alc268_toshiba_automute, |
| 10774 | }, |
| 10775 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10776 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10777 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10778 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10779 | alc268_acer_verbs }, |
| 10780 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10781 | .dac_nids = alc268_dac_nids, |
| 10782 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10783 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10784 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10785 | .hp_nid = 0x02, |
| 10786 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10787 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10788 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10789 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10790 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10791 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10792 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10793 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10794 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10795 | alc268_dell_verbs }, |
| 10796 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10797 | .dac_nids = alc268_dac_nids, |
| 10798 | .hp_nid = 0x02, |
| 10799 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10800 | .channel_mode = alc268_modes, |
| 10801 | .unsol_event = alc268_dell_unsol_event, |
| 10802 | .init_hook = alc268_dell_init_hook, |
| 10803 | .input_mux = &alc268_capture_source, |
| 10804 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10805 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10806 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10807 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10808 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10809 | alc268_toshiba_verbs }, |
| 10810 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10811 | .dac_nids = alc268_dac_nids, |
| 10812 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10813 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10814 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10815 | .hp_nid = 0x03, |
| 10816 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10817 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10818 | .channel_mode = alc268_modes, |
| 10819 | .input_mux = &alc268_capture_source, |
| 10820 | .unsol_event = alc268_toshiba_unsol_event, |
| 10821 | .init_hook = alc268_toshiba_automute |
| 10822 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10823 | #ifdef CONFIG_SND_DEBUG |
| 10824 | [ALC268_TEST] = { |
| 10825 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10826 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10827 | alc268_volume_init_verbs }, |
| 10828 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10829 | .dac_nids = alc268_dac_nids, |
| 10830 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10831 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10832 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10833 | .hp_nid = 0x03, |
| 10834 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10835 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10836 | .channel_mode = alc268_modes, |
| 10837 | .input_mux = &alc268_capture_source, |
| 10838 | }, |
| 10839 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10840 | }; |
| 10841 | |
| 10842 | static int patch_alc268(struct hda_codec *codec) |
| 10843 | { |
| 10844 | struct alc_spec *spec; |
| 10845 | int board_config; |
| 10846 | int err; |
| 10847 | |
| 10848 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10849 | if (spec == NULL) |
| 10850 | return -ENOMEM; |
| 10851 | |
| 10852 | codec->spec = spec; |
| 10853 | |
| 10854 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10855 | alc268_models, |
| 10856 | alc268_cfg_tbl); |
| 10857 | |
| 10858 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10859 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10860 | "trying auto-probe from BIOS...\n"); |
| 10861 | board_config = ALC268_AUTO; |
| 10862 | } |
| 10863 | |
| 10864 | if (board_config == ALC268_AUTO) { |
| 10865 | /* automatic parse from the BIOS config */ |
| 10866 | err = alc268_parse_auto_config(codec); |
| 10867 | if (err < 0) { |
| 10868 | alc_free(codec); |
| 10869 | return err; |
| 10870 | } else if (!err) { |
| 10871 | printk(KERN_INFO |
| 10872 | "hda_codec: Cannot set up configuration " |
| 10873 | "from BIOS. Using base mode...\n"); |
| 10874 | board_config = ALC268_3ST; |
| 10875 | } |
| 10876 | } |
| 10877 | |
| 10878 | if (board_config != ALC268_AUTO) |
| 10879 | setup_preset(spec, &alc268_presets[board_config]); |
| 10880 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 10881 | if (codec->vendor_id == 0x10ec0267) { |
| 10882 | spec->stream_name_analog = "ALC267 Analog"; |
| 10883 | spec->stream_name_digital = "ALC267 Digital"; |
| 10884 | } else { |
| 10885 | spec->stream_name_analog = "ALC268 Analog"; |
| 10886 | spec->stream_name_digital = "ALC268 Digital"; |
| 10887 | } |
| 10888 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10889 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10890 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10891 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10892 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10893 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10894 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10895 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10896 | /* override the amp caps for beep generator */ |
| 10897 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10898 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10899 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10900 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10901 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10902 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10903 | if (!spec->adc_nids && spec->input_mux) { |
| 10904 | /* check whether NID 0x07 is valid */ |
| 10905 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10906 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10907 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10908 | /* get type */ |
| 10909 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10910 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10911 | spec->adc_nids = alc268_adc_nids_alt; |
| 10912 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10913 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10914 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10915 | spec->num_mixers++; |
| 10916 | } else { |
| 10917 | spec->adc_nids = alc268_adc_nids; |
| 10918 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10919 | spec->mixers[spec->num_mixers] = |
| 10920 | alc268_capture_mixer; |
| 10921 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10922 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10923 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10924 | /* set default input source */ |
| 10925 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10926 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10927 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10928 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10929 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10930 | |
| 10931 | spec->vmaster_nid = 0x02; |
| 10932 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10933 | codec->patch_ops = alc_patch_ops; |
| 10934 | if (board_config == ALC268_AUTO) |
| 10935 | spec->init_hook = alc268_auto_init; |
| 10936 | |
| 10937 | return 0; |
| 10938 | } |
| 10939 | |
| 10940 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10941 | * ALC269 channel source setting (2 channel) |
| 10942 | */ |
| 10943 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10944 | |
| 10945 | #define alc269_dac_nids alc260_dac_nids |
| 10946 | |
| 10947 | static hda_nid_t alc269_adc_nids[1] = { |
| 10948 | /* ADC1 */ |
| 10949 | 0x07, |
| 10950 | }; |
| 10951 | |
| 10952 | #define alc269_modes alc260_modes |
| 10953 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10954 | |
| 10955 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10957 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10958 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10959 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10962 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10963 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10964 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10965 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10966 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10967 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10968 | { } /* end */ |
| 10969 | }; |
| 10970 | |
| 10971 | /* capture mixer elements */ |
| 10972 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10973 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10974 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10975 | { |
| 10976 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10977 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10978 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10979 | */ |
| 10980 | /* .name = "Capture Source", */ |
| 10981 | .name = "Input Source", |
| 10982 | .count = 1, |
| 10983 | .info = alc_mux_enum_info, |
| 10984 | .get = alc_mux_enum_get, |
| 10985 | .put = alc_mux_enum_put, |
| 10986 | }, |
| 10987 | { } /* end */ |
| 10988 | }; |
| 10989 | |
| 10990 | /* |
| 10991 | * generic initialization of ADC, input mixers and output mixers |
| 10992 | */ |
| 10993 | static struct hda_verb alc269_init_verbs[] = { |
| 10994 | /* |
| 10995 | * Unmute ADC0 and set the default input to mic-in |
| 10996 | */ |
| 10997 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10998 | |
| 10999 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 11000 | * analog-loopback mixer widget |
| 11001 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 11002 | * front panel mic (mic 2) |
| 11003 | */ |
| 11004 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 11005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11008 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11009 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 11010 | |
| 11011 | /* |
| 11012 | * Set up output mixers (0x0c - 0x0e) |
| 11013 | */ |
| 11014 | /* set vol=0 to output mixers */ |
| 11015 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11016 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11017 | |
| 11018 | /* set up input amps for analog loopback */ |
| 11019 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11021 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11023 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11025 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11026 | |
| 11027 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11028 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11029 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11030 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11031 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11032 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11033 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11034 | |
| 11035 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11036 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11038 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11039 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11040 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11041 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11042 | |
| 11043 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11044 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11045 | |
| 11046 | /* FIXME: use matrix-type input source selection */ |
| 11047 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 11048 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 11049 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11050 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11051 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11052 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11053 | |
| 11054 | /* set EAPD */ |
| 11055 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11056 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11057 | { } |
| 11058 | }; |
| 11059 | |
| 11060 | /* add playback controls from the parsed DAC table */ |
| 11061 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11062 | const struct auto_pin_cfg *cfg) |
| 11063 | { |
| 11064 | hda_nid_t nid; |
| 11065 | int err; |
| 11066 | |
| 11067 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 11068 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11069 | spec->multiout.dac_nids[0] = 2; |
| 11070 | |
| 11071 | nid = cfg->line_out_pins[0]; |
| 11072 | if (nid) { |
| 11073 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11074 | "Front Playback Volume", |
| 11075 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 11076 | if (err < 0) |
| 11077 | return err; |
| 11078 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11079 | "Front Playback Switch", |
| 11080 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11081 | if (err < 0) |
| 11082 | return err; |
| 11083 | } |
| 11084 | |
| 11085 | nid = cfg->speaker_pins[0]; |
| 11086 | if (nid) { |
| 11087 | if (!cfg->line_out_pins[0]) { |
| 11088 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11089 | "Speaker Playback Volume", |
| 11090 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11091 | HDA_OUTPUT)); |
| 11092 | if (err < 0) |
| 11093 | return err; |
| 11094 | } |
| 11095 | if (nid == 0x16) { |
| 11096 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11097 | "Speaker Playback Switch", |
| 11098 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11099 | HDA_OUTPUT)); |
| 11100 | if (err < 0) |
| 11101 | return err; |
| 11102 | } else { |
| 11103 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11104 | "Speaker Playback Switch", |
| 11105 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11106 | HDA_OUTPUT)); |
| 11107 | if (err < 0) |
| 11108 | return err; |
| 11109 | } |
| 11110 | } |
| 11111 | nid = cfg->hp_pins[0]; |
| 11112 | if (nid) { |
| 11113 | /* spec->multiout.hp_nid = 2; */ |
| 11114 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 11115 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 11116 | "Headphone Playback Volume", |
| 11117 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 11118 | HDA_OUTPUT)); |
| 11119 | if (err < 0) |
| 11120 | return err; |
| 11121 | } |
| 11122 | if (nid == 0x16) { |
| 11123 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11124 | "Headphone Playback Switch", |
| 11125 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11126 | HDA_OUTPUT)); |
| 11127 | if (err < 0) |
| 11128 | return err; |
| 11129 | } else { |
| 11130 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11131 | "Headphone Playback Switch", |
| 11132 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11133 | HDA_OUTPUT)); |
| 11134 | if (err < 0) |
| 11135 | return err; |
| 11136 | } |
| 11137 | } |
| 11138 | return 0; |
| 11139 | } |
| 11140 | |
| 11141 | #define alc269_auto_create_analog_input_ctls \ |
| 11142 | alc880_auto_create_analog_input_ctls |
| 11143 | |
| 11144 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11145 | #define alc269_loopbacks alc880_loopbacks |
| 11146 | #endif |
| 11147 | |
| 11148 | /* pcm configuration: identiacal with ALC880 */ |
| 11149 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 11150 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 11151 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 11152 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 11153 | |
| 11154 | /* |
| 11155 | * BIOS auto configuration |
| 11156 | */ |
| 11157 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 11158 | { |
| 11159 | struct alc_spec *spec = codec->spec; |
| 11160 | int err; |
| 11161 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 11162 | |
| 11163 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11164 | alc269_ignore); |
| 11165 | if (err < 0) |
| 11166 | return err; |
| 11167 | |
| 11168 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11169 | if (err < 0) |
| 11170 | return err; |
| 11171 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11172 | if (err < 0) |
| 11173 | return err; |
| 11174 | |
| 11175 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11176 | |
| 11177 | if (spec->autocfg.dig_out_pin) |
| 11178 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 11179 | |
| 11180 | if (spec->kctl_alloc) |
| 11181 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11182 | |
| 11183 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 11184 | spec->num_mux_defs = 1; |
| 11185 | spec->input_mux = &spec->private_imux; |
| 11186 | |
| 11187 | err = alc_auto_add_mic_boost(codec); |
| 11188 | if (err < 0) |
| 11189 | return err; |
| 11190 | |
| 11191 | return 1; |
| 11192 | } |
| 11193 | |
| 11194 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 11195 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 11196 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 11197 | |
| 11198 | |
| 11199 | /* init callback for auto-configuration model -- overriding the default init */ |
| 11200 | static void alc269_auto_init(struct hda_codec *codec) |
| 11201 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11202 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11203 | alc269_auto_init_multi_out(codec); |
| 11204 | alc269_auto_init_hp_out(codec); |
| 11205 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11206 | if (spec->unsol_event) |
| 11207 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11208 | } |
| 11209 | |
| 11210 | /* |
| 11211 | * configuration and preset |
| 11212 | */ |
| 11213 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11214 | [ALC269_BASIC] = "basic", |
| 11215 | }; |
| 11216 | |
| 11217 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 11218 | {} |
| 11219 | }; |
| 11220 | |
| 11221 | static struct alc_config_preset alc269_presets[] = { |
| 11222 | [ALC269_BASIC] = { |
| 11223 | .mixers = { alc269_base_mixer }, |
| 11224 | .init_verbs = { alc269_init_verbs }, |
| 11225 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11226 | .dac_nids = alc269_dac_nids, |
| 11227 | .hp_nid = 0x03, |
| 11228 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11229 | .channel_mode = alc269_modes, |
| 11230 | .input_mux = &alc269_capture_source, |
| 11231 | }, |
| 11232 | }; |
| 11233 | |
| 11234 | static int patch_alc269(struct hda_codec *codec) |
| 11235 | { |
| 11236 | struct alc_spec *spec; |
| 11237 | int board_config; |
| 11238 | int err; |
| 11239 | |
| 11240 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11241 | if (spec == NULL) |
| 11242 | return -ENOMEM; |
| 11243 | |
| 11244 | codec->spec = spec; |
| 11245 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 11246 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 11247 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 11248 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11249 | alc269_models, |
| 11250 | alc269_cfg_tbl); |
| 11251 | |
| 11252 | if (board_config < 0) { |
| 11253 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11254 | "trying auto-probe from BIOS...\n"); |
| 11255 | board_config = ALC269_AUTO; |
| 11256 | } |
| 11257 | |
| 11258 | if (board_config == ALC269_AUTO) { |
| 11259 | /* automatic parse from the BIOS config */ |
| 11260 | err = alc269_parse_auto_config(codec); |
| 11261 | if (err < 0) { |
| 11262 | alc_free(codec); |
| 11263 | return err; |
| 11264 | } else if (!err) { |
| 11265 | printk(KERN_INFO |
| 11266 | "hda_codec: Cannot set up configuration " |
| 11267 | "from BIOS. Using base mode...\n"); |
| 11268 | board_config = ALC269_BASIC; |
| 11269 | } |
| 11270 | } |
| 11271 | |
| 11272 | if (board_config != ALC269_AUTO) |
| 11273 | setup_preset(spec, &alc269_presets[board_config]); |
| 11274 | |
| 11275 | spec->stream_name_analog = "ALC269 Analog"; |
| 11276 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11277 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11278 | |
| 11279 | spec->stream_name_digital = "ALC269 Digital"; |
| 11280 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11281 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11282 | |
| 11283 | spec->adc_nids = alc269_adc_nids; |
| 11284 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 11285 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11286 | spec->num_mixers++; |
| 11287 | |
| 11288 | codec->patch_ops = alc_patch_ops; |
| 11289 | if (board_config == ALC269_AUTO) |
| 11290 | spec->init_hook = alc269_auto_init; |
| 11291 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11292 | if (!spec->loopback.amplist) |
| 11293 | spec->loopback.amplist = alc269_loopbacks; |
| 11294 | #endif |
| 11295 | |
| 11296 | return 0; |
| 11297 | } |
| 11298 | |
| 11299 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11300 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11301 | */ |
| 11302 | |
| 11303 | /* |
| 11304 | * set the path ways for 2 channel output |
| 11305 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11306 | */ |
| 11307 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11308 | /* set pin widget 1Ah (line in) for input */ |
| 11309 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11310 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11311 | * the vref |
| 11312 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11313 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11314 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11315 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11316 | #if 0 |
| 11317 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11318 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11319 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11320 | { } /* end */ |
| 11321 | }; |
| 11322 | /* |
| 11323 | * 6ch mode |
| 11324 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11325 | */ |
| 11326 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11327 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11328 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11329 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11330 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11331 | |
| 11332 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11333 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11334 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11335 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11336 | #if 0 |
| 11337 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11338 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11339 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11340 | { } /* end */ |
| 11341 | }; |
| 11342 | |
| 11343 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11344 | { 2, alc861_threestack_ch2_init }, |
| 11345 | { 6, alc861_threestack_ch6_init }, |
| 11346 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11347 | /* Set mic1 as input and unmute the mixer */ |
| 11348 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11349 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11350 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11351 | { } /* end */ |
| 11352 | }; |
| 11353 | /* Set mic1 as output and mute mixer */ |
| 11354 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11355 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11356 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11357 | { } /* end */ |
| 11358 | }; |
| 11359 | |
| 11360 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11361 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11362 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11363 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11364 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11365 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11366 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11367 | /* set pin widget 1Ah (line in) for input */ |
| 11368 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11369 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11370 | * the vref |
| 11371 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11372 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11373 | |
| 11374 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11375 | #if 0 |
| 11376 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11377 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11378 | #endif |
| 11379 | { } /* end */ |
| 11380 | }; |
| 11381 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11382 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11383 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11384 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11385 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11386 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11387 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11388 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11389 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11390 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11391 | |
| 11392 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11393 | #if 0 |
| 11394 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11395 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11396 | #endif |
| 11397 | { } /* end */ |
| 11398 | }; |
| 11399 | |
| 11400 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11401 | { 2, alc861_asus_ch2_init }, |
| 11402 | { 6, alc861_asus_ch6_init }, |
| 11403 | }; |
| 11404 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11405 | /* patch-ALC861 */ |
| 11406 | |
| 11407 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11408 | /* output mixer control */ |
| 11409 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11410 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11411 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11412 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11413 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11414 | |
| 11415 | /*Input mixer control */ |
| 11416 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11417 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11418 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11419 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11420 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11421 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11422 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11423 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11424 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11426 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11427 | /* Capture mixer control */ |
| 11428 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11429 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11430 | { |
| 11431 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11432 | .name = "Capture Source", |
| 11433 | .count = 1, |
| 11434 | .info = alc_mux_enum_info, |
| 11435 | .get = alc_mux_enum_get, |
| 11436 | .put = alc_mux_enum_put, |
| 11437 | }, |
| 11438 | { } /* end */ |
| 11439 | }; |
| 11440 | |
| 11441 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11442 | /* output mixer control */ |
| 11443 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11444 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11445 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11446 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11447 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11448 | |
| 11449 | /* Input mixer control */ |
| 11450 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11451 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11452 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11453 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11454 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11455 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11458 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11459 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11460 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11461 | /* Capture mixer control */ |
| 11462 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11463 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11464 | { |
| 11465 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11466 | .name = "Capture Source", |
| 11467 | .count = 1, |
| 11468 | .info = alc_mux_enum_info, |
| 11469 | .get = alc_mux_enum_get, |
| 11470 | .put = alc_mux_enum_put, |
| 11471 | }, |
| 11472 | { |
| 11473 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11474 | .name = "Channel Mode", |
| 11475 | .info = alc_ch_mode_info, |
| 11476 | .get = alc_ch_mode_get, |
| 11477 | .put = alc_ch_mode_put, |
| 11478 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11479 | }, |
| 11480 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11481 | }; |
| 11482 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11483 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11484 | /* output mixer control */ |
| 11485 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11486 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11487 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11488 | |
| 11489 | /*Capture mixer control */ |
| 11490 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11491 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11492 | { |
| 11493 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11494 | .name = "Capture Source", |
| 11495 | .count = 1, |
| 11496 | .info = alc_mux_enum_info, |
| 11497 | .get = alc_mux_enum_get, |
| 11498 | .put = alc_mux_enum_put, |
| 11499 | }, |
| 11500 | |
| 11501 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11502 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11503 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11504 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11505 | /* output mixer control */ |
| 11506 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11507 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11508 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11509 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11510 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11511 | |
| 11512 | /* Input mixer control */ |
| 11513 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11514 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11515 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11516 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11517 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11518 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11519 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11520 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11521 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11522 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11523 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11524 | /* Capture mixer control */ |
| 11525 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11526 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11527 | { |
| 11528 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11529 | .name = "Capture Source", |
| 11530 | .count = 1, |
| 11531 | .info = alc_mux_enum_info, |
| 11532 | .get = alc_mux_enum_get, |
| 11533 | .put = alc_mux_enum_put, |
| 11534 | }, |
| 11535 | { |
| 11536 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11537 | .name = "Channel Mode", |
| 11538 | .info = alc_ch_mode_info, |
| 11539 | .get = alc_ch_mode_get, |
| 11540 | .put = alc_ch_mode_put, |
| 11541 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11542 | }, |
| 11543 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11544 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11545 | |
| 11546 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11547 | /* output mixer control */ |
| 11548 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11549 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11550 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11551 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11552 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11553 | |
| 11554 | /* Input mixer control */ |
| 11555 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11556 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11557 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11558 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11559 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11560 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11561 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11563 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11564 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11565 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11566 | /* Capture mixer control */ |
| 11567 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11568 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11569 | { |
| 11570 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11571 | .name = "Capture Source", |
| 11572 | .count = 1, |
| 11573 | .info = alc_mux_enum_info, |
| 11574 | .get = alc_mux_enum_get, |
| 11575 | .put = alc_mux_enum_put, |
| 11576 | }, |
| 11577 | { |
| 11578 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11579 | .name = "Channel Mode", |
| 11580 | .info = alc_ch_mode_info, |
| 11581 | .get = alc_ch_mode_get, |
| 11582 | .put = alc_ch_mode_put, |
| 11583 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11584 | }, |
| 11585 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11586 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11587 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11588 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11589 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11590 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11591 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11592 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11593 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11594 | { } |
| 11595 | }; |
| 11596 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11597 | /* |
| 11598 | * generic initialization of ADC, input mixers and output mixers |
| 11599 | */ |
| 11600 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11601 | /* |
| 11602 | * Unmute ADC0 and set the default input to mic-in |
| 11603 | */ |
| 11604 | /* port-A for surround (rear panel) */ |
| 11605 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11606 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11607 | /* port-B for mic-in (rear panel) with vref */ |
| 11608 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11609 | /* port-C for line-in (rear panel) */ |
| 11610 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11611 | /* port-D for Front */ |
| 11612 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11613 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11614 | /* port-E for HP out (front panel) */ |
| 11615 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11616 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11617 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11618 | /* port-F for mic-in (front panel) with vref */ |
| 11619 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11620 | /* port-G for CLFE (rear panel) */ |
| 11621 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11622 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11623 | /* port-H for side (rear panel) */ |
| 11624 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11625 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11626 | /* CD-in */ |
| 11627 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11628 | /* route front mic to ADC1*/ |
| 11629 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11630 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11631 | |
| 11632 | /* Unmute DAC0~3 & spdif out*/ |
| 11633 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11634 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11635 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11636 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11637 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11638 | |
| 11639 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11640 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11641 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11642 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11643 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11644 | |
| 11645 | /* Unmute Stereo Mixer 15 */ |
| 11646 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11647 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11648 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11649 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11650 | |
| 11651 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11652 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11653 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11654 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11655 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11656 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11657 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11658 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11659 | /* hp used DAC 3 (Front) */ |
| 11660 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11661 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11662 | |
| 11663 | { } |
| 11664 | }; |
| 11665 | |
| 11666 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11667 | /* |
| 11668 | * Unmute ADC0 and set the default input to mic-in |
| 11669 | */ |
| 11670 | /* port-A for surround (rear panel) */ |
| 11671 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11672 | /* port-B for mic-in (rear panel) with vref */ |
| 11673 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11674 | /* port-C for line-in (rear panel) */ |
| 11675 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11676 | /* port-D for Front */ |
| 11677 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11678 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11679 | /* port-E for HP out (front panel) */ |
| 11680 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11681 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11682 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11683 | /* port-F for mic-in (front panel) with vref */ |
| 11684 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11685 | /* port-G for CLFE (rear panel) */ |
| 11686 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11687 | /* port-H for side (rear panel) */ |
| 11688 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11689 | /* CD-in */ |
| 11690 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11691 | /* route front mic to ADC1*/ |
| 11692 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11693 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11694 | /* Unmute DAC0~3 & spdif out*/ |
| 11695 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11696 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11697 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11698 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11700 | |
| 11701 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11702 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11703 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11704 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11705 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11706 | |
| 11707 | /* Unmute Stereo Mixer 15 */ |
| 11708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11710 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11711 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11712 | |
| 11713 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11714 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11715 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11716 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11717 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11719 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11721 | /* hp used DAC 3 (Front) */ |
| 11722 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11723 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11724 | { } |
| 11725 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11726 | |
| 11727 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11728 | /* |
| 11729 | * Unmute ADC0 and set the default input to mic-in |
| 11730 | */ |
| 11731 | /* port-A for surround (rear panel) */ |
| 11732 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11733 | /* port-B for mic-in (rear panel) with vref */ |
| 11734 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11735 | /* port-C for line-in (rear panel) */ |
| 11736 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11737 | /* port-D for Front */ |
| 11738 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11739 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11740 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11741 | /* this has to be set to VREF80 */ |
| 11742 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11743 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11744 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11745 | /* port-F for mic-in (front panel) with vref */ |
| 11746 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11747 | /* port-G for CLFE (rear panel) */ |
| 11748 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11749 | /* port-H for side (rear panel) */ |
| 11750 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11751 | /* CD-in */ |
| 11752 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11753 | /* route front mic to ADC1*/ |
| 11754 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11755 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11756 | /* Unmute DAC0~3 & spdif out*/ |
| 11757 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11758 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11759 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11760 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11761 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11762 | |
| 11763 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11764 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11765 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11766 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11767 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11768 | |
| 11769 | /* Unmute Stereo Mixer 15 */ |
| 11770 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11772 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11773 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11774 | |
| 11775 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11776 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11777 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11778 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11779 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11781 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11782 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11783 | /* hp used DAC 3 (Front) */ |
| 11784 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11785 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11786 | { } |
| 11787 | }; |
| 11788 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11789 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11790 | /* |
| 11791 | * Unmute ADC0 and set the default input to mic-in |
| 11792 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11793 | /* port-A for surround (rear panel) |
| 11794 | * according to codec#0 this is the HP jack |
| 11795 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11796 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11797 | /* route front PCM to HP */ |
| 11798 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11799 | /* port-B for mic-in (rear panel) with vref */ |
| 11800 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11801 | /* port-C for line-in (rear panel) */ |
| 11802 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11803 | /* port-D for Front */ |
| 11804 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11805 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11806 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11807 | /* this has to be set to VREF80 */ |
| 11808 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11809 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11810 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11811 | /* port-F for mic-in (front panel) with vref */ |
| 11812 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11813 | /* port-G for CLFE (rear panel) */ |
| 11814 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11815 | /* port-H for side (rear panel) */ |
| 11816 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11817 | /* CD-in */ |
| 11818 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11819 | /* route front mic to ADC1*/ |
| 11820 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11821 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11822 | /* Unmute DAC0~3 & spdif out*/ |
| 11823 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11824 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11825 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11826 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11827 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11828 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11829 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11830 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11831 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11832 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11833 | |
| 11834 | /* Unmute Stereo Mixer 15 */ |
| 11835 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11836 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11837 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11838 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11839 | |
| 11840 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11841 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11842 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11843 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11844 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11845 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11846 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11847 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11848 | /* hp used DAC 3 (Front) */ |
| 11849 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11850 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11851 | { } |
| 11852 | }; |
| 11853 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11854 | /* additional init verbs for ASUS laptops */ |
| 11855 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11856 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11857 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11858 | { } |
| 11859 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11860 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11861 | /* |
| 11862 | * generic initialization of ADC, input mixers and output mixers |
| 11863 | */ |
| 11864 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11865 | /* |
| 11866 | * Unmute ADC0 and set the default input to mic-in |
| 11867 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11868 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11869 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11870 | |
| 11871 | /* Unmute DAC0~3 & spdif out*/ |
| 11872 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11873 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11874 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11875 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11876 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11877 | |
| 11878 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11879 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11880 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11881 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11882 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11883 | |
| 11884 | /* Unmute Stereo Mixer 15 */ |
| 11885 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11886 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11887 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11888 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11889 | |
| 11890 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11891 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11892 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11893 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11894 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11895 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11896 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11897 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11898 | |
| 11899 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11900 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11901 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11902 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11903 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11904 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11905 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11906 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11907 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11908 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11909 | |
| 11910 | { } |
| 11911 | }; |
| 11912 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11913 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11914 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11915 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11916 | { } |
| 11917 | }; |
| 11918 | |
| 11919 | /* toggle speaker-output according to the hp-jack state */ |
| 11920 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11921 | { |
| 11922 | unsigned int present; |
| 11923 | |
| 11924 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11925 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11926 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11927 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11928 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11929 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11930 | } |
| 11931 | |
| 11932 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11933 | unsigned int res) |
| 11934 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11935 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11936 | alc861_toshiba_automute(codec); |
| 11937 | } |
| 11938 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11939 | /* pcm configuration: identiacal with ALC880 */ |
| 11940 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11941 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11942 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11943 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11944 | |
| 11945 | |
| 11946 | #define ALC861_DIGOUT_NID 0x07 |
| 11947 | |
| 11948 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11949 | { 8, NULL } |
| 11950 | }; |
| 11951 | |
| 11952 | static hda_nid_t alc861_dac_nids[4] = { |
| 11953 | /* front, surround, clfe, side */ |
| 11954 | 0x03, 0x06, 0x05, 0x04 |
| 11955 | }; |
| 11956 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11957 | static hda_nid_t alc660_dac_nids[3] = { |
| 11958 | /* front, clfe, surround */ |
| 11959 | 0x03, 0x05, 0x06 |
| 11960 | }; |
| 11961 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11962 | static hda_nid_t alc861_adc_nids[1] = { |
| 11963 | /* ADC0-2 */ |
| 11964 | 0x08, |
| 11965 | }; |
| 11966 | |
| 11967 | static struct hda_input_mux alc861_capture_source = { |
| 11968 | .num_items = 5, |
| 11969 | .items = { |
| 11970 | { "Mic", 0x0 }, |
| 11971 | { "Front Mic", 0x3 }, |
| 11972 | { "Line", 0x1 }, |
| 11973 | { "CD", 0x4 }, |
| 11974 | { "Mixer", 0x5 }, |
| 11975 | }, |
| 11976 | }; |
| 11977 | |
| 11978 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11979 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11980 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11981 | { |
| 11982 | int i; |
| 11983 | hda_nid_t nid; |
| 11984 | |
| 11985 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11986 | for (i = 0; i < cfg->line_outs; i++) { |
| 11987 | nid = cfg->line_out_pins[i]; |
| 11988 | if (nid) { |
| 11989 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11990 | continue; |
| 11991 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11992 | } |
| 11993 | } |
| 11994 | spec->multiout.num_dacs = cfg->line_outs; |
| 11995 | return 0; |
| 11996 | } |
| 11997 | |
| 11998 | /* add playback controls from the parsed DAC table */ |
| 11999 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12000 | const struct auto_pin_cfg *cfg) |
| 12001 | { |
| 12002 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12003 | static const char *chname[4] = { |
| 12004 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 12005 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12006 | hda_nid_t nid; |
| 12007 | int i, idx, err; |
| 12008 | |
| 12009 | for (i = 0; i < cfg->line_outs; i++) { |
| 12010 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12011 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12012 | continue; |
| 12013 | if (nid == 0x05) { |
| 12014 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12015 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12016 | "Center Playback Switch", |
| 12017 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 12018 | HDA_OUTPUT)); |
| 12019 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12020 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12021 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12022 | "LFE Playback Switch", |
| 12023 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 12024 | HDA_OUTPUT)); |
| 12025 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12026 | return err; |
| 12027 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12028 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 12029 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12030 | if (nid == alc861_dac_nids[idx]) |
| 12031 | break; |
| 12032 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12033 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12034 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 12035 | HDA_OUTPUT)); |
| 12036 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12037 | return err; |
| 12038 | } |
| 12039 | } |
| 12040 | return 0; |
| 12041 | } |
| 12042 | |
| 12043 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 12044 | { |
| 12045 | int err; |
| 12046 | hda_nid_t nid; |
| 12047 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12048 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12049 | return 0; |
| 12050 | |
| 12051 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 12052 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12053 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 12054 | "Headphone Playback Switch", |
| 12055 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 12056 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12057 | return err; |
| 12058 | spec->multiout.hp_nid = nid; |
| 12059 | } |
| 12060 | return 0; |
| 12061 | } |
| 12062 | |
| 12063 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12064 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 12065 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12066 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12067 | struct hda_input_mux *imux = &spec->private_imux; |
| 12068 | int i, err, idx, idx1; |
| 12069 | |
| 12070 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12071 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12072 | case 0x0c: |
| 12073 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12074 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12075 | break; |
| 12076 | case 0x0f: |
| 12077 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12078 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12079 | break; |
| 12080 | case 0x0d: |
| 12081 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12082 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12083 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12084 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12085 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12086 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12087 | break; |
| 12088 | case 0x11: |
| 12089 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12090 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12091 | break; |
| 12092 | default: |
| 12093 | continue; |
| 12094 | } |
| 12095 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12096 | err = new_analog_input(spec, cfg->input_pins[i], |
| 12097 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12098 | if (err < 0) |
| 12099 | return err; |
| 12100 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 12101 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12102 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12103 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12104 | } |
| 12105 | return 0; |
| 12106 | } |
| 12107 | |
| 12108 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 12109 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 12110 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 12111 | |
| 12112 | { |
| 12113 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12114 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12115 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12116 | */ |
| 12117 | /* .name = "Capture Source", */ |
| 12118 | .name = "Input Source", |
| 12119 | .count = 1, |
| 12120 | .info = alc_mux_enum_info, |
| 12121 | .get = alc_mux_enum_get, |
| 12122 | .put = alc_mux_enum_put, |
| 12123 | }, |
| 12124 | { } /* end */ |
| 12125 | }; |
| 12126 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12127 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12128 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12129 | int pin_type, int dac_idx) |
| 12130 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 12131 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12132 | pin_type); |
| 12133 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12134 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12135 | } |
| 12136 | |
| 12137 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 12138 | { |
| 12139 | struct alc_spec *spec = codec->spec; |
| 12140 | int i; |
| 12141 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12142 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12143 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 12144 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12145 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12146 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12147 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12148 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12149 | } |
| 12150 | } |
| 12151 | |
| 12152 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 12153 | { |
| 12154 | struct alc_spec *spec = codec->spec; |
| 12155 | hda_nid_t pin; |
| 12156 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 12157 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12158 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12159 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 12160 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12161 | pin = spec->autocfg.speaker_pins[0]; |
| 12162 | if (pin) |
| 12163 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12164 | } |
| 12165 | |
| 12166 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 12167 | { |
| 12168 | struct alc_spec *spec = codec->spec; |
| 12169 | int i; |
| 12170 | |
| 12171 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12172 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12173 | if (nid >= 0x0c && nid <= 0x11) { |
| 12174 | snd_hda_codec_write(codec, nid, 0, |
| 12175 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12176 | i <= AUTO_PIN_FRONT_MIC ? |
| 12177 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12178 | } |
| 12179 | } |
| 12180 | } |
| 12181 | |
| 12182 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12183 | /* return 1 if successful, 0 if the proper config is not found, |
| 12184 | * or a negative error code |
| 12185 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12186 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 12187 | { |
| 12188 | struct alc_spec *spec = codec->spec; |
| 12189 | int err; |
| 12190 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 12191 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12192 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12193 | alc861_ignore); |
| 12194 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12195 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12196 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12197 | return 0; /* can't find valid BIOS pin config */ |
| 12198 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12199 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12200 | if (err < 0) |
| 12201 | return err; |
| 12202 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12203 | if (err < 0) |
| 12204 | return err; |
| 12205 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 12206 | if (err < 0) |
| 12207 | return err; |
| 12208 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12209 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12210 | return err; |
| 12211 | |
| 12212 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12213 | |
| 12214 | if (spec->autocfg.dig_out_pin) |
| 12215 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12216 | |
| 12217 | if (spec->kctl_alloc) |
| 12218 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12219 | |
| 12220 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12221 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12222 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12223 | spec->input_mux = &spec->private_imux; |
| 12224 | |
| 12225 | spec->adc_nids = alc861_adc_nids; |
| 12226 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12227 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12228 | spec->num_mixers++; |
| 12229 | |
| 12230 | return 1; |
| 12231 | } |
| 12232 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12233 | /* additional initialization for auto-configuration model */ |
| 12234 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12235 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12236 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12237 | alc861_auto_init_multi_out(codec); |
| 12238 | alc861_auto_init_hp_out(codec); |
| 12239 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12240 | if (spec->unsol_event) |
| 12241 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12242 | } |
| 12243 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12244 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12245 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12246 | { 0x15, HDA_INPUT, 0 }, |
| 12247 | { 0x15, HDA_INPUT, 1 }, |
| 12248 | { 0x15, HDA_INPUT, 2 }, |
| 12249 | { 0x15, HDA_INPUT, 3 }, |
| 12250 | { } /* end */ |
| 12251 | }; |
| 12252 | #endif |
| 12253 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12254 | |
| 12255 | /* |
| 12256 | * configuration and preset |
| 12257 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12258 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12259 | [ALC861_3ST] = "3stack", |
| 12260 | [ALC660_3ST] = "3stack-660", |
| 12261 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12262 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12263 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12264 | [ALC861_TOSHIBA] = "toshiba", |
| 12265 | [ALC861_ASUS] = "asus", |
| 12266 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12267 | [ALC861_AUTO] = "auto", |
| 12268 | }; |
| 12269 | |
| 12270 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12271 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12272 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12273 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12274 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12275 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12276 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12277 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12278 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12279 | * Any other models that need this preset? |
| 12280 | */ |
| 12281 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12282 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12283 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12284 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12285 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12286 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12287 | /* FIXME: the below seems conflict */ |
| 12288 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12289 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12290 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12291 | {} |
| 12292 | }; |
| 12293 | |
| 12294 | static struct alc_config_preset alc861_presets[] = { |
| 12295 | [ALC861_3ST] = { |
| 12296 | .mixers = { alc861_3ST_mixer }, |
| 12297 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12298 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12299 | .dac_nids = alc861_dac_nids, |
| 12300 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12301 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12302 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12303 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12304 | .adc_nids = alc861_adc_nids, |
| 12305 | .input_mux = &alc861_capture_source, |
| 12306 | }, |
| 12307 | [ALC861_3ST_DIG] = { |
| 12308 | .mixers = { alc861_base_mixer }, |
| 12309 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12310 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12311 | .dac_nids = alc861_dac_nids, |
| 12312 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12313 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12314 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12315 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12316 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12317 | .adc_nids = alc861_adc_nids, |
| 12318 | .input_mux = &alc861_capture_source, |
| 12319 | }, |
| 12320 | [ALC861_6ST_DIG] = { |
| 12321 | .mixers = { alc861_base_mixer }, |
| 12322 | .init_verbs = { alc861_base_init_verbs }, |
| 12323 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12324 | .dac_nids = alc861_dac_nids, |
| 12325 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12326 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12327 | .channel_mode = alc861_8ch_modes, |
| 12328 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12329 | .adc_nids = alc861_adc_nids, |
| 12330 | .input_mux = &alc861_capture_source, |
| 12331 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12332 | [ALC660_3ST] = { |
| 12333 | .mixers = { alc861_3ST_mixer }, |
| 12334 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12335 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12336 | .dac_nids = alc660_dac_nids, |
| 12337 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12338 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12339 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12340 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12341 | .adc_nids = alc861_adc_nids, |
| 12342 | .input_mux = &alc861_capture_source, |
| 12343 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12344 | [ALC861_UNIWILL_M31] = { |
| 12345 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12346 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12347 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12348 | .dac_nids = alc861_dac_nids, |
| 12349 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12350 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12351 | .channel_mode = alc861_uniwill_m31_modes, |
| 12352 | .need_dac_fix = 1, |
| 12353 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12354 | .adc_nids = alc861_adc_nids, |
| 12355 | .input_mux = &alc861_capture_source, |
| 12356 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12357 | [ALC861_TOSHIBA] = { |
| 12358 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12359 | .init_verbs = { alc861_base_init_verbs, |
| 12360 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12361 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12362 | .dac_nids = alc861_dac_nids, |
| 12363 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12364 | .channel_mode = alc883_3ST_2ch_modes, |
| 12365 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12366 | .adc_nids = alc861_adc_nids, |
| 12367 | .input_mux = &alc861_capture_source, |
| 12368 | .unsol_event = alc861_toshiba_unsol_event, |
| 12369 | .init_hook = alc861_toshiba_automute, |
| 12370 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12371 | [ALC861_ASUS] = { |
| 12372 | .mixers = { alc861_asus_mixer }, |
| 12373 | .init_verbs = { alc861_asus_init_verbs }, |
| 12374 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12375 | .dac_nids = alc861_dac_nids, |
| 12376 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12377 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12378 | .channel_mode = alc861_asus_modes, |
| 12379 | .need_dac_fix = 1, |
| 12380 | .hp_nid = 0x06, |
| 12381 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12382 | .adc_nids = alc861_adc_nids, |
| 12383 | .input_mux = &alc861_capture_source, |
| 12384 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12385 | [ALC861_ASUS_LAPTOP] = { |
| 12386 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12387 | .init_verbs = { alc861_asus_init_verbs, |
| 12388 | alc861_asus_laptop_init_verbs }, |
| 12389 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12390 | .dac_nids = alc861_dac_nids, |
| 12391 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12392 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12393 | .channel_mode = alc883_3ST_2ch_modes, |
| 12394 | .need_dac_fix = 1, |
| 12395 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12396 | .adc_nids = alc861_adc_nids, |
| 12397 | .input_mux = &alc861_capture_source, |
| 12398 | }, |
| 12399 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12400 | |
| 12401 | |
| 12402 | static int patch_alc861(struct hda_codec *codec) |
| 12403 | { |
| 12404 | struct alc_spec *spec; |
| 12405 | int board_config; |
| 12406 | int err; |
| 12407 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12408 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12409 | if (spec == NULL) |
| 12410 | return -ENOMEM; |
| 12411 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12412 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12413 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12414 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12415 | alc861_models, |
| 12416 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12417 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12418 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12419 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12420 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12421 | board_config = ALC861_AUTO; |
| 12422 | } |
| 12423 | |
| 12424 | if (board_config == ALC861_AUTO) { |
| 12425 | /* automatic parse from the BIOS config */ |
| 12426 | err = alc861_parse_auto_config(codec); |
| 12427 | if (err < 0) { |
| 12428 | alc_free(codec); |
| 12429 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12430 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12431 | printk(KERN_INFO |
| 12432 | "hda_codec: Cannot set up configuration " |
| 12433 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12434 | board_config = ALC861_3ST_DIG; |
| 12435 | } |
| 12436 | } |
| 12437 | |
| 12438 | if (board_config != ALC861_AUTO) |
| 12439 | setup_preset(spec, &alc861_presets[board_config]); |
| 12440 | |
| 12441 | spec->stream_name_analog = "ALC861 Analog"; |
| 12442 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12443 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12444 | |
| 12445 | spec->stream_name_digital = "ALC861 Digital"; |
| 12446 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12447 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12448 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12449 | spec->vmaster_nid = 0x03; |
| 12450 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12451 | codec->patch_ops = alc_patch_ops; |
| 12452 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12453 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12454 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12455 | if (!spec->loopback.amplist) |
| 12456 | spec->loopback.amplist = alc861_loopbacks; |
| 12457 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12458 | |
| 12459 | return 0; |
| 12460 | } |
| 12461 | |
| 12462 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12463 | * ALC861-VD support |
| 12464 | * |
| 12465 | * Based on ALC882 |
| 12466 | * |
| 12467 | * In addition, an independent DAC |
| 12468 | */ |
| 12469 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12470 | |
| 12471 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12472 | /* front, surr, clfe, side surr */ |
| 12473 | 0x02, 0x03, 0x04, 0x05 |
| 12474 | }; |
| 12475 | |
| 12476 | /* dac_nids for ALC660vd are in a different order - according to |
| 12477 | * Realtek's driver. |
| 12478 | * This should probably tesult in a different mixer for 6stack models |
| 12479 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12480 | * - and it is the same as in 861vd. |
| 12481 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12482 | */ |
| 12483 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12484 | /* front, rear, clfe, rear_surr */ |
| 12485 | 0x02, 0x04, 0x03 |
| 12486 | }; |
| 12487 | |
| 12488 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12489 | /* ADC0 */ |
| 12490 | 0x09, |
| 12491 | }; |
| 12492 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12493 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12494 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12495 | /* input MUX */ |
| 12496 | /* FIXME: should be a matrix-type input source selection */ |
| 12497 | static struct hda_input_mux alc861vd_capture_source = { |
| 12498 | .num_items = 4, |
| 12499 | .items = { |
| 12500 | { "Mic", 0x0 }, |
| 12501 | { "Front Mic", 0x1 }, |
| 12502 | { "Line", 0x2 }, |
| 12503 | { "CD", 0x4 }, |
| 12504 | }, |
| 12505 | }; |
| 12506 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12507 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12508 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12509 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12510 | { "Ext Mic", 0x0 }, |
| 12511 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12512 | }, |
| 12513 | }; |
| 12514 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12515 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12516 | .num_items = 2, |
| 12517 | .items = { |
| 12518 | { "Front Mic", 0x0 }, |
| 12519 | { "ATAPI Mic", 0x1 }, |
| 12520 | }, |
| 12521 | }; |
| 12522 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12523 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12524 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12525 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12526 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12527 | |
| 12528 | /* |
| 12529 | * 2ch mode |
| 12530 | */ |
| 12531 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12532 | { 2, NULL } |
| 12533 | }; |
| 12534 | |
| 12535 | /* |
| 12536 | * 6ch mode |
| 12537 | */ |
| 12538 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12539 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12540 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12541 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12542 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12543 | { } /* end */ |
| 12544 | }; |
| 12545 | |
| 12546 | /* |
| 12547 | * 8ch mode |
| 12548 | */ |
| 12549 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12550 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12551 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12552 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12553 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12554 | { } /* end */ |
| 12555 | }; |
| 12556 | |
| 12557 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12558 | { 6, alc861vd_6stack_ch6_init }, |
| 12559 | { 8, alc861vd_6stack_ch8_init }, |
| 12560 | }; |
| 12561 | |
| 12562 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12563 | { |
| 12564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12565 | .name = "Channel Mode", |
| 12566 | .info = alc_ch_mode_info, |
| 12567 | .get = alc_ch_mode_get, |
| 12568 | .put = alc_ch_mode_put, |
| 12569 | }, |
| 12570 | { } /* end */ |
| 12571 | }; |
| 12572 | |
| 12573 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12574 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12575 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12576 | |
| 12577 | { |
| 12578 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12579 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12580 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12581 | */ |
| 12582 | /* .name = "Capture Source", */ |
| 12583 | .name = "Input Source", |
| 12584 | .count = 1, |
| 12585 | .info = alc861vd_mux_enum_info, |
| 12586 | .get = alc861vd_mux_enum_get, |
| 12587 | .put = alc861vd_mux_enum_put, |
| 12588 | }, |
| 12589 | { } /* end */ |
| 12590 | }; |
| 12591 | |
| 12592 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12593 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12594 | */ |
| 12595 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12596 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12597 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12598 | |
| 12599 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12600 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12601 | |
| 12602 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12603 | HDA_OUTPUT), |
| 12604 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12605 | HDA_OUTPUT), |
| 12606 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12607 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12608 | |
| 12609 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12610 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12611 | |
| 12612 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12613 | |
| 12614 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12615 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12616 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12617 | |
| 12618 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12619 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12621 | |
| 12622 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12623 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12624 | |
| 12625 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12626 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12627 | |
| 12628 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12629 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12630 | |
| 12631 | { } /* end */ |
| 12632 | }; |
| 12633 | |
| 12634 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12635 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12636 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12637 | |
| 12638 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12639 | |
| 12640 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12641 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12642 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12643 | |
| 12644 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12645 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12646 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12647 | |
| 12648 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12649 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12650 | |
| 12651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12653 | |
| 12654 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12655 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12656 | |
| 12657 | { } /* end */ |
| 12658 | }; |
| 12659 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12660 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12661 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12662 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12663 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12664 | |
| 12665 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12666 | |
| 12667 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12668 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12669 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12670 | |
| 12671 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12672 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12673 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12674 | |
| 12675 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12676 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12677 | |
| 12678 | { } /* end */ |
| 12679 | }; |
| 12680 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12681 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12682 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12683 | */ |
| 12684 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12685 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12686 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12687 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12688 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12689 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12690 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12691 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12692 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12693 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12694 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12695 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12696 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12697 | { } /* end */ |
| 12698 | }; |
| 12699 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12700 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12701 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12702 | */ |
| 12703 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12705 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12706 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12707 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12708 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12709 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12710 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12711 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12712 | |
| 12713 | { } /* end */ |
| 12714 | }; |
| 12715 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12716 | /* |
| 12717 | * generic initialization of ADC, input mixers and output mixers |
| 12718 | */ |
| 12719 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12720 | /* |
| 12721 | * Unmute ADC0 and set the default input to mic-in |
| 12722 | */ |
| 12723 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12724 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12725 | |
| 12726 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12727 | * the analog-loopback mixer widget |
| 12728 | */ |
| 12729 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12730 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12731 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12735 | |
| 12736 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12737 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12738 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12741 | |
| 12742 | /* |
| 12743 | * Set up output mixers (0x02 - 0x05) |
| 12744 | */ |
| 12745 | /* set vol=0 to output mixers */ |
| 12746 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12747 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12748 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12749 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12750 | |
| 12751 | /* set up input amps for analog loopback */ |
| 12752 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12754 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12755 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12756 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12758 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12759 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12760 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12761 | |
| 12762 | { } |
| 12763 | }; |
| 12764 | |
| 12765 | /* |
| 12766 | * 3-stack pin configuration: |
| 12767 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12768 | */ |
| 12769 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12770 | /* |
| 12771 | * Set pin mode and muting |
| 12772 | */ |
| 12773 | /* set front pin widgets 0x14 for output */ |
| 12774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12775 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12776 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12777 | |
| 12778 | /* Mic (rear) pin: input vref at 80% */ |
| 12779 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12780 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12781 | /* Front Mic pin: input vref at 80% */ |
| 12782 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12783 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12784 | /* Line In pin: input */ |
| 12785 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12786 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12787 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12788 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12789 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12790 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12791 | /* CD pin widget for input */ |
| 12792 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12793 | |
| 12794 | { } |
| 12795 | }; |
| 12796 | |
| 12797 | /* |
| 12798 | * 6-stack pin configuration: |
| 12799 | */ |
| 12800 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12801 | /* |
| 12802 | * Set pin mode and muting |
| 12803 | */ |
| 12804 | /* set front pin widgets 0x14 for output */ |
| 12805 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12806 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12807 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12808 | |
| 12809 | /* Rear Pin: output 1 (0x0d) */ |
| 12810 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12811 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12812 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12813 | /* CLFE Pin: output 2 (0x0e) */ |
| 12814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12815 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12816 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12817 | /* Side Pin: output 3 (0x0f) */ |
| 12818 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12819 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12820 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12821 | |
| 12822 | /* Mic (rear) pin: input vref at 80% */ |
| 12823 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12824 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12825 | /* Front Mic pin: input vref at 80% */ |
| 12826 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12827 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12828 | /* Line In pin: input */ |
| 12829 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12830 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12831 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12832 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12833 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12834 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12835 | /* CD pin widget for input */ |
| 12836 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12837 | |
| 12838 | { } |
| 12839 | }; |
| 12840 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12841 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12842 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12843 | { } |
| 12844 | }; |
| 12845 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 12846 | static struct hda_verb alc660vd_eapd_verbs[] = { |
| 12847 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12848 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12849 | { } |
| 12850 | }; |
| 12851 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12852 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12853 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12854 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12855 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12856 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12857 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12858 | {} |
| 12859 | }; |
| 12860 | |
| 12861 | /* toggle speaker-output according to the hp-jack state */ |
| 12862 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12863 | { |
| 12864 | unsigned int present; |
| 12865 | unsigned char bits; |
| 12866 | |
| 12867 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12868 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12869 | bits = present ? HDA_AMP_MUTE : 0; |
| 12870 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12871 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12872 | } |
| 12873 | |
| 12874 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12875 | { |
| 12876 | unsigned int present; |
| 12877 | unsigned char bits; |
| 12878 | |
| 12879 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12880 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12881 | bits = present ? HDA_AMP_MUTE : 0; |
| 12882 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12883 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12884 | } |
| 12885 | |
| 12886 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12887 | { |
| 12888 | alc861vd_lenovo_hp_automute(codec); |
| 12889 | alc861vd_lenovo_mic_automute(codec); |
| 12890 | } |
| 12891 | |
| 12892 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12893 | unsigned int res) |
| 12894 | { |
| 12895 | switch (res >> 26) { |
| 12896 | case ALC880_HP_EVENT: |
| 12897 | alc861vd_lenovo_hp_automute(codec); |
| 12898 | break; |
| 12899 | case ALC880_MIC_EVENT: |
| 12900 | alc861vd_lenovo_mic_automute(codec); |
| 12901 | break; |
| 12902 | } |
| 12903 | } |
| 12904 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12905 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12906 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12907 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12908 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12909 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12910 | |
| 12911 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12912 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12913 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12914 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12915 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12916 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12917 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12918 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12919 | |
| 12920 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12921 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12922 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12923 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12924 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12925 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12926 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12927 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12928 | |
| 12929 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12930 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12931 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12932 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12933 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12934 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12935 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12936 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12937 | |
| 12938 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12939 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12940 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12941 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12942 | |
| 12943 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12944 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12945 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12946 | |
| 12947 | { } /* end */ |
| 12948 | }; |
| 12949 | |
| 12950 | /* toggle speaker-output according to the hp-jack state */ |
| 12951 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12952 | { |
| 12953 | unsigned int present; |
| 12954 | |
| 12955 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12956 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12957 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12958 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12959 | } |
| 12960 | |
| 12961 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12962 | { |
| 12963 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12964 | alc861vd_dallas_automute(codec); |
| 12965 | } |
| 12966 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12967 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12968 | #define alc861vd_loopbacks alc880_loopbacks |
| 12969 | #endif |
| 12970 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12971 | /* pcm configuration: identiacal with ALC880 */ |
| 12972 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12973 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12974 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12975 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12976 | |
| 12977 | /* |
| 12978 | * configuration and preset |
| 12979 | */ |
| 12980 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12981 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12982 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12983 | [ALC861VD_3ST] = "3stack", |
| 12984 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12985 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12986 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12987 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12988 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12989 | [ALC861VD_AUTO] = "auto", |
| 12990 | }; |
| 12991 | |
| 12992 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12993 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12994 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12995 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12996 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12997 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12998 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12999 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 13000 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13001 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 13002 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 13003 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 13004 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13005 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 13006 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 13007 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13008 | {} |
| 13009 | }; |
| 13010 | |
| 13011 | static struct alc_config_preset alc861vd_presets[] = { |
| 13012 | [ALC660VD_3ST] = { |
| 13013 | .mixers = { alc861vd_3st_mixer }, |
| 13014 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13015 | alc861vd_3stack_init_verbs }, |
| 13016 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13017 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13018 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13019 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13020 | .input_mux = &alc861vd_capture_source, |
| 13021 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13022 | [ALC660VD_3ST_DIG] = { |
| 13023 | .mixers = { alc861vd_3st_mixer }, |
| 13024 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13025 | alc861vd_3stack_init_verbs }, |
| 13026 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13027 | .dac_nids = alc660vd_dac_nids, |
| 13028 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 13029 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13030 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13031 | .input_mux = &alc861vd_capture_source, |
| 13032 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13033 | [ALC861VD_3ST] = { |
| 13034 | .mixers = { alc861vd_3st_mixer }, |
| 13035 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13036 | alc861vd_3stack_init_verbs }, |
| 13037 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13038 | .dac_nids = alc861vd_dac_nids, |
| 13039 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13040 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13041 | .input_mux = &alc861vd_capture_source, |
| 13042 | }, |
| 13043 | [ALC861VD_3ST_DIG] = { |
| 13044 | .mixers = { alc861vd_3st_mixer }, |
| 13045 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13046 | alc861vd_3stack_init_verbs }, |
| 13047 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13048 | .dac_nids = alc861vd_dac_nids, |
| 13049 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13050 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13051 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13052 | .input_mux = &alc861vd_capture_source, |
| 13053 | }, |
| 13054 | [ALC861VD_6ST_DIG] = { |
| 13055 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 13056 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13057 | alc861vd_6stack_init_verbs }, |
| 13058 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13059 | .dac_nids = alc861vd_dac_nids, |
| 13060 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 13061 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 13062 | .channel_mode = alc861vd_6stack_modes, |
| 13063 | .input_mux = &alc861vd_capture_source, |
| 13064 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13065 | [ALC861VD_LENOVO] = { |
| 13066 | .mixers = { alc861vd_lenovo_mixer }, |
| 13067 | .init_verbs = { alc861vd_volume_init_verbs, |
| 13068 | alc861vd_3stack_init_verbs, |
| 13069 | alc861vd_eapd_verbs, |
| 13070 | alc861vd_lenovo_unsol_verbs }, |
| 13071 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 13072 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13073 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13074 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13075 | .input_mux = &alc861vd_capture_source, |
| 13076 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 13077 | .init_hook = alc861vd_lenovo_automute, |
| 13078 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13079 | [ALC861VD_DALLAS] = { |
| 13080 | .mixers = { alc861vd_dallas_mixer }, |
| 13081 | .init_verbs = { alc861vd_dallas_verbs }, |
| 13082 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13083 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 13084 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13085 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13086 | .input_mux = &alc861vd_dallas_capture_source, |
| 13087 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13088 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13089 | }, |
| 13090 | [ALC861VD_HP] = { |
| 13091 | .mixers = { alc861vd_hp_mixer }, |
| 13092 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 13093 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 13094 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13095 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13096 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 13097 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 13098 | .input_mux = &alc861vd_hp_capture_source, |
| 13099 | .unsol_event = alc861vd_dallas_unsol_event, |
| 13100 | .init_hook = alc861vd_dallas_automute, |
| 13101 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13102 | }; |
| 13103 | |
| 13104 | /* |
| 13105 | * BIOS auto configuration |
| 13106 | */ |
| 13107 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13108 | hda_nid_t nid, int pin_type, int dac_idx) |
| 13109 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13110 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13111 | } |
| 13112 | |
| 13113 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 13114 | { |
| 13115 | struct alc_spec *spec = codec->spec; |
| 13116 | int i; |
| 13117 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13118 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13119 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13120 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13121 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13122 | if (nid) |
| 13123 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13124 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13125 | } |
| 13126 | } |
| 13127 | |
| 13128 | |
| 13129 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 13130 | { |
| 13131 | struct alc_spec *spec = codec->spec; |
| 13132 | hda_nid_t pin; |
| 13133 | |
| 13134 | pin = spec->autocfg.hp_pins[0]; |
| 13135 | if (pin) /* connect to front and use dac 0 */ |
| 13136 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13137 | pin = spec->autocfg.speaker_pins[0]; |
| 13138 | if (pin) |
| 13139 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13140 | } |
| 13141 | |
| 13142 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13143 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 13144 | |
| 13145 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 13146 | { |
| 13147 | struct alc_spec *spec = codec->spec; |
| 13148 | int i; |
| 13149 | |
| 13150 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13151 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13152 | if (alc861vd_is_input_pin(nid)) { |
| 13153 | snd_hda_codec_write(codec, nid, 0, |
| 13154 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13155 | i <= AUTO_PIN_FRONT_MIC ? |
| 13156 | PIN_VREF80 : PIN_IN); |
| 13157 | if (nid != ALC861VD_PIN_CD_NID) |
| 13158 | snd_hda_codec_write(codec, nid, 0, |
| 13159 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13160 | AMP_OUT_MUTE); |
| 13161 | } |
| 13162 | } |
| 13163 | } |
| 13164 | |
| 13165 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 13166 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 13167 | |
| 13168 | /* add playback controls from the parsed DAC table */ |
| 13169 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13170 | * different NIDs for mute/unmute switch and volume control */ |
| 13171 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13172 | const struct auto_pin_cfg *cfg) |
| 13173 | { |
| 13174 | char name[32]; |
| 13175 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 13176 | hda_nid_t nid_v, nid_s; |
| 13177 | int i, err; |
| 13178 | |
| 13179 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13180 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13181 | continue; |
| 13182 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13183 | alc880_dac_to_idx( |
| 13184 | spec->multiout.dac_nids[i])); |
| 13185 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13186 | alc880_dac_to_idx( |
| 13187 | spec->multiout.dac_nids[i])); |
| 13188 | |
| 13189 | if (i == 2) { |
| 13190 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13191 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13192 | "Center Playback Volume", |
| 13193 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 13194 | HDA_OUTPUT)); |
| 13195 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13196 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13197 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13198 | "LFE Playback Volume", |
| 13199 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 13200 | HDA_OUTPUT)); |
| 13201 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13202 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13203 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13204 | "Center Playback Switch", |
| 13205 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 13206 | HDA_INPUT)); |
| 13207 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13208 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13209 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13210 | "LFE Playback Switch", |
| 13211 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 13212 | HDA_INPUT)); |
| 13213 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13214 | return err; |
| 13215 | } else { |
| 13216 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13217 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13218 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13219 | HDA_OUTPUT)); |
| 13220 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13221 | return err; |
| 13222 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13223 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13224 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13225 | HDA_INPUT)); |
| 13226 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13227 | return err; |
| 13228 | } |
| 13229 | } |
| 13230 | return 0; |
| 13231 | } |
| 13232 | |
| 13233 | /* add playback controls for speaker and HP outputs */ |
| 13234 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13235 | * different NIDs for mute/unmute switch and volume control */ |
| 13236 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13237 | hda_nid_t pin, const char *pfx) |
| 13238 | { |
| 13239 | hda_nid_t nid_v, nid_s; |
| 13240 | int err; |
| 13241 | char name[32]; |
| 13242 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13243 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13244 | return 0; |
| 13245 | |
| 13246 | if (alc880_is_fixed_pin(pin)) { |
| 13247 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13248 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13249 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13250 | spec->multiout.hp_nid = nid_v; |
| 13251 | else |
| 13252 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13253 | /* control HP volume/switch on the output mixer amp */ |
| 13254 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13255 | alc880_fixed_pin_idx(pin)); |
| 13256 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13257 | alc880_fixed_pin_idx(pin)); |
| 13258 | |
| 13259 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13260 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13261 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13262 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13263 | return err; |
| 13264 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13265 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13266 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13267 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13268 | return err; |
| 13269 | } else if (alc880_is_multi_pin(pin)) { |
| 13270 | /* set manual connection */ |
| 13271 | /* we have only a switch on HP-out PIN */ |
| 13272 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13273 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13274 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13275 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13276 | return err; |
| 13277 | } |
| 13278 | return 0; |
| 13279 | } |
| 13280 | |
| 13281 | /* parse the BIOS configuration and set up the alc_spec |
| 13282 | * return 1 if successful, 0 if the proper config is not found, |
| 13283 | * or a negative error code |
| 13284 | * Based on ALC880 version - had to change it to override |
| 13285 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13286 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13287 | { |
| 13288 | struct alc_spec *spec = codec->spec; |
| 13289 | int err; |
| 13290 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13291 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13292 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13293 | alc861vd_ignore); |
| 13294 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13295 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13296 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13297 | return 0; /* can't find valid BIOS pin config */ |
| 13298 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13299 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13300 | if (err < 0) |
| 13301 | return err; |
| 13302 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13303 | if (err < 0) |
| 13304 | return err; |
| 13305 | err = alc861vd_auto_create_extra_out(spec, |
| 13306 | spec->autocfg.speaker_pins[0], |
| 13307 | "Speaker"); |
| 13308 | if (err < 0) |
| 13309 | return err; |
| 13310 | err = alc861vd_auto_create_extra_out(spec, |
| 13311 | spec->autocfg.hp_pins[0], |
| 13312 | "Headphone"); |
| 13313 | if (err < 0) |
| 13314 | return err; |
| 13315 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13316 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13317 | return err; |
| 13318 | |
| 13319 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13320 | |
| 13321 | if (spec->autocfg.dig_out_pin) |
| 13322 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13323 | |
| 13324 | if (spec->kctl_alloc) |
| 13325 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13326 | |
| 13327 | spec->init_verbs[spec->num_init_verbs++] |
| 13328 | = alc861vd_volume_init_verbs; |
| 13329 | |
| 13330 | spec->num_mux_defs = 1; |
| 13331 | spec->input_mux = &spec->private_imux; |
| 13332 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13333 | err = alc_auto_add_mic_boost(codec); |
| 13334 | if (err < 0) |
| 13335 | return err; |
| 13336 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13337 | return 1; |
| 13338 | } |
| 13339 | |
| 13340 | /* additional initialization for auto-configuration model */ |
| 13341 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13342 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13343 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13344 | alc861vd_auto_init_multi_out(codec); |
| 13345 | alc861vd_auto_init_hp_out(codec); |
| 13346 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13347 | if (spec->unsol_event) |
| 13348 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13349 | } |
| 13350 | |
| 13351 | static int patch_alc861vd(struct hda_codec *codec) |
| 13352 | { |
| 13353 | struct alc_spec *spec; |
| 13354 | int err, board_config; |
| 13355 | |
| 13356 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13357 | if (spec == NULL) |
| 13358 | return -ENOMEM; |
| 13359 | |
| 13360 | codec->spec = spec; |
| 13361 | |
| 13362 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13363 | alc861vd_models, |
| 13364 | alc861vd_cfg_tbl); |
| 13365 | |
| 13366 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13367 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13368 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13369 | board_config = ALC861VD_AUTO; |
| 13370 | } |
| 13371 | |
| 13372 | if (board_config == ALC861VD_AUTO) { |
| 13373 | /* automatic parse from the BIOS config */ |
| 13374 | err = alc861vd_parse_auto_config(codec); |
| 13375 | if (err < 0) { |
| 13376 | alc_free(codec); |
| 13377 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13378 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13379 | printk(KERN_INFO |
| 13380 | "hda_codec: Cannot set up configuration " |
| 13381 | "from BIOS. Using base mode...\n"); |
| 13382 | board_config = ALC861VD_3ST; |
| 13383 | } |
| 13384 | } |
| 13385 | |
| 13386 | if (board_config != ALC861VD_AUTO) |
| 13387 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13388 | |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13389 | if (codec->vendor_id == 0x10ec0660) { |
| 13390 | spec->stream_name_analog = "ALC660-VD Analog"; |
| 13391 | spec->stream_name_digital = "ALC660-VD Digital"; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 13392 | /* always turn on EAPD */ |
| 13393 | spec->init_verbs[spec->num_init_verbs++] = alc660vd_eapd_verbs; |
Kailang Yang | 2f89328 | 2008-05-27 12:14:47 +0200 | [diff] [blame] | 13394 | } else { |
| 13395 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13396 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13397 | } |
| 13398 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13399 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13400 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13401 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13402 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13403 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13404 | |
| 13405 | spec->adc_nids = alc861vd_adc_nids; |
| 13406 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13407 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13408 | |
| 13409 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13410 | spec->num_mixers++; |
| 13411 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13412 | spec->vmaster_nid = 0x02; |
| 13413 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13414 | codec->patch_ops = alc_patch_ops; |
| 13415 | |
| 13416 | if (board_config == ALC861VD_AUTO) |
| 13417 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13418 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13419 | if (!spec->loopback.amplist) |
| 13420 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13421 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13422 | |
| 13423 | return 0; |
| 13424 | } |
| 13425 | |
| 13426 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13427 | * ALC662 support |
| 13428 | * |
| 13429 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13430 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13431 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13432 | * 6-channel independent captures. |
| 13433 | * |
| 13434 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13435 | * driver yet). |
| 13436 | */ |
| 13437 | #define ALC662_DIGOUT_NID 0x06 |
| 13438 | #define ALC662_DIGIN_NID 0x0a |
| 13439 | |
| 13440 | static hda_nid_t alc662_dac_nids[4] = { |
| 13441 | /* front, rear, clfe, rear_surr */ |
| 13442 | 0x02, 0x03, 0x04 |
| 13443 | }; |
| 13444 | |
| 13445 | static hda_nid_t alc662_adc_nids[1] = { |
| 13446 | /* ADC1-2 */ |
| 13447 | 0x09, |
| 13448 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13449 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13450 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13451 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13452 | /* input MUX */ |
| 13453 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13454 | static struct hda_input_mux alc662_capture_source = { |
| 13455 | .num_items = 4, |
| 13456 | .items = { |
| 13457 | { "Mic", 0x0 }, |
| 13458 | { "Front Mic", 0x1 }, |
| 13459 | { "Line", 0x2 }, |
| 13460 | { "CD", 0x4 }, |
| 13461 | }, |
| 13462 | }; |
| 13463 | |
| 13464 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13465 | .num_items = 2, |
| 13466 | .items = { |
| 13467 | { "Mic", 0x1 }, |
| 13468 | { "Line", 0x2 }, |
| 13469 | }, |
| 13470 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13471 | |
| 13472 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13473 | .num_items = 2, |
| 13474 | .items = { |
| 13475 | { "i-Mic", 0x1 }, |
| 13476 | { "e-Mic", 0x0 }, |
| 13477 | }, |
| 13478 | }; |
| 13479 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13480 | static struct hda_input_mux alc663_capture_source = { |
| 13481 | .num_items = 3, |
| 13482 | .items = { |
| 13483 | { "Mic", 0x0 }, |
| 13484 | { "Front Mic", 0x1 }, |
| 13485 | { "Line", 0x2 }, |
| 13486 | }, |
| 13487 | }; |
| 13488 | |
| 13489 | static struct hda_input_mux alc663_m51va_capture_source = { |
| 13490 | .num_items = 2, |
| 13491 | .items = { |
| 13492 | { "Ext-Mic", 0x0 }, |
| 13493 | { "D-Mic", 0x9 }, |
| 13494 | }, |
| 13495 | }; |
| 13496 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13497 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13498 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13499 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13500 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13501 | /* |
| 13502 | * 2ch mode |
| 13503 | */ |
| 13504 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13505 | { 2, NULL } |
| 13506 | }; |
| 13507 | |
| 13508 | /* |
| 13509 | * 2ch mode |
| 13510 | */ |
| 13511 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13512 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13513 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13516 | { } /* end */ |
| 13517 | }; |
| 13518 | |
| 13519 | /* |
| 13520 | * 6ch mode |
| 13521 | */ |
| 13522 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13523 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13524 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13525 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13526 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13527 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13528 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13529 | { } /* end */ |
| 13530 | }; |
| 13531 | |
| 13532 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13533 | { 2, alc662_3ST_ch2_init }, |
| 13534 | { 6, alc662_3ST_ch6_init }, |
| 13535 | }; |
| 13536 | |
| 13537 | /* |
| 13538 | * 2ch mode |
| 13539 | */ |
| 13540 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13541 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13542 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13543 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13544 | { } /* end */ |
| 13545 | }; |
| 13546 | |
| 13547 | /* |
| 13548 | * 6ch mode |
| 13549 | */ |
| 13550 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13551 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13552 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13553 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13554 | { } /* end */ |
| 13555 | }; |
| 13556 | |
| 13557 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13558 | { 2, alc662_sixstack_ch6_init }, |
| 13559 | { 6, alc662_sixstack_ch8_init }, |
| 13560 | }; |
| 13561 | |
| 13562 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13563 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13564 | */ |
| 13565 | |
| 13566 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13567 | /* output mixer control */ |
| 13568 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13569 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13570 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13571 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13572 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13573 | 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] | 13574 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13575 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13576 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13577 | |
| 13578 | /*Input mixer control */ |
| 13579 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13580 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13581 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13582 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13583 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13584 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13585 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13586 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13587 | { } /* end */ |
| 13588 | }; |
| 13589 | |
| 13590 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13591 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13592 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13593 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13594 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13595 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13596 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13597 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13598 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13599 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13600 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13602 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13603 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13604 | { } /* end */ |
| 13605 | }; |
| 13606 | |
| 13607 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13608 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13609 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13610 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13611 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13612 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13613 | 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] | 13614 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13615 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13616 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13617 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13618 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13619 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13620 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13621 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13622 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13623 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13624 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13625 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13626 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13627 | { } /* end */ |
| 13628 | }; |
| 13629 | |
| 13630 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13631 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13632 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13633 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13634 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13635 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13636 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13637 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13638 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13639 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13640 | { } /* end */ |
| 13641 | }; |
| 13642 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13643 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13644 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13645 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13646 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13647 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13648 | |
| 13649 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13650 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13651 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13652 | |
| 13653 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13654 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13655 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13656 | { } /* end */ |
| 13657 | }; |
| 13658 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13659 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13660 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13661 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13662 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13663 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13664 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13665 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13666 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13667 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13668 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13669 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13670 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13671 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13672 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13673 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13674 | { } /* end */ |
| 13675 | }; |
| 13676 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13677 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
| 13678 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13679 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13680 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13681 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13682 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13683 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), |
| 13684 | { } /* end */ |
| 13685 | }; |
| 13686 | |
| 13687 | static struct snd_kcontrol_new alc663_g71v_mixer[] = { |
| 13688 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13689 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13690 | HDA_CODEC_VOLUME("Front Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13691 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 13692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13693 | |
| 13694 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13696 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13697 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13698 | { } /* end */ |
| 13699 | }; |
| 13700 | |
| 13701 | static struct snd_kcontrol_new alc663_g50v_mixer[] = { |
| 13702 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13703 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 13704 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
| 13705 | |
| 13706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13708 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13709 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13710 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13711 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13712 | { } /* end */ |
| 13713 | }; |
| 13714 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13715 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13716 | { |
| 13717 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13718 | .name = "Channel Mode", |
| 13719 | .info = alc_ch_mode_info, |
| 13720 | .get = alc_ch_mode_get, |
| 13721 | .put = alc_ch_mode_put, |
| 13722 | }, |
| 13723 | { } /* end */ |
| 13724 | }; |
| 13725 | |
| 13726 | static struct hda_verb alc662_init_verbs[] = { |
| 13727 | /* ADC: mute amp left and right */ |
| 13728 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13729 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13730 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13731 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13732 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13733 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13736 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13737 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13738 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13739 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13740 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13741 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13742 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13743 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13744 | |
| 13745 | /* Front Pin: output 0 (0x0c) */ |
| 13746 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13747 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13748 | |
| 13749 | /* Rear Pin: output 1 (0x0d) */ |
| 13750 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13752 | |
| 13753 | /* CLFE Pin: output 2 (0x0e) */ |
| 13754 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13755 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13756 | |
| 13757 | /* Mic (rear) pin: input vref at 80% */ |
| 13758 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13759 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13760 | /* Front Mic pin: input vref at 80% */ |
| 13761 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13762 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13763 | /* Line In pin: input */ |
| 13764 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13765 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13766 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13767 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13768 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13769 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13770 | /* CD pin widget for input */ |
| 13771 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13772 | |
| 13773 | /* FIXME: use matrix-type input source selection */ |
| 13774 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13775 | /* Input mixer */ |
| 13776 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13777 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13778 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13779 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13780 | |
| 13781 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13782 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13783 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13784 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13785 | |
| 13786 | /* always trun on EAPD */ |
| 13787 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13788 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 13789 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13790 | { } |
| 13791 | }; |
| 13792 | |
| 13793 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13794 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13795 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13796 | {} |
| 13797 | }; |
| 13798 | |
| 13799 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13800 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13801 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13802 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13803 | }; |
| 13804 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13805 | /* Set Unsolicited Event*/ |
| 13806 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13807 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13808 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13809 | {} |
| 13810 | }; |
| 13811 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13812 | /* |
| 13813 | * generic initialization of ADC, input mixers and output mixers |
| 13814 | */ |
| 13815 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13816 | /* |
| 13817 | * Unmute ADC and set the default input to mic-in |
| 13818 | */ |
| 13819 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13820 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13821 | |
| 13822 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13823 | * mixer widget |
| 13824 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13825 | * panel mic (mic 2) |
| 13826 | */ |
| 13827 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13829 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13833 | |
| 13834 | /* |
| 13835 | * Set up output mixers (0x0c - 0x0f) |
| 13836 | */ |
| 13837 | /* set vol=0 to output mixers */ |
| 13838 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13839 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13840 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13841 | |
| 13842 | /* set up input amps for analog loopback */ |
| 13843 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13844 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13845 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13846 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13847 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13848 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13849 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13850 | |
| 13851 | |
| 13852 | /* FIXME: use matrix-type input source selection */ |
| 13853 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13854 | /* Input mixer */ |
| 13855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13856 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13857 | { } |
| 13858 | }; |
| 13859 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 13860 | static struct hda_verb alc663_m51va_init_verbs[] = { |
| 13861 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13862 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13863 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13864 | |
| 13865 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, |
| 13866 | |
| 13867 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13868 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13869 | {} |
| 13870 | }; |
| 13871 | |
| 13872 | static struct hda_verb alc663_g71v_init_verbs[] = { |
| 13873 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13874 | /* {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 13875 | /* {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, */ /* Headphone */ |
| 13876 | |
| 13877 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13878 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13879 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13880 | |
| 13881 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13882 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_MIC_EVENT}, |
| 13883 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 13884 | {} |
| 13885 | }; |
| 13886 | |
| 13887 | static struct hda_verb alc663_g50v_init_verbs[] = { |
| 13888 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13889 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13890 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ |
| 13891 | |
| 13892 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13893 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13894 | {} |
| 13895 | }; |
| 13896 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13897 | /* capture mixer elements */ |
| 13898 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13899 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13900 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13901 | { |
| 13902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13903 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13904 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13905 | */ |
| 13906 | /* .name = "Capture Source", */ |
| 13907 | .name = "Input Source", |
| 13908 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13909 | .info = alc662_mux_enum_info, |
| 13910 | .get = alc662_mux_enum_get, |
| 13911 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13912 | }, |
| 13913 | { } /* end */ |
| 13914 | }; |
| 13915 | |
| 13916 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13917 | { |
| 13918 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13919 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13920 | |
| 13921 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13922 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13923 | bits = present ? HDA_AMP_MUTE : 0; |
| 13924 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13925 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13926 | } |
| 13927 | |
| 13928 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13929 | { |
| 13930 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13931 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13932 | |
| 13933 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13934 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13935 | bits = present ? HDA_AMP_MUTE : 0; |
| 13936 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13937 | HDA_AMP_MUTE, bits); |
| 13938 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13939 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13940 | } |
| 13941 | |
| 13942 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13943 | unsigned int res) |
| 13944 | { |
| 13945 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13946 | alc662_lenovo_101e_all_automute(codec); |
| 13947 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13948 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13949 | } |
| 13950 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13951 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13952 | { |
| 13953 | unsigned int present; |
| 13954 | |
| 13955 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13956 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13957 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13958 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13959 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13960 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13961 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13962 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13963 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13964 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13965 | } |
| 13966 | |
| 13967 | /* unsolicited event for HP jack sensing */ |
| 13968 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13969 | unsigned int res) |
| 13970 | { |
| 13971 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13972 | alc262_hippo1_automute( codec ); |
| 13973 | |
| 13974 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13975 | alc662_eeepc_mic_automute(codec); |
| 13976 | } |
| 13977 | |
| 13978 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13979 | { |
| 13980 | alc262_hippo1_automute( codec ); |
| 13981 | alc662_eeepc_mic_automute(codec); |
| 13982 | } |
| 13983 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13984 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13985 | { |
| 13986 | unsigned int mute; |
| 13987 | unsigned int present; |
| 13988 | |
| 13989 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13990 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13991 | AC_VERB_GET_PIN_SENSE, 0); |
| 13992 | present = (present & 0x80000000) != 0; |
| 13993 | if (present) { |
| 13994 | /* mute internal speaker */ |
| 13995 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13996 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13997 | } else { |
| 13998 | /* unmute internal speaker if necessary */ |
| 13999 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 14000 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 14001 | HDA_AMP_MUTE, mute); |
| 14002 | } |
| 14003 | } |
| 14004 | |
| 14005 | /* unsolicited event for HP jack sensing */ |
| 14006 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 14007 | unsigned int res) |
| 14008 | { |
| 14009 | if ((res >> 26) == ALC880_HP_EVENT) |
| 14010 | alc662_eeepc_ep20_automute(codec); |
| 14011 | } |
| 14012 | |
| 14013 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 14014 | { |
| 14015 | alc662_eeepc_ep20_automute(codec); |
| 14016 | } |
| 14017 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14018 | static void alc663_m51va_speaker_automute(struct hda_codec *codec) |
| 14019 | { |
| 14020 | unsigned int present; |
| 14021 | unsigned char bits; |
| 14022 | |
| 14023 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14024 | AC_VERB_GET_PIN_SENSE, 0) |
| 14025 | & AC_PINSENSE_PRESENCE; |
| 14026 | bits = present ? HDA_AMP_MUTE : 0; |
| 14027 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14028 | HDA_AMP_MUTE, bits); |
| 14029 | } |
| 14030 | |
| 14031 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
| 14032 | { |
| 14033 | unsigned int present; |
| 14034 | |
| 14035 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 14036 | AC_VERB_GET_PIN_SENSE, 0) |
| 14037 | & AC_PINSENSE_PRESENCE; |
| 14038 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14039 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14040 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14041 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 14042 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14043 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 14044 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 14045 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
| 14046 | } |
| 14047 | |
| 14048 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
| 14049 | unsigned int res) |
| 14050 | { |
| 14051 | switch (res >> 26) { |
| 14052 | case ALC880_HP_EVENT: |
| 14053 | alc663_m51va_speaker_automute(codec); |
| 14054 | break; |
| 14055 | case ALC880_MIC_EVENT: |
| 14056 | alc663_m51va_mic_automute(codec); |
| 14057 | break; |
| 14058 | } |
| 14059 | } |
| 14060 | |
| 14061 | static void alc663_m51va_inithook(struct hda_codec *codec) |
| 14062 | { |
| 14063 | alc663_m51va_speaker_automute(codec); |
| 14064 | alc663_m51va_mic_automute(codec); |
| 14065 | } |
| 14066 | |
| 14067 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
| 14068 | { |
| 14069 | unsigned int present; |
| 14070 | unsigned char bits; |
| 14071 | |
| 14072 | present = snd_hda_codec_read(codec, 0x21, 0, |
| 14073 | AC_VERB_GET_PIN_SENSE, 0) |
| 14074 | & AC_PINSENSE_PRESENCE; |
| 14075 | bits = present ? HDA_AMP_MUTE : 0; |
| 14076 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 14077 | HDA_AMP_MUTE, bits); |
| 14078 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14079 | HDA_AMP_MUTE, bits); |
| 14080 | } |
| 14081 | |
| 14082 | static void alc663_g71v_front_automute(struct hda_codec *codec) |
| 14083 | { |
| 14084 | unsigned int present; |
| 14085 | unsigned char bits; |
| 14086 | |
| 14087 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 14088 | AC_VERB_GET_PIN_SENSE, 0) |
| 14089 | & AC_PINSENSE_PRESENCE; |
| 14090 | bits = present ? HDA_AMP_MUTE : 0; |
| 14091 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 14092 | HDA_AMP_MUTE, bits); |
| 14093 | } |
| 14094 | |
| 14095 | static void alc663_g71v_unsol_event(struct hda_codec *codec, |
| 14096 | unsigned int res) |
| 14097 | { |
| 14098 | switch (res >> 26) { |
| 14099 | case ALC880_HP_EVENT: |
| 14100 | alc663_g71v_hp_automute(codec); |
| 14101 | break; |
| 14102 | case ALC880_FRONT_EVENT: |
| 14103 | alc663_g71v_front_automute(codec); |
| 14104 | break; |
| 14105 | case ALC880_MIC_EVENT: |
| 14106 | alc662_eeepc_mic_automute(codec); |
| 14107 | break; |
| 14108 | } |
| 14109 | } |
| 14110 | |
| 14111 | static void alc663_g71v_inithook(struct hda_codec *codec) |
| 14112 | { |
| 14113 | alc663_g71v_front_automute(codec); |
| 14114 | alc663_g71v_hp_automute(codec); |
| 14115 | alc662_eeepc_mic_automute(codec); |
| 14116 | } |
| 14117 | |
| 14118 | static void alc663_g50v_unsol_event(struct hda_codec *codec, |
| 14119 | unsigned int res) |
| 14120 | { |
| 14121 | switch (res >> 26) { |
| 14122 | case ALC880_HP_EVENT: |
| 14123 | alc663_m51va_speaker_automute(codec); |
| 14124 | break; |
| 14125 | case ALC880_MIC_EVENT: |
| 14126 | alc662_eeepc_mic_automute(codec); |
| 14127 | break; |
| 14128 | } |
| 14129 | } |
| 14130 | |
| 14131 | static void alc663_g50v_inithook(struct hda_codec *codec) |
| 14132 | { |
| 14133 | alc663_m51va_speaker_automute(codec); |
| 14134 | alc662_eeepc_mic_automute(codec); |
| 14135 | } |
| 14136 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14137 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14138 | #define alc662_loopbacks alc880_loopbacks |
| 14139 | #endif |
| 14140 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14141 | |
| 14142 | /* pcm configuration: identiacal with ALC880 */ |
| 14143 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 14144 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 14145 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 14146 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 14147 | |
| 14148 | /* |
| 14149 | * configuration and preset |
| 14150 | */ |
| 14151 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 14152 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 14153 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 14154 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 14155 | [ALC662_5ST_DIG] = "6stack-dig", |
| 14156 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 14157 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14158 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14159 | [ALC663_ASUS_M51VA] = "m51va", |
| 14160 | [ALC663_ASUS_G71V] = "g71v", |
| 14161 | [ALC663_ASUS_H13] = "h13", |
| 14162 | [ALC663_ASUS_G50V] = "g50v", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14163 | [ALC662_AUTO] = "auto", |
| 14164 | }; |
| 14165 | |
| 14166 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14167 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS G71V", ALC663_ASUS_G71V), |
| 14168 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
| 14169 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 14170 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14171 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14172 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 14173 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14174 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
| 14175 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
| 14176 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14177 | {} |
| 14178 | }; |
| 14179 | |
| 14180 | static struct alc_config_preset alc662_presets[] = { |
| 14181 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14182 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14183 | .init_verbs = { alc662_init_verbs }, |
| 14184 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14185 | .dac_nids = alc662_dac_nids, |
| 14186 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14187 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14188 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14189 | .channel_mode = alc662_3ST_2ch_modes, |
| 14190 | .input_mux = &alc662_capture_source, |
| 14191 | }, |
| 14192 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14193 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14194 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14195 | .init_verbs = { alc662_init_verbs }, |
| 14196 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14197 | .dac_nids = alc662_dac_nids, |
| 14198 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14199 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14200 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14201 | .channel_mode = alc662_3ST_6ch_modes, |
| 14202 | .need_dac_fix = 1, |
| 14203 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14204 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14205 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14206 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 14207 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14208 | .init_verbs = { alc662_init_verbs }, |
| 14209 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14210 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14211 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14212 | .channel_mode = alc662_3ST_6ch_modes, |
| 14213 | .need_dac_fix = 1, |
| 14214 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14215 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14216 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14217 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 14218 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14219 | .init_verbs = { alc662_init_verbs }, |
| 14220 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14221 | .dac_nids = alc662_dac_nids, |
| 14222 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14223 | .dig_in_nid = ALC662_DIGIN_NID, |
| 14224 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 14225 | .channel_mode = alc662_5stack_modes, |
| 14226 | .input_mux = &alc662_capture_source, |
| 14227 | }, |
| 14228 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14229 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14230 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 14231 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14232 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14233 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14234 | .channel_mode = alc662_3ST_2ch_modes, |
| 14235 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14236 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 14237 | .init_hook = alc662_lenovo_101e_all_automute, |
| 14238 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14239 | [ALC662_ASUS_EEEPC_P701] = { |
| 14240 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 14241 | .init_verbs = { alc662_init_verbs, |
| 14242 | alc662_eeepc_sue_init_verbs }, |
| 14243 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14244 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 14245 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14246 | .channel_mode = alc662_3ST_2ch_modes, |
| 14247 | .input_mux = &alc662_eeepc_capture_source, |
| 14248 | .unsol_event = alc662_eeepc_unsol_event, |
| 14249 | .init_hook = alc662_eeepc_inithook, |
| 14250 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14251 | [ALC662_ASUS_EEEPC_EP20] = { |
| 14252 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 14253 | alc662_chmode_mixer }, |
| 14254 | .init_verbs = { alc662_init_verbs, |
| 14255 | alc662_eeepc_ep20_sue_init_verbs }, |
| 14256 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14257 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14258 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14259 | .channel_mode = alc662_3ST_6ch_modes, |
| 14260 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 14261 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 14262 | .init_hook = alc662_eeepc_ep20_inithook, |
| 14263 | }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14264 | [ALC663_ASUS_M51VA] = { |
| 14265 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14266 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14267 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14268 | .dac_nids = alc662_dac_nids, |
| 14269 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14270 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14271 | .channel_mode = alc662_3ST_2ch_modes, |
| 14272 | .input_mux = &alc663_m51va_capture_source, |
| 14273 | .unsol_event = alc663_m51va_unsol_event, |
| 14274 | .init_hook = alc663_m51va_inithook, |
| 14275 | }, |
| 14276 | [ALC663_ASUS_G71V] = { |
| 14277 | .mixers = { alc663_g71v_mixer, alc662_capture_mixer}, |
| 14278 | .init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs }, |
| 14279 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14280 | .dac_nids = alc662_dac_nids, |
| 14281 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14282 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14283 | .channel_mode = alc662_3ST_2ch_modes, |
| 14284 | .input_mux = &alc662_eeepc_capture_source, |
| 14285 | .unsol_event = alc663_g71v_unsol_event, |
| 14286 | .init_hook = alc663_g71v_inithook, |
| 14287 | }, |
| 14288 | [ALC663_ASUS_H13] = { |
| 14289 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
| 14290 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
| 14291 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14292 | .dac_nids = alc662_dac_nids, |
| 14293 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 14294 | .channel_mode = alc662_3ST_2ch_modes, |
| 14295 | .input_mux = &alc663_m51va_capture_source, |
| 14296 | .unsol_event = alc663_m51va_unsol_event, |
| 14297 | .init_hook = alc663_m51va_inithook, |
| 14298 | }, |
| 14299 | [ALC663_ASUS_G50V] = { |
| 14300 | .mixers = { alc663_g50v_mixer, alc662_capture_mixer}, |
| 14301 | .init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs }, |
| 14302 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 14303 | .dac_nids = alc662_dac_nids, |
| 14304 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 14305 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 14306 | .channel_mode = alc662_3ST_6ch_modes, |
| 14307 | .input_mux = &alc663_capture_source, |
| 14308 | .unsol_event = alc663_g50v_unsol_event, |
| 14309 | .init_hook = alc663_g50v_inithook, |
| 14310 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14311 | }; |
| 14312 | |
| 14313 | |
| 14314 | /* |
| 14315 | * BIOS auto configuration |
| 14316 | */ |
| 14317 | |
| 14318 | /* add playback controls from the parsed DAC table */ |
| 14319 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 14320 | const struct auto_pin_cfg *cfg) |
| 14321 | { |
| 14322 | char name[32]; |
| 14323 | static const char *chname[4] = { |
| 14324 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 14325 | }; |
| 14326 | hda_nid_t nid; |
| 14327 | int i, err; |
| 14328 | |
| 14329 | for (i = 0; i < cfg->line_outs; i++) { |
| 14330 | if (!spec->multiout.dac_nids[i]) |
| 14331 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 14332 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14333 | if (i == 2) { |
| 14334 | /* Center/LFE */ |
| 14335 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14336 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14337 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 14338 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14339 | if (err < 0) |
| 14340 | return err; |
| 14341 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 14342 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14343 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 14344 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14345 | if (err < 0) |
| 14346 | return err; |
| 14347 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14348 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14349 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 14350 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14351 | if (err < 0) |
| 14352 | return err; |
| 14353 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 14354 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14355 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 14356 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14357 | if (err < 0) |
| 14358 | return err; |
| 14359 | } else { |
| 14360 | sprintf(name, "%s Playback Volume", chname[i]); |
| 14361 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14362 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 14363 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14364 | if (err < 0) |
| 14365 | return err; |
| 14366 | sprintf(name, "%s Playback Switch", chname[i]); |
| 14367 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14368 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 14369 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14370 | if (err < 0) |
| 14371 | return err; |
| 14372 | } |
| 14373 | } |
| 14374 | return 0; |
| 14375 | } |
| 14376 | |
| 14377 | /* add playback controls for speaker and HP outputs */ |
| 14378 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 14379 | const char *pfx) |
| 14380 | { |
| 14381 | hda_nid_t nid; |
| 14382 | int err; |
| 14383 | char name[32]; |
| 14384 | |
| 14385 | if (!pin) |
| 14386 | return 0; |
| 14387 | |
| 14388 | if (alc880_is_fixed_pin(pin)) { |
| 14389 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14390 | /* printk("DAC nid=%x\n",nid); */ |
| 14391 | /* specify the DAC as the extra output */ |
| 14392 | if (!spec->multiout.hp_nid) |
| 14393 | spec->multiout.hp_nid = nid; |
| 14394 | else |
| 14395 | spec->multiout.extra_out_nid[0] = nid; |
| 14396 | /* control HP volume/switch on the output mixer amp */ |
| 14397 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 14398 | sprintf(name, "%s Playback Volume", pfx); |
| 14399 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 14400 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 14401 | if (err < 0) |
| 14402 | return err; |
| 14403 | sprintf(name, "%s Playback Switch", pfx); |
| 14404 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 14405 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 14406 | if (err < 0) |
| 14407 | return err; |
| 14408 | } else if (alc880_is_multi_pin(pin)) { |
| 14409 | /* set manual connection */ |
| 14410 | /* we have only a switch on HP-out PIN */ |
| 14411 | sprintf(name, "%s Playback Switch", pfx); |
| 14412 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 14413 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 14414 | if (err < 0) |
| 14415 | return err; |
| 14416 | } |
| 14417 | return 0; |
| 14418 | } |
| 14419 | |
| 14420 | /* create playback/capture controls for input pins */ |
| 14421 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 14422 | const struct auto_pin_cfg *cfg) |
| 14423 | { |
| 14424 | struct hda_input_mux *imux = &spec->private_imux; |
| 14425 | int i, err, idx; |
| 14426 | |
| 14427 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14428 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 14429 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 14430 | err = new_analog_input(spec, cfg->input_pins[i], |
| 14431 | auto_pin_cfg_labels[i], |
| 14432 | idx, 0x0b); |
| 14433 | if (err < 0) |
| 14434 | return err; |
| 14435 | imux->items[imux->num_items].label = |
| 14436 | auto_pin_cfg_labels[i]; |
| 14437 | imux->items[imux->num_items].index = |
| 14438 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 14439 | imux->num_items++; |
| 14440 | } |
| 14441 | } |
| 14442 | return 0; |
| 14443 | } |
| 14444 | |
| 14445 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 14446 | hda_nid_t nid, int pin_type, |
| 14447 | int dac_idx) |
| 14448 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14449 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14450 | /* need the manual connection? */ |
| 14451 | if (alc880_is_multi_pin(nid)) { |
| 14452 | struct alc_spec *spec = codec->spec; |
| 14453 | int idx = alc880_multi_pin_idx(nid); |
| 14454 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 14455 | AC_VERB_SET_CONNECT_SEL, |
| 14456 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 14457 | } |
| 14458 | } |
| 14459 | |
| 14460 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 14461 | { |
| 14462 | struct alc_spec *spec = codec->spec; |
| 14463 | int i; |
| 14464 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 14465 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14466 | for (i = 0; i <= HDA_SIDE; i++) { |
| 14467 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14468 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14469 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 14470 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14471 | i); |
| 14472 | } |
| 14473 | } |
| 14474 | |
| 14475 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 14476 | { |
| 14477 | struct alc_spec *spec = codec->spec; |
| 14478 | hda_nid_t pin; |
| 14479 | |
| 14480 | pin = spec->autocfg.hp_pins[0]; |
| 14481 | if (pin) /* connect to front */ |
| 14482 | /* use dac 0 */ |
| 14483 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14484 | pin = spec->autocfg.speaker_pins[0]; |
| 14485 | if (pin) |
| 14486 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14487 | } |
| 14488 | |
| 14489 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 14490 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 14491 | |
| 14492 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 14493 | { |
| 14494 | struct alc_spec *spec = codec->spec; |
| 14495 | int i; |
| 14496 | |
| 14497 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14498 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14499 | if (alc662_is_input_pin(nid)) { |
| 14500 | snd_hda_codec_write(codec, nid, 0, |
| 14501 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14502 | (i <= AUTO_PIN_FRONT_MIC ? |
| 14503 | PIN_VREF80 : PIN_IN)); |
| 14504 | if (nid != ALC662_PIN_CD_NID) |
| 14505 | snd_hda_codec_write(codec, nid, 0, |
| 14506 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14507 | AMP_OUT_MUTE); |
| 14508 | } |
| 14509 | } |
| 14510 | } |
| 14511 | |
| 14512 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 14513 | { |
| 14514 | struct alc_spec *spec = codec->spec; |
| 14515 | int err; |
| 14516 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 14517 | |
| 14518 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14519 | alc662_ignore); |
| 14520 | if (err < 0) |
| 14521 | return err; |
| 14522 | if (!spec->autocfg.line_outs) |
| 14523 | return 0; /* can't find valid BIOS pin config */ |
| 14524 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14525 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14526 | if (err < 0) |
| 14527 | return err; |
| 14528 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14529 | if (err < 0) |
| 14530 | return err; |
| 14531 | err = alc662_auto_create_extra_out(spec, |
| 14532 | spec->autocfg.speaker_pins[0], |
| 14533 | "Speaker"); |
| 14534 | if (err < 0) |
| 14535 | return err; |
| 14536 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 14537 | "Headphone"); |
| 14538 | if (err < 0) |
| 14539 | return err; |
| 14540 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14541 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14542 | return err; |
| 14543 | |
| 14544 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14545 | |
| 14546 | if (spec->autocfg.dig_out_pin) |
| 14547 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 14548 | |
| 14549 | if (spec->kctl_alloc) |
| 14550 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14551 | |
| 14552 | spec->num_mux_defs = 1; |
| 14553 | spec->input_mux = &spec->private_imux; |
| 14554 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14555 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14556 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 14557 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14558 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14559 | } |
| 14560 | |
| 14561 | /* additional initialization for auto-configuration model */ |
| 14562 | static void alc662_auto_init(struct hda_codec *codec) |
| 14563 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14564 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14565 | alc662_auto_init_multi_out(codec); |
| 14566 | alc662_auto_init_hp_out(codec); |
| 14567 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14568 | if (spec->unsol_event) |
| 14569 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14570 | } |
| 14571 | |
| 14572 | static int patch_alc662(struct hda_codec *codec) |
| 14573 | { |
| 14574 | struct alc_spec *spec; |
| 14575 | int err, board_config; |
| 14576 | |
| 14577 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14578 | if (!spec) |
| 14579 | return -ENOMEM; |
| 14580 | |
| 14581 | codec->spec = spec; |
| 14582 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 14583 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 14584 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14585 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 14586 | alc662_models, |
| 14587 | alc662_cfg_tbl); |
| 14588 | if (board_config < 0) { |
| 14589 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14590 | "trying auto-probe from BIOS...\n"); |
| 14591 | board_config = ALC662_AUTO; |
| 14592 | } |
| 14593 | |
| 14594 | if (board_config == ALC662_AUTO) { |
| 14595 | /* automatic parse from the BIOS config */ |
| 14596 | err = alc662_parse_auto_config(codec); |
| 14597 | if (err < 0) { |
| 14598 | alc_free(codec); |
| 14599 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14600 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14601 | printk(KERN_INFO |
| 14602 | "hda_codec: Cannot set up configuration " |
| 14603 | "from BIOS. Using base mode...\n"); |
| 14604 | board_config = ALC662_3ST_2ch_DIG; |
| 14605 | } |
| 14606 | } |
| 14607 | |
| 14608 | if (board_config != ALC662_AUTO) |
| 14609 | setup_preset(spec, &alc662_presets[board_config]); |
| 14610 | |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14611 | if (codec->vendor_id == 0x10ec0663) { |
| 14612 | spec->stream_name_analog = "ALC663 Analog"; |
| 14613 | spec->stream_name_digital = "ALC663 Digital"; |
| 14614 | } else { |
| 14615 | spec->stream_name_analog = "ALC662 Analog"; |
| 14616 | spec->stream_name_digital = "ALC662 Digital"; |
| 14617 | } |
| 14618 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14619 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14620 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14621 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14622 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14623 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14624 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14625 | spec->adc_nids = alc662_adc_nids; |
| 14626 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14627 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14628 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14629 | spec->vmaster_nid = 0x02; |
| 14630 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14631 | codec->patch_ops = alc_patch_ops; |
| 14632 | if (board_config == ALC662_AUTO) |
| 14633 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14634 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14635 | if (!spec->loopback.amplist) |
| 14636 | spec->loopback.amplist = alc662_loopbacks; |
| 14637 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14638 | |
| 14639 | return 0; |
| 14640 | } |
| 14641 | |
| 14642 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14643 | * patch entries |
| 14644 | */ |
| 14645 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14646 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14647 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14648 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14649 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14650 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14651 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14652 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14653 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14654 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14655 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14656 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14657 | .patch = patch_alc883 }, |
| 14658 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14659 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 14660 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14661 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14662 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14663 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 14664 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 14665 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14666 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14667 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14668 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14669 | {} /* terminator */ |
| 14670 | }; |