Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
Harvey Harrison | 3c9a320 | 2008-02-29 11:59:26 +0100 | [diff] [blame] | 33 | #include "hda_patch.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 35 | #define ALC880_FRONT_EVENT 0x01 |
| 36 | #define ALC880_DCVOL_EVENT 0x02 |
| 37 | #define ALC880_HP_EVENT 0x04 |
| 38 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | /* ALC880 board config type */ |
| 41 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | ALC880_3ST, |
| 43 | ALC880_3ST_DIG, |
| 44 | ALC880_5ST, |
| 45 | ALC880_5ST_DIG, |
| 46 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 47 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 48 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 49 | ALC880_6ST_DIG, |
| 50 | ALC880_F1734, |
| 51 | ALC880_ASUS, |
| 52 | ALC880_ASUS_DIG, |
| 53 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 54 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 55 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 57 | ALC880_UNIWILL, |
| 58 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 59 | ALC880_CLEVO, |
| 60 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 61 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 62 | ALC880_LG_LW, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 63 | ALC880_MEDION_RIM, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 64 | #ifdef CONFIG_SND_DEBUG |
| 65 | ALC880_TEST, |
| 66 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 67 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 68 | ALC880_MODEL_LAST /* last tag */ |
| 69 | }; |
| 70 | |
| 71 | /* ALC260 models */ |
| 72 | enum { |
| 73 | ALC260_BASIC, |
| 74 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 75 | ALC260_HP_3013, |
| 76 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 77 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 78 | ALC260_WILL, |
| 79 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 80 | #ifdef CONFIG_SND_DEBUG |
| 81 | ALC260_TEST, |
| 82 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 83 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 84 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | }; |
| 86 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 87 | /* ALC262 models */ |
| 88 | enum { |
| 89 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 90 | ALC262_HIPPO, |
| 91 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 92 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 93 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 94 | ALC262_HP_BPC_D7000_WL, |
| 95 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 96 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 97 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 98 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 99 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 100 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 101 | ALC262_ULTRA, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 102 | ALC262_LENOVO_3000, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 103 | ALC262_AUTO, |
| 104 | ALC262_MODEL_LAST /* last tag */ |
| 105 | }; |
| 106 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 107 | /* ALC268 models */ |
| 108 | enum { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 109 | ALC267_QUANTA_IL1, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 110 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 111 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 112 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 113 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 114 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 115 | #ifdef CONFIG_SND_DEBUG |
| 116 | ALC268_TEST, |
| 117 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 118 | ALC268_AUTO, |
| 119 | ALC268_MODEL_LAST /* last tag */ |
| 120 | }; |
| 121 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 122 | /* ALC269 models */ |
| 123 | enum { |
| 124 | ALC269_BASIC, |
| 125 | ALC269_AUTO, |
| 126 | ALC269_MODEL_LAST /* last tag */ |
| 127 | }; |
| 128 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 129 | /* ALC861 models */ |
| 130 | enum { |
| 131 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 132 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 133 | ALC861_3ST_DIG, |
| 134 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 135 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 136 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 137 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 138 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 139 | ALC861_AUTO, |
| 140 | ALC861_MODEL_LAST, |
| 141 | }; |
| 142 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 143 | /* ALC861-VD models */ |
| 144 | enum { |
| 145 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 146 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 147 | ALC861VD_3ST, |
| 148 | ALC861VD_3ST_DIG, |
| 149 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 150 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 151 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 152 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 153 | ALC861VD_AUTO, |
| 154 | ALC861VD_MODEL_LAST, |
| 155 | }; |
| 156 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 157 | /* ALC662 models */ |
| 158 | enum { |
| 159 | ALC662_3ST_2ch_DIG, |
| 160 | ALC662_3ST_6ch_DIG, |
| 161 | ALC662_3ST_6ch, |
| 162 | ALC662_5ST_DIG, |
| 163 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 164 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 165 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 166 | ALC662_AUTO, |
| 167 | ALC662_MODEL_LAST, |
| 168 | }; |
| 169 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 170 | /* ALC882 models */ |
| 171 | enum { |
| 172 | ALC882_3ST_DIG, |
| 173 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 174 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 175 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 176 | ALC882_TARGA, |
| 177 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 178 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 179 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 180 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 181 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 182 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 183 | ALC882_MODEL_LAST, |
| 184 | }; |
| 185 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 186 | /* ALC883 models */ |
| 187 | enum { |
| 188 | ALC883_3ST_2ch_DIG, |
| 189 | ALC883_3ST_6ch_DIG, |
| 190 | ALC883_3ST_6ch, |
| 191 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 192 | ALC883_TARGA_DIG, |
| 193 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 194 | ALC883_ACER, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 195 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 196 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 197 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 198 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 199 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 200 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 201 | ALC888_LENOVO_MS7195_DIG, |
| 202 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 203 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 204 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 205 | ALC883_MITAC, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 206 | ALC883_CLEVO_M720, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 207 | ALC883_FUJITSU_PI2515, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 208 | ALC883_AUTO, |
| 209 | ALC883_MODEL_LAST, |
| 210 | }; |
| 211 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | /* for GPIO Poll */ |
| 213 | #define GPIO_MASK 0x03 |
| 214 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 215 | struct alc_spec { |
| 216 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 217 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | unsigned int num_mixers; |
| 219 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 220 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 221 | * don't forget NULL |
| 222 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 223 | */ |
| 224 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 226 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | struct hda_pcm_stream *stream_analog_playback; |
| 228 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 229 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 230 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 232 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | struct hda_pcm_stream *stream_digital_playback; |
| 234 | struct hda_pcm_stream *stream_digital_capture; |
| 235 | |
| 236 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 237 | struct hda_multi_out multiout; /* playback set-up |
| 238 | * max_channels, dacs must be set |
| 239 | * dig_out_nid and hp_nid are optional |
| 240 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 241 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 242 | |
| 243 | /* capture */ |
| 244 | unsigned int num_adc_nids; |
| 245 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 246 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 247 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
| 249 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 250 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | const struct hda_input_mux *input_mux; |
| 252 | unsigned int cur_mux[3]; |
| 253 | |
| 254 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 255 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 256 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 257 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | |
| 259 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 260 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 261 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 262 | /* dynamic controls, init_verbs and input_mux */ |
| 263 | struct auto_pin_cfg autocfg; |
| 264 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 265 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 266 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 267 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 268 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 269 | /* hooks */ |
| 270 | void (*init_hook)(struct hda_codec *codec); |
| 271 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 272 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 273 | /* for pin sensing */ |
| 274 | unsigned int sense_updated: 1; |
| 275 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 276 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 277 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 278 | /* for virtual master */ |
| 279 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 280 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 281 | struct hda_loopback_check loopback; |
| 282 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 283 | }; |
| 284 | |
| 285 | /* |
| 286 | * configuration template - to be copied to the spec instance |
| 287 | */ |
| 288 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 289 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 290 | * with spec |
| 291 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 292 | const struct hda_verb *init_verbs[5]; |
| 293 | unsigned int num_dacs; |
| 294 | hda_nid_t *dac_nids; |
| 295 | hda_nid_t dig_out_nid; /* optional */ |
| 296 | hda_nid_t hp_nid; /* optional */ |
| 297 | unsigned int num_adc_nids; |
| 298 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 299 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 300 | hda_nid_t dig_in_nid; |
| 301 | unsigned int num_channel_mode; |
| 302 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 303 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 304 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 305 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 306 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 307 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 308 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 309 | struct hda_amp_list *loopbacks; |
| 310 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | }; |
| 312 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | |
| 314 | /* |
| 315 | * input MUX handling |
| 316 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 317 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 318 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | { |
| 320 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 321 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 322 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 323 | if (mux_idx >= spec->num_mux_defs) |
| 324 | mux_idx = 0; |
| 325 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 | } |
| 327 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 328 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 329 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | { |
| 331 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 332 | struct alc_spec *spec = codec->spec; |
| 333 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 334 | |
| 335 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 336 | return 0; |
| 337 | } |
| 338 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 340 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | { |
| 342 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 343 | struct alc_spec *spec = codec->spec; |
| 344 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 345 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 346 | hda_nid_t nid = spec->capsrc_nids ? |
| 347 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 348 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 349 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | } |
| 351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 352 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | /* |
| 354 | * channel mode setting |
| 355 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 356 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 357 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | { |
| 359 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 360 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 361 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 362 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 363 | } |
| 364 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 365 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 366 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | { |
| 368 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 369 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 370 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 371 | spec->num_channel_mode, |
| 372 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | } |
| 374 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 375 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 376 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | { |
| 378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 379 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 380 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 381 | spec->num_channel_mode, |
| 382 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 383 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 384 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 385 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 386 | } |
| 387 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 388 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 389 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 390 | * instead of "%" to avoid consequences of accidently treating the % as |
| 391 | * being part of a format specifier. Maximum allowed length of a value is |
| 392 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 393 | * |
| 394 | * Note: some retasking pin complexes seem to ignore requests for input |
| 395 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 396 | * are requested. Therefore order this list so that this behaviour will not |
| 397 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 398 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 399 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 400 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 401 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 402 | "Mic 50pc bias", "Mic 80pc bias", |
| 403 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 404 | }; |
| 405 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 406 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 407 | }; |
| 408 | /* The control can present all 5 options, or it can limit the options based |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 409 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 410 | * addition, "input" pins may or may not process the mic bias option |
| 411 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 412 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 413 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 414 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 415 | #define ALC_PIN_DIR_IN 0x00 |
| 416 | #define ALC_PIN_DIR_OUT 0x01 |
| 417 | #define ALC_PIN_DIR_INOUT 0x02 |
| 418 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 419 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 420 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 421 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 422 | * For each direction the minimum and maximum values are given. |
| 423 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 424 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 426 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 427 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 428 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 429 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 430 | }; |
| 431 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 432 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 433 | #define alc_pin_mode_n_items(_dir) \ |
| 434 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 435 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 436 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 437 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 438 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 439 | unsigned int item_num = uinfo->value.enumerated.item; |
| 440 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 441 | |
| 442 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 443 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 444 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 445 | |
| 446 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 447 | item_num = alc_pin_mode_min(dir); |
| 448 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 449 | return 0; |
| 450 | } |
| 451 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 452 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 453 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 454 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 455 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 456 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 457 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 458 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 459 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 460 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 461 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 462 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 463 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 464 | /* Find enumerated value for current pinctl setting */ |
| 465 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 466 | while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 467 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 468 | *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | return 0; |
| 470 | } |
| 471 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 472 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 473 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | { |
| 475 | signed int change; |
| 476 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 477 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 478 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 479 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 480 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 481 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 482 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 483 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 484 | if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 485 | val = alc_pin_mode_min(dir); |
| 486 | |
| 487 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 488 | if (change) { |
| 489 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 490 | snd_hda_codec_write_cache(codec, nid, 0, |
| 491 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 492 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 493 | |
| 494 | /* Also enable the retasking pin's input/output as required |
| 495 | * for the requested pin mode. Enum values of 2 or less are |
| 496 | * input modes. |
| 497 | * |
| 498 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 499 | * reduces noise slightly (particularly on input) so we'll |
| 500 | * do it. However, having both input and output buffers |
| 501 | * enabled simultaneously doesn't seem to be problematic if |
| 502 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 503 | */ |
| 504 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 505 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 506 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 507 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 508 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 509 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 510 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 511 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 512 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 513 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 514 | } |
| 515 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 516 | return change; |
| 517 | } |
| 518 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 519 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 520 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 521 | .info = alc_pin_mode_info, \ |
| 522 | .get = alc_pin_mode_get, \ |
| 523 | .put = alc_pin_mode_put, \ |
| 524 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 525 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 526 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 527 | * together using a mask with more than one bit set. This control is |
| 528 | * currently used only by the ALC260 test model. At this stage they are not |
| 529 | * needed for any "production" models. |
| 530 | */ |
| 531 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 532 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 533 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 534 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 535 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 536 | { |
| 537 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 538 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 539 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 540 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 541 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 542 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 543 | |
| 544 | *valp = (val & mask) != 0; |
| 545 | return 0; |
| 546 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 547 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 548 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 549 | { |
| 550 | signed int change; |
| 551 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 552 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 553 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 554 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 556 | AC_VERB_GET_GPIO_DATA, |
| 557 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 558 | |
| 559 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 560 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 561 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 562 | gpio_data &= ~mask; |
| 563 | else |
| 564 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 565 | snd_hda_codec_write_cache(codec, nid, 0, |
| 566 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 567 | |
| 568 | return change; |
| 569 | } |
| 570 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 571 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 572 | .info = alc_gpio_data_info, \ |
| 573 | .get = alc_gpio_data_get, \ |
| 574 | .put = alc_gpio_data_put, \ |
| 575 | .private_value = nid | (mask<<16) } |
| 576 | #endif /* CONFIG_SND_DEBUG */ |
| 577 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 578 | /* A switch control to allow the enabling of the digital IO pins on the |
| 579 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 580 | * to provide something in the test model allowing digital outputs to be |
| 581 | * identified if present. If models are found which can utilise these |
| 582 | * outputs a more complete mixer control can be devised for those models if |
| 583 | * necessary. |
| 584 | */ |
| 585 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 586 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 587 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 588 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 589 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 590 | { |
| 591 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 592 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 593 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 594 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 595 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 596 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 597 | |
| 598 | *valp = (val & mask) != 0; |
| 599 | return 0; |
| 600 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 601 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 602 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 603 | { |
| 604 | signed int change; |
| 605 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 606 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 607 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 608 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 610 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 611 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | |
| 613 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 614 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 615 | if (val==0) |
| 616 | ctrl_data &= ~mask; |
| 617 | else |
| 618 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 619 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 620 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 621 | |
| 622 | return change; |
| 623 | } |
| 624 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 625 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 626 | .info = alc_spdif_ctrl_info, \ |
| 627 | .get = alc_spdif_ctrl_get, \ |
| 628 | .put = alc_spdif_ctrl_put, \ |
| 629 | .private_value = nid | (mask<<16) } |
| 630 | #endif /* CONFIG_SND_DEBUG */ |
| 631 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 632 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 633 | * Again, this is only used in the ALC26x test models to help identify when |
| 634 | * the EAPD line must be asserted for features to work. |
| 635 | */ |
| 636 | #ifdef CONFIG_SND_DEBUG |
| 637 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 638 | |
| 639 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 640 | struct snd_ctl_elem_value *ucontrol) |
| 641 | { |
| 642 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 643 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 644 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 645 | long *valp = ucontrol->value.integer.value; |
| 646 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 647 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 648 | |
| 649 | *valp = (val & mask) != 0; |
| 650 | return 0; |
| 651 | } |
| 652 | |
| 653 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 654 | struct snd_ctl_elem_value *ucontrol) |
| 655 | { |
| 656 | int change; |
| 657 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 658 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 659 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 660 | long val = *ucontrol->value.integer.value; |
| 661 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 662 | AC_VERB_GET_EAPD_BTLENABLE, |
| 663 | 0x00); |
| 664 | |
| 665 | /* Set/unset the masked control bit(s) as needed */ |
| 666 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 667 | if (!val) |
| 668 | ctrl_data &= ~mask; |
| 669 | else |
| 670 | ctrl_data |= mask; |
| 671 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 672 | ctrl_data); |
| 673 | |
| 674 | return change; |
| 675 | } |
| 676 | |
| 677 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 678 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 679 | .info = alc_eapd_ctrl_info, \ |
| 680 | .get = alc_eapd_ctrl_get, \ |
| 681 | .put = alc_eapd_ctrl_put, \ |
| 682 | .private_value = nid | (mask<<16) } |
| 683 | #endif /* CONFIG_SND_DEBUG */ |
| 684 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 685 | /* |
| 686 | * set up from the preset table |
| 687 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 688 | static void setup_preset(struct alc_spec *spec, |
| 689 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 690 | { |
| 691 | int i; |
| 692 | |
| 693 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 694 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 695 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 696 | i++) |
| 697 | spec->init_verbs[spec->num_init_verbs++] = |
| 698 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 699 | |
| 700 | spec->channel_mode = preset->channel_mode; |
| 701 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 702 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 703 | |
| 704 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 705 | |
| 706 | spec->multiout.num_dacs = preset->num_dacs; |
| 707 | spec->multiout.dac_nids = preset->dac_nids; |
| 708 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 709 | spec->multiout.hp_nid = preset->hp_nid; |
| 710 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 711 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 712 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 713 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 714 | spec->input_mux = preset->input_mux; |
| 715 | |
| 716 | spec->num_adc_nids = preset->num_adc_nids; |
| 717 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 718 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 719 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 720 | |
| 721 | spec->unsol_event = preset->unsol_event; |
| 722 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 723 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 724 | spec->loopback.amplist = preset->loopbacks; |
| 725 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 726 | } |
| 727 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 728 | /* Enable GPIO mask and set output */ |
| 729 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 730 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 731 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 732 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 733 | { } |
| 734 | }; |
| 735 | |
| 736 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 737 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 738 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 739 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 740 | { } |
| 741 | }; |
| 742 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 743 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 744 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 745 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 746 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 747 | { } |
| 748 | }; |
| 749 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 750 | static void alc_sku_automute(struct hda_codec *codec) |
| 751 | { |
| 752 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 753 | unsigned int present; |
| 754 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 755 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 756 | |
| 757 | /* need to execute and sync at first */ |
| 758 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 759 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 760 | AC_VERB_GET_PIN_SENSE, 0); |
| 761 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 762 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 763 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 764 | } |
| 765 | |
| 766 | /* unsolicited event for HP jack sensing */ |
| 767 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 768 | { |
| 769 | if (codec->vendor_id == 0x10ec0880) |
| 770 | res >>= 28; |
| 771 | else |
| 772 | res >>= 26; |
| 773 | if (res != ALC880_HP_EVENT) |
| 774 | return; |
| 775 | |
| 776 | alc_sku_automute(codec); |
| 777 | } |
| 778 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 779 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 780 | * 31 ~ 16 : Manufacture ID |
| 781 | * 15 ~ 8 : SKU ID |
| 782 | * 7 ~ 0 : Assembly ID |
| 783 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 784 | */ |
| 785 | static void alc_subsystem_id(struct hda_codec *codec, |
| 786 | unsigned int porta, unsigned int porte, |
| 787 | unsigned int portd) |
| 788 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 789 | unsigned int ass, tmp, i; |
| 790 | unsigned nid; |
| 791 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 792 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 793 | ass = codec->subsystem_id & 0xffff; |
| 794 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 795 | goto do_sku; |
| 796 | |
| 797 | /* |
| 798 | * 31~30 : port conetcivity |
| 799 | * 29~21 : reserve |
| 800 | * 20 : PCBEEP input |
| 801 | * 19~16 : Check sum (15:1) |
| 802 | * 15~1 : Custom |
| 803 | * 0 : override |
| 804 | */ |
| 805 | nid = 0x1d; |
| 806 | if (codec->vendor_id == 0x10ec0260) |
| 807 | nid = 0x17; |
| 808 | ass = snd_hda_codec_read(codec, nid, 0, |
| 809 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 810 | if (!(ass & 1) && !(ass & 0x100000)) |
| 811 | return; |
| 812 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 813 | return; |
| 814 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 815 | /* check sum */ |
| 816 | tmp = 0; |
| 817 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 818 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 819 | tmp++; |
| 820 | } |
| 821 | if (((ass >> 16) & 0xf) != tmp) |
| 822 | return; |
| 823 | do_sku: |
| 824 | /* |
| 825 | * 0 : override |
| 826 | * 1 : Swap Jack |
| 827 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 828 | * 3~5 : External Amplifier control |
| 829 | * 7~6 : Reserved |
| 830 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 831 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 832 | switch (tmp) { |
| 833 | case 1: |
| 834 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 835 | break; |
| 836 | case 3: |
| 837 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 838 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 839 | case 7: |
| 840 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 841 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 842 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 843 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 844 | case 0x10ec0260: |
| 845 | snd_hda_codec_write(codec, 0x0f, 0, |
| 846 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 847 | snd_hda_codec_write(codec, 0x10, 0, |
| 848 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 849 | break; |
| 850 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 851 | case 0x10ec0267: |
| 852 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 853 | case 0x10ec0269: |
| 854 | case 0x10ec0862: |
| 855 | case 0x10ec0662: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 856 | case 0x10ec0889: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 857 | snd_hda_codec_write(codec, 0x14, 0, |
| 858 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 859 | snd_hda_codec_write(codec, 0x15, 0, |
| 860 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 861 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 862 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 863 | switch (codec->vendor_id) { |
| 864 | case 0x10ec0260: |
| 865 | snd_hda_codec_write(codec, 0x1a, 0, |
| 866 | AC_VERB_SET_COEF_INDEX, 7); |
| 867 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 868 | AC_VERB_GET_PROC_COEF, 0); |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_COEF_INDEX, 7); |
| 871 | snd_hda_codec_write(codec, 0x1a, 0, |
| 872 | AC_VERB_SET_PROC_COEF, |
| 873 | tmp | 0x2010); |
| 874 | break; |
| 875 | case 0x10ec0262: |
| 876 | case 0x10ec0880: |
| 877 | case 0x10ec0882: |
| 878 | case 0x10ec0883: |
| 879 | case 0x10ec0885: |
| 880 | case 0x10ec0888: |
Takashi Iwai | 20a3a05 | 2008-05-23 17:52:53 +0200 | [diff] [blame] | 881 | case 0x10ec0889: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 882 | snd_hda_codec_write(codec, 0x20, 0, |
| 883 | AC_VERB_SET_COEF_INDEX, 7); |
| 884 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 885 | AC_VERB_GET_PROC_COEF, 0); |
| 886 | snd_hda_codec_write(codec, 0x20, 0, |
| 887 | AC_VERB_SET_COEF_INDEX, 7); |
| 888 | snd_hda_codec_write(codec, 0x20, 0, |
| 889 | AC_VERB_SET_PROC_COEF, |
| 890 | tmp | 0x2010); |
| 891 | break; |
| 892 | case 0x10ec0267: |
| 893 | case 0x10ec0268: |
| 894 | snd_hda_codec_write(codec, 0x20, 0, |
| 895 | AC_VERB_SET_COEF_INDEX, 7); |
| 896 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 897 | AC_VERB_GET_PROC_COEF, 0); |
| 898 | snd_hda_codec_write(codec, 0x20, 0, |
| 899 | AC_VERB_SET_COEF_INDEX, 7); |
| 900 | snd_hda_codec_write(codec, 0x20, 0, |
| 901 | AC_VERB_SET_PROC_COEF, |
| 902 | tmp | 0x3000); |
| 903 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 904 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 906 | break; |
| 907 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 908 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 909 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | * when the external headphone out jack is plugged" |
| 911 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 912 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 913 | return; |
| 914 | /* |
| 915 | * 10~8 : Jack location |
| 916 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 917 | * 14~13: Resvered |
| 918 | * 15 : 1 --> enable the function "Mute internal speaker |
| 919 | * when the external headphone out jack is plugged" |
| 920 | */ |
| 921 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 922 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 923 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 924 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 925 | else |
| 926 | return; |
| 927 | } |
| 928 | |
| 929 | if (!spec->autocfg.hp_pins[0]) { |
| 930 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 931 | if (tmp == 0) |
| 932 | spec->autocfg.hp_pins[0] = porta; |
| 933 | else if (tmp == 1) |
| 934 | spec->autocfg.hp_pins[0] = porte; |
| 935 | else if (tmp == 2) |
| 936 | spec->autocfg.hp_pins[0] = portd; |
| 937 | else |
| 938 | return; |
| 939 | } |
| 940 | |
| 941 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 942 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 943 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 944 | spec->unsol_event = alc_sku_unsol_event; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 945 | } |
| 946 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 947 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 948 | * Fix-up pin default configurations |
| 949 | */ |
| 950 | |
| 951 | struct alc_pincfg { |
| 952 | hda_nid_t nid; |
| 953 | u32 val; |
| 954 | }; |
| 955 | |
| 956 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 957 | const struct snd_pci_quirk *quirk, |
| 958 | const struct alc_pincfg **pinfix) |
| 959 | { |
| 960 | const struct alc_pincfg *cfg; |
| 961 | |
| 962 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 963 | if (!quirk) |
| 964 | return; |
| 965 | |
| 966 | cfg = pinfix[quirk->value]; |
| 967 | for (; cfg->nid; cfg++) { |
| 968 | int i; |
| 969 | u32 val = cfg->val; |
| 970 | for (i = 0; i < 4; i++) { |
| 971 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 972 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 973 | val & 0xff); |
| 974 | val >>= 8; |
| 975 | } |
| 976 | } |
| 977 | } |
| 978 | |
| 979 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 980 | * ALC880 3-stack model |
| 981 | * |
| 982 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 983 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 984 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 985 | */ |
| 986 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 987 | static hda_nid_t alc880_dac_nids[4] = { |
| 988 | /* front, rear, clfe, rear_surr */ |
| 989 | 0x02, 0x05, 0x04, 0x03 |
| 990 | }; |
| 991 | |
| 992 | static hda_nid_t alc880_adc_nids[3] = { |
| 993 | /* ADC0-2 */ |
| 994 | 0x07, 0x08, 0x09, |
| 995 | }; |
| 996 | |
| 997 | /* The datasheet says the node 0x07 is connected from inputs, |
| 998 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 999 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1000 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1001 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1002 | /* ADC1-2 */ |
| 1003 | 0x08, 0x09, |
| 1004 | }; |
| 1005 | |
| 1006 | #define ALC880_DIGOUT_NID 0x06 |
| 1007 | #define ALC880_DIGIN_NID 0x0a |
| 1008 | |
| 1009 | static struct hda_input_mux alc880_capture_source = { |
| 1010 | .num_items = 4, |
| 1011 | .items = { |
| 1012 | { "Mic", 0x0 }, |
| 1013 | { "Front Mic", 0x3 }, |
| 1014 | { "Line", 0x2 }, |
| 1015 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1016 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1017 | }; |
| 1018 | |
| 1019 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1020 | /* 2ch mode */ |
| 1021 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1022 | /* set line-in to input, mute it */ |
| 1023 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1024 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1025 | /* set mic-in to input vref 80%, mute it */ |
| 1026 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1027 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1028 | { } /* end */ |
| 1029 | }; |
| 1030 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1031 | /* 6ch mode */ |
| 1032 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1033 | /* set line-in to output, unmute it */ |
| 1034 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1035 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1036 | /* set mic-in to output, unmute it */ |
| 1037 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1038 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1039 | { } /* end */ |
| 1040 | }; |
| 1041 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1042 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1043 | { 2, alc880_threestack_ch2_init }, |
| 1044 | { 6, alc880_threestack_ch6_init }, |
| 1045 | }; |
| 1046 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1047 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1048 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1049 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1051 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1052 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1053 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1054 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1055 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1056 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1058 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1059 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1060 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1064 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1065 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1066 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | { |
| 1068 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1069 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1070 | .info = alc_ch_mode_info, |
| 1071 | .get = alc_ch_mode_get, |
| 1072 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1073 | }, |
| 1074 | { } /* end */ |
| 1075 | }; |
| 1076 | |
| 1077 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1078 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1079 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1083 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1084 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1085 | { |
| 1086 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1087 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1088 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1089 | */ |
| 1090 | /* .name = "Capture Source", */ |
| 1091 | .name = "Input Source", |
| 1092 | .count = 3, |
| 1093 | .info = alc_mux_enum_info, |
| 1094 | .get = alc_mux_enum_get, |
| 1095 | .put = alc_mux_enum_put, |
| 1096 | }, |
| 1097 | { } /* end */ |
| 1098 | }; |
| 1099 | |
| 1100 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1101 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1102 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1103 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1104 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1105 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1106 | { |
| 1107 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1108 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1109 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | */ |
| 1111 | /* .name = "Capture Source", */ |
| 1112 | .name = "Input Source", |
| 1113 | .count = 2, |
| 1114 | .info = alc_mux_enum_info, |
| 1115 | .get = alc_mux_enum_get, |
| 1116 | .put = alc_mux_enum_put, |
| 1117 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1118 | { } /* end */ |
| 1119 | }; |
| 1120 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1121 | |
| 1122 | |
| 1123 | /* |
| 1124 | * ALC880 5-stack model |
| 1125 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1126 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1127 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1128 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1129 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1130 | */ |
| 1131 | |
| 1132 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1133 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1134 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1135 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1136 | { } /* end */ |
| 1137 | }; |
| 1138 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1139 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1140 | /* 6ch mode */ |
| 1141 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1142 | /* set line-in to input, mute it */ |
| 1143 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1144 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1145 | { } /* end */ |
| 1146 | }; |
| 1147 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1148 | /* 8ch mode */ |
| 1149 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1150 | /* set line-in to output, unmute it */ |
| 1151 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1152 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1153 | { } /* end */ |
| 1154 | }; |
| 1155 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1156 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1157 | { 6, alc880_fivestack_ch6_init }, |
| 1158 | { 8, alc880_fivestack_ch8_init }, |
| 1159 | }; |
| 1160 | |
| 1161 | |
| 1162 | /* |
| 1163 | * ALC880 6-stack model |
| 1164 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1165 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1166 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1167 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1168 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1169 | */ |
| 1170 | |
| 1171 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1172 | /* front, rear, clfe, rear_surr */ |
| 1173 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1174 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1175 | |
| 1176 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1177 | .num_items = 4, |
| 1178 | .items = { |
| 1179 | { "Mic", 0x0 }, |
| 1180 | { "Front Mic", 0x1 }, |
| 1181 | { "Line", 0x2 }, |
| 1182 | { "CD", 0x4 }, |
| 1183 | }, |
| 1184 | }; |
| 1185 | |
| 1186 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1187 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1188 | { 8, NULL }, |
| 1189 | }; |
| 1190 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1191 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1192 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1195 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1196 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1197 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1198 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1199 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1201 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1202 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1206 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1210 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1211 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1212 | { |
| 1213 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1214 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1215 | .info = alc_ch_mode_info, |
| 1216 | .get = alc_ch_mode_get, |
| 1217 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1218 | }, |
| 1219 | { } /* end */ |
| 1220 | }; |
| 1221 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1222 | |
| 1223 | /* |
| 1224 | * ALC880 W810 model |
| 1225 | * |
| 1226 | * W810 has rear IO for: |
| 1227 | * Front (DAC 02) |
| 1228 | * Surround (DAC 03) |
| 1229 | * Center/LFE (DAC 04) |
| 1230 | * Digital out (06) |
| 1231 | * |
| 1232 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1233 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1234 | * |
| 1235 | * There is a variable resistor to control the speaker or headphone |
| 1236 | * volume. This is a hardware-only device without a software API. |
| 1237 | * |
| 1238 | * Plugging headphones in will disable the internal speakers. This is |
| 1239 | * implemented in hardware, not via the driver using jack sense. In |
| 1240 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1241 | * disable both the speakers and headphones. |
| 1242 | * |
| 1243 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1244 | * These may not do anything useful with this driver yet, because I |
| 1245 | * haven't setup any initialization verbs for these yet... |
| 1246 | */ |
| 1247 | |
| 1248 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1249 | /* front, rear/surround, clfe */ |
| 1250 | 0x02, 0x03, 0x04 |
| 1251 | }; |
| 1252 | |
| 1253 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1254 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1255 | { 6, NULL } |
| 1256 | }; |
| 1257 | |
| 1258 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1259 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1260 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1263 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1264 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1265 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1266 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1267 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1268 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1269 | { } /* end */ |
| 1270 | }; |
| 1271 | |
| 1272 | |
| 1273 | /* |
| 1274 | * Z710V model |
| 1275 | * |
| 1276 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1277 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1278 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1279 | */ |
| 1280 | |
| 1281 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1282 | 0x02 |
| 1283 | }; |
| 1284 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1285 | |
| 1286 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1287 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | { 2, NULL } |
| 1289 | }; |
| 1290 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1291 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1293 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1295 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1296 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1297 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1298 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1299 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1300 | { } /* end */ |
| 1301 | }; |
| 1302 | |
| 1303 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1304 | /* |
| 1305 | * ALC880 F1734 model |
| 1306 | * |
| 1307 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1308 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1309 | */ |
| 1310 | |
| 1311 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1312 | 0x03 |
| 1313 | }; |
| 1314 | #define ALC880_F1734_HP_DAC 0x02 |
| 1315 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1316 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1318 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1319 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1320 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1321 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1322 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1325 | { } /* end */ |
| 1326 | }; |
| 1327 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1328 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1329 | .num_items = 2, |
| 1330 | .items = { |
| 1331 | { "Mic", 0x1 }, |
| 1332 | { "CD", 0x4 }, |
| 1333 | }, |
| 1334 | }; |
| 1335 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1336 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1337 | /* |
| 1338 | * ALC880 ASUS model |
| 1339 | * |
| 1340 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1341 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1342 | * Mic = 0x18, Line = 0x1a |
| 1343 | */ |
| 1344 | |
| 1345 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1346 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1347 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1348 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1349 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1350 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1351 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1352 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1353 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1354 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1355 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1356 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1357 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1358 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1359 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1360 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1361 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1362 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1363 | { |
| 1364 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1365 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1366 | .info = alc_ch_mode_info, |
| 1367 | .get = alc_ch_mode_get, |
| 1368 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1369 | }, |
| 1370 | { } /* end */ |
| 1371 | }; |
| 1372 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1373 | /* |
| 1374 | * ALC880 ASUS W1V model |
| 1375 | * |
| 1376 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1377 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1378 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1379 | */ |
| 1380 | |
| 1381 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1382 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1383 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1384 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1385 | { } /* end */ |
| 1386 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1387 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1388 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1389 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1390 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1392 | { } /* end */ |
| 1393 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1395 | /* TCL S700 */ |
| 1396 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1397 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1398 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1399 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1400 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1401 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1402 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1403 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1404 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1405 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1406 | { |
| 1407 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1408 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1409 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1410 | */ |
| 1411 | /* .name = "Capture Source", */ |
| 1412 | .name = "Input Source", |
| 1413 | .count = 1, |
| 1414 | .info = alc_mux_enum_info, |
| 1415 | .get = alc_mux_enum_get, |
| 1416 | .put = alc_mux_enum_put, |
| 1417 | }, |
| 1418 | { } /* end */ |
| 1419 | }; |
| 1420 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1421 | /* Uniwill */ |
| 1422 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1423 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1424 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1426 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1427 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1428 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1429 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1430 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1431 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1432 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1433 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1434 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1437 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1438 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1439 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1440 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1441 | { |
| 1442 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1443 | .name = "Channel Mode", |
| 1444 | .info = alc_ch_mode_info, |
| 1445 | .get = alc_ch_mode_get, |
| 1446 | .put = alc_ch_mode_put, |
| 1447 | }, |
| 1448 | { } /* end */ |
| 1449 | }; |
| 1450 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1451 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1453 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1454 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1455 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1456 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1457 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1459 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1460 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1461 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1465 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1466 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1467 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1468 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1469 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1471 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1472 | { } /* end */ |
| 1473 | }; |
| 1474 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1475 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1476 | * virtual master controls |
| 1477 | */ |
| 1478 | |
| 1479 | /* |
| 1480 | * slave controls for virtual master |
| 1481 | */ |
| 1482 | static const char *alc_slave_vols[] = { |
| 1483 | "Front Playback Volume", |
| 1484 | "Surround Playback Volume", |
| 1485 | "Center Playback Volume", |
| 1486 | "LFE Playback Volume", |
| 1487 | "Side Playback Volume", |
| 1488 | "Headphone Playback Volume", |
| 1489 | "Speaker Playback Volume", |
| 1490 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1491 | "Line-Out Playback Volume", |
| 1492 | NULL, |
| 1493 | }; |
| 1494 | |
| 1495 | static const char *alc_slave_sws[] = { |
| 1496 | "Front Playback Switch", |
| 1497 | "Surround Playback Switch", |
| 1498 | "Center Playback Switch", |
| 1499 | "LFE Playback Switch", |
| 1500 | "Side Playback Switch", |
| 1501 | "Headphone Playback Switch", |
| 1502 | "Speaker Playback Switch", |
| 1503 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1504 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1505 | NULL, |
| 1506 | }; |
| 1507 | |
| 1508 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1509 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1510 | */ |
| 1511 | static int alc_build_controls(struct hda_codec *codec) |
| 1512 | { |
| 1513 | struct alc_spec *spec = codec->spec; |
| 1514 | int err; |
| 1515 | int i; |
| 1516 | |
| 1517 | for (i = 0; i < spec->num_mixers; i++) { |
| 1518 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1519 | if (err < 0) |
| 1520 | return err; |
| 1521 | } |
| 1522 | |
| 1523 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1524 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1525 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1526 | if (err < 0) |
| 1527 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1528 | err = snd_hda_create_spdif_share_sw(codec, |
| 1529 | &spec->multiout); |
| 1530 | if (err < 0) |
| 1531 | return err; |
| 1532 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1533 | } |
| 1534 | if (spec->dig_in_nid) { |
| 1535 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1536 | if (err < 0) |
| 1537 | return err; |
| 1538 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1539 | |
| 1540 | /* if we have no master control, let's create it */ |
| 1541 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1542 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1543 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1544 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1545 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame] | 1546 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1547 | if (err < 0) |
| 1548 | return err; |
| 1549 | } |
| 1550 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1551 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1552 | NULL, alc_slave_sws); |
| 1553 | if (err < 0) |
| 1554 | return err; |
| 1555 | } |
| 1556 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1557 | return 0; |
| 1558 | } |
| 1559 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1560 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | /* |
| 1562 | * initialize the codec volumes, etc |
| 1563 | */ |
| 1564 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1565 | /* |
| 1566 | * generic initialization of ADC, input mixers and output mixers |
| 1567 | */ |
| 1568 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1569 | /* |
| 1570 | * Unmute ADC0-2 and set the default input to mic-in |
| 1571 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1572 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1573 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1574 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1575 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1576 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1577 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1578 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1580 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1581 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1582 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1583 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1584 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1586 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1587 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1588 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1589 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1590 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1591 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1592 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1593 | /* |
| 1594 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1595 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1596 | /* set vol=0 to output mixers */ |
| 1597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1598 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1599 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1600 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1601 | /* set up input amps for analog loopback */ |
| 1602 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1603 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1604 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1605 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1606 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1607 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1608 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1609 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1610 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1611 | |
| 1612 | { } |
| 1613 | }; |
| 1614 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1615 | /* |
| 1616 | * 3-stack pin configuration: |
| 1617 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1618 | */ |
| 1619 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1620 | /* |
| 1621 | * preset connection lists of input pins |
| 1622 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1623 | */ |
| 1624 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1625 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1626 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1627 | |
| 1628 | /* |
| 1629 | * Set pin mode and muting |
| 1630 | */ |
| 1631 | /* set front pin widgets 0x14 for output */ |
| 1632 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1633 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1634 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1635 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1636 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1637 | /* Mic2 (as headphone out) for HP output */ |
| 1638 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1639 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1640 | /* Line In pin widget for input */ |
| 1641 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1642 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1643 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1644 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1645 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1646 | /* CD pin widget for input */ |
| 1647 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1648 | |
| 1649 | { } |
| 1650 | }; |
| 1651 | |
| 1652 | /* |
| 1653 | * 5-stack pin configuration: |
| 1654 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1655 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1656 | */ |
| 1657 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1658 | /* |
| 1659 | * preset connection lists of input pins |
| 1660 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1661 | */ |
| 1662 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1663 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1664 | |
| 1665 | /* |
| 1666 | * Set pin mode and muting |
| 1667 | */ |
| 1668 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1669 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1670 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1671 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1672 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1673 | /* unmute pins for output (no gain on this amp) */ |
| 1674 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1676 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1677 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1678 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1679 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1680 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1681 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1682 | /* Mic2 (as headphone out) for HP output */ |
| 1683 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1684 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1685 | /* Line In pin widget for input */ |
| 1686 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1688 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1689 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1690 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1691 | /* CD pin widget for input */ |
| 1692 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1693 | |
| 1694 | { } |
| 1695 | }; |
| 1696 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1697 | /* |
| 1698 | * W810 pin configuration: |
| 1699 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1700 | */ |
| 1701 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1702 | /* hphone/speaker input selector: front DAC */ |
| 1703 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1704 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1705 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1706 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1708 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1709 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1710 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1711 | |
| 1712 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1713 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1714 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1715 | { } |
| 1716 | }; |
| 1717 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1718 | /* |
| 1719 | * Z71V pin configuration: |
| 1720 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1721 | */ |
| 1722 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1724 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1725 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1726 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1727 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1728 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1729 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1730 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1731 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1732 | |
| 1733 | { } |
| 1734 | }; |
| 1735 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1736 | /* |
| 1737 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1738 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1739 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1740 | */ |
| 1741 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1742 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1743 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1746 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1747 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1748 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1749 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1750 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1751 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1752 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1753 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1754 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1755 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1757 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1758 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1760 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1761 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1762 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1763 | { } |
| 1764 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1765 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1766 | /* |
| 1767 | * Uniwill pin configuration: |
| 1768 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1769 | * line = 0x1a |
| 1770 | */ |
| 1771 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1772 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1773 | |
| 1774 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1775 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1776 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1777 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1778 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1779 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1780 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1781 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1782 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1783 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1784 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1785 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1786 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1787 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1788 | |
| 1789 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1790 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1791 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1792 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1793 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1794 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1795 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1796 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1797 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1798 | |
| 1799 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1800 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1801 | |
| 1802 | { } |
| 1803 | }; |
| 1804 | |
| 1805 | /* |
| 1806 | * Uniwill P53 |
| 1807 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1808 | */ |
| 1809 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1810 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1811 | |
| 1812 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1813 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1814 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1815 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1816 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1817 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1818 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1819 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1820 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1821 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1822 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1823 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1824 | |
| 1825 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1826 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1827 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1828 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1829 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1830 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1831 | |
| 1832 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1833 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1834 | |
| 1835 | { } |
| 1836 | }; |
| 1837 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1838 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1839 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1840 | { } |
| 1841 | }; |
| 1842 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1843 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1844 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1845 | { |
| 1846 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1847 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1848 | |
| 1849 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1850 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1851 | bits = present ? HDA_AMP_MUTE : 0; |
| 1852 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1853 | HDA_AMP_MUTE, bits); |
| 1854 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1855 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1856 | } |
| 1857 | |
| 1858 | /* auto-toggle front mic */ |
| 1859 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1860 | { |
| 1861 | unsigned int present; |
| 1862 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1863 | |
| 1864 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1865 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1866 | bits = present ? HDA_AMP_MUTE : 0; |
| 1867 | 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] | 1868 | } |
| 1869 | |
| 1870 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1871 | { |
| 1872 | alc880_uniwill_hp_automute(codec); |
| 1873 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1874 | } |
| 1875 | |
| 1876 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1877 | unsigned int res) |
| 1878 | { |
| 1879 | /* Looks like the unsol event is incompatible with the standard |
| 1880 | * definition. 4bit tag is placed at 28 bit! |
| 1881 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1882 | switch (res >> 28) { |
| 1883 | case ALC880_HP_EVENT: |
| 1884 | alc880_uniwill_hp_automute(codec); |
| 1885 | break; |
| 1886 | case ALC880_MIC_EVENT: |
| 1887 | alc880_uniwill_mic_automute(codec); |
| 1888 | break; |
| 1889 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1890 | } |
| 1891 | |
| 1892 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1893 | { |
| 1894 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1895 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1896 | |
| 1897 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1898 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1899 | bits = present ? HDA_AMP_MUTE : 0; |
Jiang zhe | 64654c2 | 2008-04-14 13:26:21 +0200 | [diff] [blame] | 1900 | 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] | 1901 | } |
| 1902 | |
| 1903 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1904 | { |
| 1905 | unsigned int present; |
| 1906 | |
| 1907 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1908 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1909 | present &= HDA_AMP_VOLMASK; |
| 1910 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1911 | HDA_AMP_VOLMASK, present); |
| 1912 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1913 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1914 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1915 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1916 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1917 | unsigned int res) |
| 1918 | { |
| 1919 | /* Looks like the unsol event is incompatible with the standard |
| 1920 | * definition. 4bit tag is placed at 28 bit! |
| 1921 | */ |
| 1922 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1923 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1924 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1925 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1926 | } |
| 1927 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1928 | /* |
| 1929 | * F1734 pin configuration: |
| 1930 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1931 | */ |
| 1932 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1933 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1934 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1935 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1936 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1937 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1938 | |
| 1939 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1940 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1941 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1942 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | |
| 1944 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1945 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Michael Gruber | ee7a9c7 | 2008-03-10 11:30:59 +0100 | [diff] [blame] | 1946 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1947 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1948 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1951 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1952 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1953 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1954 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1955 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1956 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1957 | { } |
| 1958 | }; |
| 1959 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1960 | /* |
| 1961 | * ASUS pin configuration: |
| 1962 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1963 | */ |
| 1964 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1965 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1966 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1967 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1968 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1969 | |
| 1970 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1972 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1974 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1976 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1978 | |
| 1979 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1980 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1981 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1982 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1983 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1984 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1985 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1986 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1987 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1988 | |
| 1989 | { } |
| 1990 | }; |
| 1991 | |
| 1992 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1993 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1994 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1995 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1996 | /* Clevo m520g init */ |
| 1997 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1998 | /* headphone output */ |
| 1999 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2000 | /* line-out */ |
| 2001 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2002 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2003 | /* Line-in */ |
| 2004 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2005 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2006 | /* CD */ |
| 2007 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2008 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2009 | /* Mic1 (rear panel) */ |
| 2010 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2011 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2012 | /* Mic2 (front panel) */ |
| 2013 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2014 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2015 | /* headphone */ |
| 2016 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2017 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2018 | /* change to EAPD mode */ |
| 2019 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2020 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2021 | |
| 2022 | { } |
| 2023 | }; |
| 2024 | |
| 2025 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2026 | /* change to EAPD mode */ |
| 2027 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2028 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2030 | /* Headphone output */ |
| 2031 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2032 | /* Front output*/ |
| 2033 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2034 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2035 | |
| 2036 | /* Line In pin widget for input */ |
| 2037 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2038 | /* CD pin widget for input */ |
| 2039 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2040 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2042 | |
| 2043 | /* change to EAPD mode */ |
| 2044 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2045 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2046 | |
| 2047 | { } |
| 2048 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2049 | |
| 2050 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2051 | * LG m1 express dual |
| 2052 | * |
| 2053 | * Pin assignment: |
| 2054 | * Rear Line-In/Out (blue): 0x14 |
| 2055 | * Build-in Mic-In: 0x15 |
| 2056 | * Speaker-out: 0x17 |
| 2057 | * HP-Out (green): 0x1b |
| 2058 | * Mic-In/Out (red): 0x19 |
| 2059 | * SPDIF-Out: 0x1e |
| 2060 | */ |
| 2061 | |
| 2062 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2063 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2064 | 0x05, 0x02, 0x03 |
| 2065 | }; |
| 2066 | |
| 2067 | /* seems analog CD is not working */ |
| 2068 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2069 | .num_items = 3, |
| 2070 | .items = { |
| 2071 | { "Mic", 0x1 }, |
| 2072 | { "Line", 0x5 }, |
| 2073 | { "Internal Mic", 0x6 }, |
| 2074 | }, |
| 2075 | }; |
| 2076 | |
| 2077 | /* 2,4,6 channel modes */ |
| 2078 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2079 | /* set line-in and mic-in to input */ |
| 2080 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2081 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2082 | { } |
| 2083 | }; |
| 2084 | |
| 2085 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2086 | /* set line-in to out and mic-in to input */ |
| 2087 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2088 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2089 | { } |
| 2090 | }; |
| 2091 | |
| 2092 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2093 | /* set line-in and mic-in to output */ |
| 2094 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2095 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2096 | { } |
| 2097 | }; |
| 2098 | |
| 2099 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2100 | { 2, alc880_lg_ch2_init }, |
| 2101 | { 4, alc880_lg_ch4_init }, |
| 2102 | { 6, alc880_lg_ch6_init }, |
| 2103 | }; |
| 2104 | |
| 2105 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2106 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2107 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2108 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2109 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2110 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2111 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2112 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2113 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2114 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2115 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2116 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2117 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2118 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2119 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2120 | { |
| 2121 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2122 | .name = "Channel Mode", |
| 2123 | .info = alc_ch_mode_info, |
| 2124 | .get = alc_ch_mode_get, |
| 2125 | .put = alc_ch_mode_put, |
| 2126 | }, |
| 2127 | { } /* end */ |
| 2128 | }; |
| 2129 | |
| 2130 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2131 | /* set capture source to mic-in */ |
| 2132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2133 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2134 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2135 | /* mute all amp mixer inputs */ |
| 2136 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2137 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2138 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2139 | /* line-in to input */ |
| 2140 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2141 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2142 | /* built-in mic */ |
| 2143 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2144 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2145 | /* speaker-out */ |
| 2146 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2147 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2148 | /* mic-in to input */ |
| 2149 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2150 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2151 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2152 | /* HP-out */ |
| 2153 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2154 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2155 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2156 | /* jack sense */ |
| 2157 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2158 | { } |
| 2159 | }; |
| 2160 | |
| 2161 | /* toggle speaker-output according to the hp-jack state */ |
| 2162 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2163 | { |
| 2164 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2165 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2166 | |
| 2167 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2168 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2169 | bits = present ? HDA_AMP_MUTE : 0; |
| 2170 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2171 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2172 | } |
| 2173 | |
| 2174 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2175 | { |
| 2176 | /* Looks like the unsol event is incompatible with the standard |
| 2177 | * definition. 4bit tag is placed at 28 bit! |
| 2178 | */ |
| 2179 | if ((res >> 28) == 0x01) |
| 2180 | alc880_lg_automute(codec); |
| 2181 | } |
| 2182 | |
| 2183 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2184 | * LG LW20 |
| 2185 | * |
| 2186 | * Pin assignment: |
| 2187 | * Speaker-out: 0x14 |
| 2188 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2189 | * Built-in Mic-In: 0x19 |
| 2190 | * Line-In: 0x1b |
| 2191 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2192 | * SPDIF-Out: 0x1e |
| 2193 | */ |
| 2194 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2195 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2196 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2197 | .items = { |
| 2198 | { "Mic", 0x0 }, |
| 2199 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2200 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2201 | }, |
| 2202 | }; |
| 2203 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2204 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2205 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2206 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2207 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2208 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2209 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2210 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2211 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2212 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2213 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2214 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2215 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2216 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2217 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2218 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2219 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2220 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2221 | { |
| 2222 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2223 | .name = "Channel Mode", |
| 2224 | .info = alc_ch_mode_info, |
| 2225 | .get = alc_ch_mode_get, |
| 2226 | .put = alc_ch_mode_put, |
| 2227 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2228 | { } /* end */ |
| 2229 | }; |
| 2230 | |
| 2231 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2232 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2233 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2234 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2235 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2236 | /* set capture source to mic-in */ |
| 2237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2238 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2239 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2241 | /* speaker-out */ |
| 2242 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2243 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2244 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2245 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2246 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2247 | /* mic-in to input */ |
| 2248 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2249 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2250 | /* built-in mic */ |
| 2251 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2252 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2253 | /* jack sense */ |
| 2254 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2255 | { } |
| 2256 | }; |
| 2257 | |
| 2258 | /* toggle speaker-output according to the hp-jack state */ |
| 2259 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2260 | { |
| 2261 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2262 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2263 | |
| 2264 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2265 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2266 | bits = present ? HDA_AMP_MUTE : 0; |
| 2267 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2268 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2269 | } |
| 2270 | |
| 2271 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2272 | { |
| 2273 | /* Looks like the unsol event is incompatible with the standard |
| 2274 | * definition. 4bit tag is placed at 28 bit! |
| 2275 | */ |
| 2276 | if ((res >> 28) == 0x01) |
| 2277 | alc880_lg_lw_automute(codec); |
| 2278 | } |
| 2279 | |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2280 | static struct snd_kcontrol_new alc880_medion_rim_mixer[] = { |
| 2281 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2282 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2283 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2284 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2285 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2286 | HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2287 | { } /* end */ |
| 2288 | }; |
| 2289 | |
| 2290 | static struct hda_input_mux alc880_medion_rim_capture_source = { |
| 2291 | .num_items = 2, |
| 2292 | .items = { |
| 2293 | { "Mic", 0x0 }, |
| 2294 | { "Internal Mic", 0x1 }, |
| 2295 | }, |
| 2296 | }; |
| 2297 | |
| 2298 | static struct hda_verb alc880_medion_rim_init_verbs[] = { |
| 2299 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2300 | |
| 2301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2302 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2303 | |
| 2304 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2305 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2306 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2307 | /* Mic2 (as headphone out) for HP output */ |
| 2308 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2309 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2310 | /* Internal Speaker */ |
| 2311 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2312 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2313 | |
| 2314 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2315 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2316 | |
| 2317 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 2318 | { } |
| 2319 | }; |
| 2320 | |
| 2321 | /* toggle speaker-output according to the hp-jack state */ |
| 2322 | static void alc880_medion_rim_automute(struct hda_codec *codec) |
| 2323 | { |
| 2324 | unsigned int present; |
| 2325 | unsigned char bits; |
| 2326 | |
| 2327 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 2328 | AC_VERB_GET_PIN_SENSE, 0) |
| 2329 | & AC_PINSENSE_PRESENCE; |
| 2330 | bits = present ? HDA_AMP_MUTE : 0; |
| 2331 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 2332 | HDA_AMP_MUTE, bits); |
| 2333 | if (present) |
| 2334 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0); |
| 2335 | else |
| 2336 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2); |
| 2337 | } |
| 2338 | |
| 2339 | static void alc880_medion_rim_unsol_event(struct hda_codec *codec, |
| 2340 | unsigned int res) |
| 2341 | { |
| 2342 | /* Looks like the unsol event is incompatible with the standard |
| 2343 | * definition. 4bit tag is placed at 28 bit! |
| 2344 | */ |
| 2345 | if ((res >> 28) == ALC880_HP_EVENT) |
| 2346 | alc880_medion_rim_automute(codec); |
| 2347 | } |
| 2348 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2349 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2350 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2351 | { 0x0b, HDA_INPUT, 0 }, |
| 2352 | { 0x0b, HDA_INPUT, 1 }, |
| 2353 | { 0x0b, HDA_INPUT, 2 }, |
| 2354 | { 0x0b, HDA_INPUT, 3 }, |
| 2355 | { 0x0b, HDA_INPUT, 4 }, |
| 2356 | { } /* end */ |
| 2357 | }; |
| 2358 | |
| 2359 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2360 | { 0x0b, HDA_INPUT, 1 }, |
| 2361 | { 0x0b, HDA_INPUT, 6 }, |
| 2362 | { 0x0b, HDA_INPUT, 7 }, |
| 2363 | { } /* end */ |
| 2364 | }; |
| 2365 | #endif |
| 2366 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2367 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2368 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2369 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2370 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2371 | static int alc_init(struct hda_codec *codec) |
| 2372 | { |
| 2373 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2374 | unsigned int i; |
| 2375 | |
| 2376 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2377 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2378 | |
| 2379 | if (spec->init_hook) |
| 2380 | spec->init_hook(codec); |
| 2381 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2382 | return 0; |
| 2383 | } |
| 2384 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2385 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2386 | { |
| 2387 | struct alc_spec *spec = codec->spec; |
| 2388 | |
| 2389 | if (spec->unsol_event) |
| 2390 | spec->unsol_event(codec, res); |
| 2391 | } |
| 2392 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2393 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2394 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2395 | { |
| 2396 | struct alc_spec *spec = codec->spec; |
| 2397 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2398 | } |
| 2399 | #endif |
| 2400 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2401 | /* |
| 2402 | * Analog playback callbacks |
| 2403 | */ |
| 2404 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2405 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2406 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2407 | { |
| 2408 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2409 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2410 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2414 | struct hda_codec *codec, |
| 2415 | unsigned int stream_tag, |
| 2416 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2417 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2418 | { |
| 2419 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2420 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2421 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2422 | } |
| 2423 | |
| 2424 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2425 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2426 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2427 | { |
| 2428 | struct alc_spec *spec = codec->spec; |
| 2429 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2430 | } |
| 2431 | |
| 2432 | /* |
| 2433 | * Digital out |
| 2434 | */ |
| 2435 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2436 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2437 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2438 | { |
| 2439 | struct alc_spec *spec = codec->spec; |
| 2440 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2441 | } |
| 2442 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2443 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2444 | struct hda_codec *codec, |
| 2445 | unsigned int stream_tag, |
| 2446 | unsigned int format, |
| 2447 | struct snd_pcm_substream *substream) |
| 2448 | { |
| 2449 | struct alc_spec *spec = codec->spec; |
| 2450 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2451 | stream_tag, format, substream); |
| 2452 | } |
| 2453 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2454 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2455 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2456 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2457 | { |
| 2458 | struct alc_spec *spec = codec->spec; |
| 2459 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2460 | } |
| 2461 | |
| 2462 | /* |
| 2463 | * Analog capture |
| 2464 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2465 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2466 | struct hda_codec *codec, |
| 2467 | unsigned int stream_tag, |
| 2468 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2469 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2470 | { |
| 2471 | struct alc_spec *spec = codec->spec; |
| 2472 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2473 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2474 | stream_tag, 0, format); |
| 2475 | return 0; |
| 2476 | } |
| 2477 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2478 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2479 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2480 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2481 | { |
| 2482 | struct alc_spec *spec = codec->spec; |
| 2483 | |
Takashi Iwai | 888afa1 | 2008-03-18 09:57:50 +0100 | [diff] [blame] | 2484 | snd_hda_codec_cleanup_stream(codec, |
| 2485 | spec->adc_nids[substream->number + 1]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2486 | return 0; |
| 2487 | } |
| 2488 | |
| 2489 | |
| 2490 | /* |
| 2491 | */ |
| 2492 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2493 | .substreams = 1, |
| 2494 | .channels_min = 2, |
| 2495 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2496 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2497 | .ops = { |
| 2498 | .open = alc880_playback_pcm_open, |
| 2499 | .prepare = alc880_playback_pcm_prepare, |
| 2500 | .cleanup = alc880_playback_pcm_cleanup |
| 2501 | }, |
| 2502 | }; |
| 2503 | |
| 2504 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2505 | .substreams = 1, |
| 2506 | .channels_min = 2, |
| 2507 | .channels_max = 2, |
| 2508 | /* NID is set in alc_build_pcms */ |
| 2509 | }; |
| 2510 | |
| 2511 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2512 | .substreams = 1, |
| 2513 | .channels_min = 2, |
| 2514 | .channels_max = 2, |
| 2515 | /* NID is set in alc_build_pcms */ |
| 2516 | }; |
| 2517 | |
| 2518 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2519 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2520 | .channels_min = 2, |
| 2521 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2522 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2523 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2524 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2525 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2526 | }, |
| 2527 | }; |
| 2528 | |
| 2529 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2530 | .substreams = 1, |
| 2531 | .channels_min = 2, |
| 2532 | .channels_max = 2, |
| 2533 | /* NID is set in alc_build_pcms */ |
| 2534 | .ops = { |
| 2535 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2536 | .close = alc880_dig_playback_pcm_close, |
| 2537 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2538 | }, |
| 2539 | }; |
| 2540 | |
| 2541 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2542 | .substreams = 1, |
| 2543 | .channels_min = 2, |
| 2544 | .channels_max = 2, |
| 2545 | /* NID is set in alc_build_pcms */ |
| 2546 | }; |
| 2547 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2548 | /* 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] | 2549 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2550 | .substreams = 0, |
| 2551 | .channels_min = 0, |
| 2552 | .channels_max = 0, |
| 2553 | }; |
| 2554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2555 | static int alc_build_pcms(struct hda_codec *codec) |
| 2556 | { |
| 2557 | struct alc_spec *spec = codec->spec; |
| 2558 | struct hda_pcm *info = spec->pcm_rec; |
| 2559 | int i; |
| 2560 | |
| 2561 | codec->num_pcms = 1; |
| 2562 | codec->pcm_info = info; |
| 2563 | |
| 2564 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2565 | if (spec->stream_analog_playback) { |
| 2566 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2567 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2568 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2569 | } |
| 2570 | if (spec->stream_analog_capture) { |
| 2571 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2572 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2573 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2574 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2575 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2576 | if (spec->channel_mode) { |
| 2577 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2578 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2579 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2580 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2581 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2582 | } |
| 2583 | } |
| 2584 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2585 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2586 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2587 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2588 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2589 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2590 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2591 | if (spec->multiout.dig_out_nid && |
| 2592 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2593 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2594 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2595 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2596 | if (spec->dig_in_nid && |
| 2597 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2598 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2599 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2600 | } |
| 2601 | } |
| 2602 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2603 | /* If the use of more than one ADC is requested for the current |
| 2604 | * model, configure a second analog capture-only PCM. |
| 2605 | */ |
| 2606 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2607 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2608 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2609 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2610 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2611 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2612 | if (spec->alt_dac_nid) { |
| 2613 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2614 | *spec->stream_analog_alt_playback; |
| 2615 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2616 | spec->alt_dac_nid; |
| 2617 | } else { |
| 2618 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2619 | alc_pcm_null_stream; |
| 2620 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2621 | } |
| 2622 | if (spec->num_adc_nids > 1) { |
| 2623 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2624 | *spec->stream_analog_alt_capture; |
| 2625 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2626 | spec->adc_nids[1]; |
| 2627 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2628 | spec->num_adc_nids - 1; |
| 2629 | } else { |
| 2630 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2631 | alc_pcm_null_stream; |
| 2632 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2633 | } |
| 2634 | } |
| 2635 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2636 | return 0; |
| 2637 | } |
| 2638 | |
| 2639 | static void alc_free(struct hda_codec *codec) |
| 2640 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2641 | struct alc_spec *spec = codec->spec; |
| 2642 | unsigned int i; |
| 2643 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2644 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2645 | return; |
| 2646 | |
| 2647 | if (spec->kctl_alloc) { |
| 2648 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2649 | kfree(spec->kctl_alloc[i].name); |
| 2650 | kfree(spec->kctl_alloc); |
| 2651 | } |
| 2652 | kfree(spec); |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 2653 | codec->spec = NULL; /* to be sure */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2654 | } |
| 2655 | |
| 2656 | /* |
| 2657 | */ |
| 2658 | static struct hda_codec_ops alc_patch_ops = { |
| 2659 | .build_controls = alc_build_controls, |
| 2660 | .build_pcms = alc_build_pcms, |
| 2661 | .init = alc_init, |
| 2662 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2663 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2664 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2665 | .check_power_status = alc_check_power_status, |
| 2666 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2667 | }; |
| 2668 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2669 | |
| 2670 | /* |
| 2671 | * Test configuration for debugging |
| 2672 | * |
| 2673 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2674 | * enum controls. |
| 2675 | */ |
| 2676 | #ifdef CONFIG_SND_DEBUG |
| 2677 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2678 | 0x02, 0x03, 0x04, 0x05 |
| 2679 | }; |
| 2680 | |
| 2681 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2682 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2683 | .items = { |
| 2684 | { "In-1", 0x0 }, |
| 2685 | { "In-2", 0x1 }, |
| 2686 | { "In-3", 0x2 }, |
| 2687 | { "In-4", 0x3 }, |
| 2688 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2689 | { "Front", 0x5 }, |
| 2690 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2691 | }, |
| 2692 | }; |
| 2693 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2694 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2695 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2696 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2697 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2698 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2699 | }; |
| 2700 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2701 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2702 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2703 | { |
| 2704 | static char *texts[] = { |
| 2705 | "N/A", "Line Out", "HP Out", |
| 2706 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2707 | }; |
| 2708 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2709 | uinfo->count = 1; |
| 2710 | uinfo->value.enumerated.items = 8; |
| 2711 | if (uinfo->value.enumerated.item >= 8) |
| 2712 | uinfo->value.enumerated.item = 7; |
| 2713 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2714 | return 0; |
| 2715 | } |
| 2716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2717 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2718 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2719 | { |
| 2720 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2721 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2722 | unsigned int pin_ctl, item = 0; |
| 2723 | |
| 2724 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2725 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2726 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2727 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2728 | item = 2; |
| 2729 | else |
| 2730 | item = 1; |
| 2731 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2732 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2733 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2734 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2735 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2736 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2737 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2738 | } |
| 2739 | } |
| 2740 | ucontrol->value.enumerated.item[0] = item; |
| 2741 | return 0; |
| 2742 | } |
| 2743 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2744 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2745 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2746 | { |
| 2747 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2748 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2749 | static unsigned int ctls[] = { |
| 2750 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2751 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2752 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2753 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2754 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2755 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2756 | }; |
| 2757 | unsigned int old_ctl, new_ctl; |
| 2758 | |
| 2759 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2760 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2761 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2762 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2763 | int val; |
| 2764 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2765 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2766 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2767 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2768 | HDA_AMP_MUTE : 0; |
| 2769 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2770 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2771 | return 1; |
| 2772 | } |
| 2773 | return 0; |
| 2774 | } |
| 2775 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2776 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2777 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2778 | { |
| 2779 | static char *texts[] = { |
| 2780 | "Front", "Surround", "CLFE", "Side" |
| 2781 | }; |
| 2782 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2783 | uinfo->count = 1; |
| 2784 | uinfo->value.enumerated.items = 4; |
| 2785 | if (uinfo->value.enumerated.item >= 4) |
| 2786 | uinfo->value.enumerated.item = 3; |
| 2787 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2788 | return 0; |
| 2789 | } |
| 2790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2791 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2792 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2793 | { |
| 2794 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2795 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2796 | unsigned int sel; |
| 2797 | |
| 2798 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2799 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2800 | return 0; |
| 2801 | } |
| 2802 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2803 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2804 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2805 | { |
| 2806 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2807 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2808 | unsigned int sel; |
| 2809 | |
| 2810 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2811 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2812 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2813 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2814 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2815 | return 1; |
| 2816 | } |
| 2817 | return 0; |
| 2818 | } |
| 2819 | |
| 2820 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2821 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2822 | .name = xname, \ |
| 2823 | .info = alc_test_pin_ctl_info, \ |
| 2824 | .get = alc_test_pin_ctl_get, \ |
| 2825 | .put = alc_test_pin_ctl_put, \ |
| 2826 | .private_value = nid \ |
| 2827 | } |
| 2828 | |
| 2829 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2830 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2831 | .name = xname, \ |
| 2832 | .info = alc_test_pin_src_info, \ |
| 2833 | .get = alc_test_pin_src_get, \ |
| 2834 | .put = alc_test_pin_src_put, \ |
| 2835 | .private_value = nid \ |
| 2836 | } |
| 2837 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2838 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2839 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2840 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2841 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2842 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2843 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2844 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2845 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2846 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2847 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2848 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2849 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2850 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2851 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2852 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2853 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2854 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2855 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2856 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2857 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2858 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2859 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2860 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2861 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2862 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2863 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2864 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2865 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2866 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2867 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2868 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2869 | { |
| 2870 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2871 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2872 | .info = alc_ch_mode_info, |
| 2873 | .get = alc_ch_mode_get, |
| 2874 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2875 | }, |
| 2876 | { } /* end */ |
| 2877 | }; |
| 2878 | |
| 2879 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2880 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2881 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2882 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2883 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2884 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2885 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2886 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2887 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2888 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2889 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2890 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2891 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2892 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2893 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2894 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2895 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2896 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2897 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2898 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2899 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2900 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2901 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2902 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2903 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2904 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2905 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2906 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2907 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2908 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2909 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2910 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2911 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2912 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2913 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2914 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2915 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2916 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2917 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2918 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2920 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2921 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2922 | /* Analog input/passthru */ |
| 2923 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2924 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2925 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2926 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2927 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2928 | { } |
| 2929 | }; |
| 2930 | #endif |
| 2931 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2932 | /* |
| 2933 | */ |
| 2934 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2935 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2936 | [ALC880_3ST] = "3stack", |
| 2937 | [ALC880_TCL_S700] = "tcl", |
| 2938 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2939 | [ALC880_CLEVO] = "clevo", |
| 2940 | [ALC880_5ST] = "5stack", |
| 2941 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2942 | [ALC880_W810] = "w810", |
| 2943 | [ALC880_Z71V] = "z71v", |
| 2944 | [ALC880_6ST] = "6stack", |
| 2945 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2946 | [ALC880_ASUS] = "asus", |
| 2947 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2948 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2949 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2950 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2951 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2952 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2953 | [ALC880_F1734] = "F1734", |
| 2954 | [ALC880_LG] = "lg", |
| 2955 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 2956 | [ALC880_MEDION_RIM] = "medion", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2957 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2958 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2959 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2960 | [ALC880_AUTO] = "auto", |
| 2961 | }; |
| 2962 | |
| 2963 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2964 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2965 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2966 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2967 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2968 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2969 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2970 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2971 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2972 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2973 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2974 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2975 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2976 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2977 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2978 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2979 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2980 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2981 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2982 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2983 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2984 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Travis Place | 186c311 | 2008-05-20 11:54:41 +0200 | [diff] [blame] | 2985 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS P5GD1 w/SPDIF", ALC880_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2986 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2987 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2988 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2989 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2990 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2991 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2992 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2993 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2994 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2995 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2996 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2997 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2998 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2999 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 3000 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3001 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3002 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3003 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3004 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3005 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 3006 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3007 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3008 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3009 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3010 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3011 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3012 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3013 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3014 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3015 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 3016 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3017 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3018 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 3019 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 3020 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 3021 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3022 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 3023 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3024 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3025 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3026 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 3027 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3028 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 3029 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 3030 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 3031 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 3032 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 3033 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3034 | {} |
| 3035 | }; |
| 3036 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3037 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3038 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3039 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3040 | static struct alc_config_preset alc880_presets[] = { |
| 3041 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3042 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3043 | .init_verbs = { alc880_volume_init_verbs, |
| 3044 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3045 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3046 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3047 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3048 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3049 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3050 | .input_mux = &alc880_capture_source, |
| 3051 | }, |
| 3052 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3054 | .init_verbs = { alc880_volume_init_verbs, |
| 3055 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3056 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3057 | .dac_nids = alc880_dac_nids, |
| 3058 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3059 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3060 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3061 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3062 | .input_mux = &alc880_capture_source, |
| 3063 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3064 | [ALC880_TCL_S700] = { |
| 3065 | .mixers = { alc880_tcl_s700_mixer }, |
| 3066 | .init_verbs = { alc880_volume_init_verbs, |
| 3067 | alc880_pin_tcl_S700_init_verbs, |
| 3068 | alc880_gpio2_init_verbs }, |
| 3069 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3070 | .dac_nids = alc880_dac_nids, |
| 3071 | .hp_nid = 0x03, |
| 3072 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3073 | .channel_mode = alc880_2_jack_modes, |
| 3074 | .input_mux = &alc880_capture_source, |
| 3075 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3076 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3077 | .mixers = { alc880_three_stack_mixer, |
| 3078 | alc880_five_stack_mixer}, |
| 3079 | .init_verbs = { alc880_volume_init_verbs, |
| 3080 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3081 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3082 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3083 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3084 | .channel_mode = alc880_fivestack_modes, |
| 3085 | .input_mux = &alc880_capture_source, |
| 3086 | }, |
| 3087 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3088 | .mixers = { alc880_three_stack_mixer, |
| 3089 | alc880_five_stack_mixer }, |
| 3090 | .init_verbs = { alc880_volume_init_verbs, |
| 3091 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3092 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3093 | .dac_nids = alc880_dac_nids, |
| 3094 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3095 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3096 | .channel_mode = alc880_fivestack_modes, |
| 3097 | .input_mux = &alc880_capture_source, |
| 3098 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3099 | [ALC880_6ST] = { |
| 3100 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3101 | .init_verbs = { alc880_volume_init_verbs, |
| 3102 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3103 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3104 | .dac_nids = alc880_6st_dac_nids, |
| 3105 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3106 | .channel_mode = alc880_sixstack_modes, |
| 3107 | .input_mux = &alc880_6stack_capture_source, |
| 3108 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3109 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3110 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3111 | .init_verbs = { alc880_volume_init_verbs, |
| 3112 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3113 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3114 | .dac_nids = alc880_6st_dac_nids, |
| 3115 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3116 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3117 | .channel_mode = alc880_sixstack_modes, |
| 3118 | .input_mux = &alc880_6stack_capture_source, |
| 3119 | }, |
| 3120 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3121 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3122 | .init_verbs = { alc880_volume_init_verbs, |
| 3123 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3124 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3125 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3126 | .dac_nids = alc880_w810_dac_nids, |
| 3127 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3128 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3129 | .channel_mode = alc880_w810_modes, |
| 3130 | .input_mux = &alc880_capture_source, |
| 3131 | }, |
| 3132 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3134 | .init_verbs = { alc880_volume_init_verbs, |
| 3135 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3136 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3137 | .dac_nids = alc880_z71v_dac_nids, |
| 3138 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3139 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3140 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3141 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3142 | .input_mux = &alc880_capture_source, |
| 3143 | }, |
| 3144 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3145 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3146 | .init_verbs = { alc880_volume_init_verbs, |
| 3147 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3148 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3149 | .dac_nids = alc880_f1734_dac_nids, |
| 3150 | .hp_nid = 0x02, |
| 3151 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3152 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3153 | .input_mux = &alc880_f1734_capture_source, |
| 3154 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3155 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3156 | }, |
| 3157 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3158 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3159 | .init_verbs = { alc880_volume_init_verbs, |
| 3160 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3161 | alc880_gpio1_init_verbs }, |
| 3162 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3163 | .dac_nids = alc880_asus_dac_nids, |
| 3164 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3165 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3166 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3167 | .input_mux = &alc880_capture_source, |
| 3168 | }, |
| 3169 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3170 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3171 | .init_verbs = { alc880_volume_init_verbs, |
| 3172 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3173 | alc880_gpio1_init_verbs }, |
| 3174 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3175 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3176 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3177 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3178 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3179 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3180 | .input_mux = &alc880_capture_source, |
| 3181 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3182 | [ALC880_ASUS_DIG2] = { |
| 3183 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3184 | .init_verbs = { alc880_volume_init_verbs, |
| 3185 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3186 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3187 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3188 | .dac_nids = alc880_asus_dac_nids, |
| 3189 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3190 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3191 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3192 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3193 | .input_mux = &alc880_capture_source, |
| 3194 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3195 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3196 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3197 | .init_verbs = { alc880_volume_init_verbs, |
| 3198 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3199 | alc880_gpio1_init_verbs }, |
| 3200 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3201 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3202 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3203 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3204 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3205 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3206 | .input_mux = &alc880_capture_source, |
| 3207 | }, |
| 3208 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3209 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3210 | .init_verbs = { alc880_volume_init_verbs, |
| 3211 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3212 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3213 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3214 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3215 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3216 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3217 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3218 | .input_mux = &alc880_capture_source, |
| 3219 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3220 | [ALC880_UNIWILL] = { |
| 3221 | .mixers = { alc880_uniwill_mixer }, |
| 3222 | .init_verbs = { alc880_volume_init_verbs, |
| 3223 | alc880_uniwill_init_verbs }, |
| 3224 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3225 | .dac_nids = alc880_asus_dac_nids, |
| 3226 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3227 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3228 | .channel_mode = alc880_threestack_modes, |
| 3229 | .need_dac_fix = 1, |
| 3230 | .input_mux = &alc880_capture_source, |
| 3231 | .unsol_event = alc880_uniwill_unsol_event, |
| 3232 | .init_hook = alc880_uniwill_automute, |
| 3233 | }, |
| 3234 | [ALC880_UNIWILL_P53] = { |
| 3235 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3236 | .init_verbs = { alc880_volume_init_verbs, |
| 3237 | alc880_uniwill_p53_init_verbs }, |
| 3238 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3239 | .dac_nids = alc880_asus_dac_nids, |
| 3240 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3241 | .channel_mode = alc880_threestack_modes, |
| 3242 | .input_mux = &alc880_capture_source, |
| 3243 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3244 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3245 | }, |
| 3246 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3247 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3248 | alc880_pcbeep_mixer, }, |
| 3249 | .init_verbs = { alc880_volume_init_verbs, |
| 3250 | alc880_uniwill_p53_init_verbs, |
| 3251 | alc880_beep_init_verbs }, |
| 3252 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3253 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3254 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3255 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3256 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3257 | .input_mux = &alc880_capture_source, |
| 3258 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3259 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3260 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3261 | [ALC880_CLEVO] = { |
| 3262 | .mixers = { alc880_three_stack_mixer }, |
| 3263 | .init_verbs = { alc880_volume_init_verbs, |
| 3264 | alc880_pin_clevo_init_verbs }, |
| 3265 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3266 | .dac_nids = alc880_dac_nids, |
| 3267 | .hp_nid = 0x03, |
| 3268 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3269 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3270 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3271 | .input_mux = &alc880_capture_source, |
| 3272 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3273 | [ALC880_LG] = { |
| 3274 | .mixers = { alc880_lg_mixer }, |
| 3275 | .init_verbs = { alc880_volume_init_verbs, |
| 3276 | alc880_lg_init_verbs }, |
| 3277 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3278 | .dac_nids = alc880_lg_dac_nids, |
| 3279 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3280 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3281 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3282 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3283 | .input_mux = &alc880_lg_capture_source, |
| 3284 | .unsol_event = alc880_lg_unsol_event, |
| 3285 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3286 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3287 | .loopbacks = alc880_lg_loopbacks, |
| 3288 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3289 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3290 | [ALC880_LG_LW] = { |
| 3291 | .mixers = { alc880_lg_lw_mixer }, |
| 3292 | .init_verbs = { alc880_volume_init_verbs, |
| 3293 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3294 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3295 | .dac_nids = alc880_dac_nids, |
| 3296 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3297 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3298 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3299 | .input_mux = &alc880_lg_lw_capture_source, |
| 3300 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3301 | .init_hook = alc880_lg_lw_automute, |
| 3302 | }, |
Takashi Iwai | df99cd3 | 2008-04-25 15:25:04 +0200 | [diff] [blame] | 3303 | [ALC880_MEDION_RIM] = { |
| 3304 | .mixers = { alc880_medion_rim_mixer }, |
| 3305 | .init_verbs = { alc880_volume_init_verbs, |
| 3306 | alc880_medion_rim_init_verbs, |
| 3307 | alc_gpio2_init_verbs }, |
| 3308 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3309 | .dac_nids = alc880_dac_nids, |
| 3310 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3311 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3312 | .channel_mode = alc880_2_jack_modes, |
| 3313 | .input_mux = &alc880_medion_rim_capture_source, |
| 3314 | .unsol_event = alc880_medion_rim_unsol_event, |
| 3315 | .init_hook = alc880_medion_rim_automute, |
| 3316 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3317 | #ifdef CONFIG_SND_DEBUG |
| 3318 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3319 | .mixers = { alc880_test_mixer }, |
| 3320 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3321 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3322 | .dac_nids = alc880_test_dac_nids, |
| 3323 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3324 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3325 | .channel_mode = alc880_test_modes, |
| 3326 | .input_mux = &alc880_test_capture_source, |
| 3327 | }, |
| 3328 | #endif |
| 3329 | }; |
| 3330 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3331 | /* |
| 3332 | * Automatic parse of I/O pins from the BIOS configuration |
| 3333 | */ |
| 3334 | |
| 3335 | #define NUM_CONTROL_ALLOC 32 |
| 3336 | #define NUM_VERB_ALLOC 32 |
| 3337 | |
| 3338 | enum { |
| 3339 | ALC_CTL_WIDGET_VOL, |
| 3340 | ALC_CTL_WIDGET_MUTE, |
| 3341 | ALC_CTL_BIND_MUTE, |
| 3342 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3343 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3344 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3345 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3346 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3347 | }; |
| 3348 | |
| 3349 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3350 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3351 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3353 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3354 | |
| 3355 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3356 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3357 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3358 | /* array + terminator */ |
| 3359 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3360 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3361 | return -ENOMEM; |
| 3362 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3363 | memcpy(knew, spec->kctl_alloc, |
| 3364 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3365 | kfree(spec->kctl_alloc); |
| 3366 | } |
| 3367 | spec->kctl_alloc = knew; |
| 3368 | spec->num_kctl_alloc = num; |
| 3369 | } |
| 3370 | |
| 3371 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3372 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3373 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3374 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3375 | return -ENOMEM; |
| 3376 | knew->private_value = val; |
| 3377 | spec->num_kctl_used++; |
| 3378 | return 0; |
| 3379 | } |
| 3380 | |
| 3381 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3382 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3383 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3384 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3385 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3386 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3387 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3388 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3389 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3390 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3391 | #define ALC880_PIN_CD_NID 0x1c |
| 3392 | |
| 3393 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3394 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3395 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3396 | { |
| 3397 | hda_nid_t nid; |
| 3398 | int assigned[4]; |
| 3399 | int i, j; |
| 3400 | |
| 3401 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3402 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3403 | |
| 3404 | /* check the pins hardwired to audio widget */ |
| 3405 | for (i = 0; i < cfg->line_outs; i++) { |
| 3406 | nid = cfg->line_out_pins[i]; |
| 3407 | if (alc880_is_fixed_pin(nid)) { |
| 3408 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3409 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3410 | assigned[idx] = 1; |
| 3411 | } |
| 3412 | } |
| 3413 | /* left pins can be connect to any audio widget */ |
| 3414 | for (i = 0; i < cfg->line_outs; i++) { |
| 3415 | nid = cfg->line_out_pins[i]; |
| 3416 | if (alc880_is_fixed_pin(nid)) |
| 3417 | continue; |
| 3418 | /* search for an empty channel */ |
| 3419 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3420 | if (!assigned[j]) { |
| 3421 | spec->multiout.dac_nids[i] = |
| 3422 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3423 | assigned[j] = 1; |
| 3424 | break; |
| 3425 | } |
| 3426 | } |
| 3427 | } |
| 3428 | spec->multiout.num_dacs = cfg->line_outs; |
| 3429 | return 0; |
| 3430 | } |
| 3431 | |
| 3432 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3433 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3434 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | { |
| 3436 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3437 | static const char *chname[4] = { |
| 3438 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3439 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3440 | hda_nid_t nid; |
| 3441 | int i, err; |
| 3442 | |
| 3443 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3444 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3445 | continue; |
| 3446 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3447 | if (i == 2) { |
| 3448 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3449 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3450 | "Center Playback Volume", |
| 3451 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3452 | HDA_OUTPUT)); |
| 3453 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3454 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3455 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3456 | "LFE Playback Volume", |
| 3457 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3458 | HDA_OUTPUT)); |
| 3459 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3460 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3461 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3462 | "Center Playback Switch", |
| 3463 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3464 | HDA_INPUT)); |
| 3465 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3466 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3467 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3468 | "LFE Playback Switch", |
| 3469 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3470 | HDA_INPUT)); |
| 3471 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3472 | return err; |
| 3473 | } else { |
| 3474 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3475 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3476 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3477 | HDA_OUTPUT)); |
| 3478 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3479 | return err; |
| 3480 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3481 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3482 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3483 | HDA_INPUT)); |
| 3484 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3485 | return err; |
| 3486 | } |
| 3487 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3488 | return 0; |
| 3489 | } |
| 3490 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3491 | /* add playback controls for speaker and HP outputs */ |
| 3492 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3493 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3494 | { |
| 3495 | hda_nid_t nid; |
| 3496 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3497 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3499 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3500 | return 0; |
| 3501 | |
| 3502 | if (alc880_is_fixed_pin(pin)) { |
| 3503 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3504 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3505 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3506 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3507 | else |
| 3508 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3509 | /* control HP volume/switch on the output mixer amp */ |
| 3510 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3511 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3512 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3513 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3514 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3515 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3516 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3517 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3518 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3519 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3520 | return err; |
| 3521 | } else if (alc880_is_multi_pin(pin)) { |
| 3522 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3523 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3524 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3525 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3526 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3527 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3528 | return err; |
| 3529 | } |
| 3530 | return 0; |
| 3531 | } |
| 3532 | |
| 3533 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3534 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3535 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3536 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3537 | { |
| 3538 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3539 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3540 | |
| 3541 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3542 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3543 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 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", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3547 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3548 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3549 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3550 | return err; |
| 3551 | return 0; |
| 3552 | } |
| 3553 | |
| 3554 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3555 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3556 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3558 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3559 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3560 | |
| 3561 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3562 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3563 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3564 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3565 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3566 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3567 | if (err < 0) |
| 3568 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3569 | imux->items[imux->num_items].label = |
| 3570 | auto_pin_cfg_labels[i]; |
| 3571 | imux->items[imux->num_items].index = |
| 3572 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3573 | imux->num_items++; |
| 3574 | } |
| 3575 | } |
| 3576 | return 0; |
| 3577 | } |
| 3578 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3579 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3580 | unsigned int pin_type) |
| 3581 | { |
| 3582 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3583 | pin_type); |
| 3584 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3585 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3586 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3587 | } |
| 3588 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3589 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3590 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3591 | int dac_idx) |
| 3592 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3593 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3594 | /* need the manual connection? */ |
| 3595 | if (alc880_is_multi_pin(nid)) { |
| 3596 | struct alc_spec *spec = codec->spec; |
| 3597 | int idx = alc880_multi_pin_idx(nid); |
| 3598 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3599 | AC_VERB_SET_CONNECT_SEL, |
| 3600 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3601 | } |
| 3602 | } |
| 3603 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3604 | static int get_pin_type(int line_out_type) |
| 3605 | { |
| 3606 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3607 | return PIN_HP; |
| 3608 | else |
| 3609 | return PIN_OUT; |
| 3610 | } |
| 3611 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3612 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3613 | { |
| 3614 | struct alc_spec *spec = codec->spec; |
| 3615 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3616 | |
| 3617 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3618 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3619 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3620 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3621 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3622 | } |
| 3623 | } |
| 3624 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3625 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3626 | { |
| 3627 | struct alc_spec *spec = codec->spec; |
| 3628 | hda_nid_t pin; |
| 3629 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3630 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3631 | if (pin) /* connect to front */ |
| 3632 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3633 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3634 | if (pin) /* connect to front */ |
| 3635 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3636 | } |
| 3637 | |
| 3638 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3639 | { |
| 3640 | struct alc_spec *spec = codec->spec; |
| 3641 | int i; |
| 3642 | |
| 3643 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3644 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3645 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3646 | snd_hda_codec_write(codec, nid, 0, |
| 3647 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3648 | i <= AUTO_PIN_FRONT_MIC ? |
| 3649 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3650 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3651 | snd_hda_codec_write(codec, nid, 0, |
| 3652 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3653 | AMP_OUT_MUTE); |
| 3654 | } |
| 3655 | } |
| 3656 | } |
| 3657 | |
| 3658 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3659 | /* return 1 if successful, 0 if the proper config is not found, |
| 3660 | * or a negative error code |
| 3661 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3662 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3663 | { |
| 3664 | struct alc_spec *spec = codec->spec; |
| 3665 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3666 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3667 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3668 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3669 | alc880_ignore); |
| 3670 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3671 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3672 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3673 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3674 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3675 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3676 | if (err < 0) |
| 3677 | return err; |
| 3678 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3679 | if (err < 0) |
| 3680 | return err; |
| 3681 | err = alc880_auto_create_extra_out(spec, |
| 3682 | spec->autocfg.speaker_pins[0], |
| 3683 | "Speaker"); |
| 3684 | if (err < 0) |
| 3685 | return err; |
| 3686 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3687 | "Headphone"); |
| 3688 | if (err < 0) |
| 3689 | return err; |
| 3690 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3691 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3692 | return err; |
| 3693 | |
| 3694 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3695 | |
| 3696 | if (spec->autocfg.dig_out_pin) |
| 3697 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3698 | if (spec->autocfg.dig_in_pin) |
| 3699 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3700 | |
| 3701 | if (spec->kctl_alloc) |
| 3702 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3703 | |
| 3704 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3705 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3706 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3707 | spec->input_mux = &spec->private_imux; |
| 3708 | |
| 3709 | return 1; |
| 3710 | } |
| 3711 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3712 | /* additional initialization for auto-configuration model */ |
| 3713 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3714 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3715 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3716 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3717 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3718 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3719 | if (spec->unsol_event) |
| 3720 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3721 | } |
| 3722 | |
| 3723 | /* |
| 3724 | * OK, here we have finally the patch for ALC880 |
| 3725 | */ |
| 3726 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3727 | static int patch_alc880(struct hda_codec *codec) |
| 3728 | { |
| 3729 | struct alc_spec *spec; |
| 3730 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3731 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3732 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3733 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3734 | if (spec == NULL) |
| 3735 | return -ENOMEM; |
| 3736 | |
| 3737 | codec->spec = spec; |
| 3738 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3739 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3740 | alc880_models, |
| 3741 | alc880_cfg_tbl); |
| 3742 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3743 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3744 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3745 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3746 | } |
| 3747 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3748 | if (board_config == ALC880_AUTO) { |
| 3749 | /* automatic parse from the BIOS config */ |
| 3750 | err = alc880_parse_auto_config(codec); |
| 3751 | if (err < 0) { |
| 3752 | alc_free(codec); |
| 3753 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3754 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3755 | printk(KERN_INFO |
| 3756 | "hda_codec: Cannot set up configuration " |
| 3757 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3758 | board_config = ALC880_3ST; |
| 3759 | } |
| 3760 | } |
| 3761 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3762 | if (board_config != ALC880_AUTO) |
| 3763 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3764 | |
| 3765 | spec->stream_name_analog = "ALC880 Analog"; |
| 3766 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3767 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3768 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3769 | |
| 3770 | spec->stream_name_digital = "ALC880 Digital"; |
| 3771 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3772 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3773 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3774 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3775 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3776 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3777 | /* get type */ |
| 3778 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3779 | if (wcap != AC_WID_AUD_IN) { |
| 3780 | spec->adc_nids = alc880_adc_nids_alt; |
| 3781 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3782 | spec->mixers[spec->num_mixers] = |
| 3783 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3784 | spec->num_mixers++; |
| 3785 | } else { |
| 3786 | spec->adc_nids = alc880_adc_nids; |
| 3787 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3788 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3789 | spec->num_mixers++; |
| 3790 | } |
| 3791 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3792 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3793 | spec->vmaster_nid = 0x0c; |
| 3794 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3795 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3796 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3797 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3798 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3799 | if (!spec->loopback.amplist) |
| 3800 | spec->loopback.amplist = alc880_loopbacks; |
| 3801 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3802 | |
| 3803 | return 0; |
| 3804 | } |
| 3805 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3806 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3807 | /* |
| 3808 | * ALC260 support |
| 3809 | */ |
| 3810 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3811 | static hda_nid_t alc260_dac_nids[1] = { |
| 3812 | /* front */ |
| 3813 | 0x02, |
| 3814 | }; |
| 3815 | |
| 3816 | static hda_nid_t alc260_adc_nids[1] = { |
| 3817 | /* ADC0 */ |
| 3818 | 0x04, |
| 3819 | }; |
| 3820 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3821 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3822 | /* ADC1 */ |
| 3823 | 0x05, |
| 3824 | }; |
| 3825 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3826 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3827 | /* ADC1, 0 */ |
| 3828 | 0x05, 0x04 |
| 3829 | }; |
| 3830 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3831 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3832 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3833 | */ |
| 3834 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3835 | /* ADC0, ADC1 */ |
| 3836 | 0x04, 0x05 |
| 3837 | }; |
| 3838 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3839 | #define ALC260_DIGOUT_NID 0x03 |
| 3840 | #define ALC260_DIGIN_NID 0x06 |
| 3841 | |
| 3842 | static struct hda_input_mux alc260_capture_source = { |
| 3843 | .num_items = 4, |
| 3844 | .items = { |
| 3845 | { "Mic", 0x0 }, |
| 3846 | { "Front Mic", 0x1 }, |
| 3847 | { "Line", 0x2 }, |
| 3848 | { "CD", 0x4 }, |
| 3849 | }, |
| 3850 | }; |
| 3851 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3852 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3853 | * headphone jack and the internal CD lines since these are the only pins at |
| 3854 | * which audio can appear. For flexibility, also allow the option of |
| 3855 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3856 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3857 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3858 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3859 | { |
| 3860 | .num_items = 3, |
| 3861 | .items = { |
| 3862 | { "Mic/Line", 0x0 }, |
| 3863 | { "CD", 0x4 }, |
| 3864 | { "Headphone", 0x2 }, |
| 3865 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3866 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3867 | { |
| 3868 | .num_items = 4, |
| 3869 | .items = { |
| 3870 | { "Mic/Line", 0x0 }, |
| 3871 | { "CD", 0x4 }, |
| 3872 | { "Headphone", 0x2 }, |
| 3873 | { "Mixer", 0x5 }, |
| 3874 | }, |
| 3875 | }, |
| 3876 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3877 | }; |
| 3878 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3879 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3880 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3881 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3882 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3883 | { |
| 3884 | .num_items = 4, |
| 3885 | .items = { |
| 3886 | { "Mic", 0x0 }, |
| 3887 | { "Line", 0x2 }, |
| 3888 | { "CD", 0x4 }, |
| 3889 | { "Headphone", 0x5 }, |
| 3890 | }, |
| 3891 | }, |
| 3892 | { |
| 3893 | .num_items = 5, |
| 3894 | .items = { |
| 3895 | { "Mic", 0x0 }, |
| 3896 | { "Line", 0x2 }, |
| 3897 | { "CD", 0x4 }, |
| 3898 | { "Headphone", 0x6 }, |
| 3899 | { "Mixer", 0x5 }, |
| 3900 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3901 | }, |
| 3902 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3903 | /* |
| 3904 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3905 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3906 | * element which allows changing the channel mode, so the verb list is |
| 3907 | * never used. |
| 3908 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3909 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3910 | { 2, NULL }, |
| 3911 | }; |
| 3912 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3913 | |
| 3914 | /* Mixer combinations |
| 3915 | * |
| 3916 | * basic: base_output + input + pc_beep + capture |
| 3917 | * HP: base_output + input + capture_alt |
| 3918 | * HP_3013: hp_3013 + input + capture |
| 3919 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3920 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3921 | */ |
| 3922 | |
| 3923 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3924 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3925 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3926 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3927 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3928 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3929 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3930 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3931 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3932 | |
| 3933 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3934 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3935 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3937 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3938 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3939 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3940 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3941 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3942 | { } /* end */ |
| 3943 | }; |
| 3944 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3945 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3946 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3947 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3948 | { } /* end */ |
| 3949 | }; |
| 3950 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3951 | /* update HP, line and mono out pins according to the master switch */ |
| 3952 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3953 | hda_nid_t hp, hda_nid_t line, |
| 3954 | hda_nid_t mono) |
| 3955 | { |
| 3956 | struct alc_spec *spec = codec->spec; |
| 3957 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3958 | /* change HP and line-out pins */ |
| 3959 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3960 | val); |
| 3961 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3962 | val); |
| 3963 | /* mono (speaker) depending on the HP jack sense */ |
| 3964 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3965 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3966 | val); |
| 3967 | } |
| 3968 | |
| 3969 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3970 | struct snd_ctl_elem_value *ucontrol) |
| 3971 | { |
| 3972 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3973 | struct alc_spec *spec = codec->spec; |
| 3974 | *ucontrol->value.integer.value = spec->master_sw; |
| 3975 | return 0; |
| 3976 | } |
| 3977 | |
| 3978 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3979 | struct snd_ctl_elem_value *ucontrol) |
| 3980 | { |
| 3981 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3982 | struct alc_spec *spec = codec->spec; |
| 3983 | int val = !!*ucontrol->value.integer.value; |
| 3984 | hda_nid_t hp, line, mono; |
| 3985 | |
| 3986 | if (val == spec->master_sw) |
| 3987 | return 0; |
| 3988 | spec->master_sw = val; |
| 3989 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3990 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3991 | mono = kcontrol->private_value & 0xff; |
| 3992 | alc260_hp_master_update(codec, hp, line, mono); |
| 3993 | return 1; |
| 3994 | } |
| 3995 | |
| 3996 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3997 | { |
| 3998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3999 | .name = "Master Playback Switch", |
| 4000 | .info = snd_ctl_boolean_mono_info, |
| 4001 | .get = alc260_hp_master_sw_get, |
| 4002 | .put = alc260_hp_master_sw_put, |
| 4003 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 4004 | }, |
| 4005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4006 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 4007 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4008 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 4009 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 4010 | HDA_OUTPUT), |
| 4011 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4012 | { } /* end */ |
| 4013 | }; |
| 4014 | |
| 4015 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 4016 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4017 | {}, |
| 4018 | }; |
| 4019 | |
| 4020 | static void alc260_hp_automute(struct hda_codec *codec) |
| 4021 | { |
| 4022 | struct alc_spec *spec = codec->spec; |
| 4023 | unsigned int present; |
| 4024 | |
| 4025 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 4026 | AC_VERB_GET_PIN_SENSE, 0); |
| 4027 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4028 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 4029 | } |
| 4030 | |
| 4031 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 4032 | { |
| 4033 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4034 | alc260_hp_automute(codec); |
| 4035 | } |
| 4036 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4037 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4038 | { |
| 4039 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4040 | .name = "Master Playback Switch", |
| 4041 | .info = snd_ctl_boolean_mono_info, |
| 4042 | .get = alc260_hp_master_sw_get, |
| 4043 | .put = alc260_hp_master_sw_put, |
| 4044 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 4045 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4047 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 4048 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4049 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4050 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4051 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 4052 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4053 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4054 | { } /* end */ |
| 4055 | }; |
| 4056 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 4057 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 4058 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4059 | {}, |
| 4060 | }; |
| 4061 | |
| 4062 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 4063 | { |
| 4064 | struct alc_spec *spec = codec->spec; |
| 4065 | unsigned int present; |
| 4066 | |
| 4067 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 4068 | AC_VERB_GET_PIN_SENSE, 0); |
| 4069 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 4070 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 4071 | } |
| 4072 | |
| 4073 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 4074 | unsigned int res) |
| 4075 | { |
| 4076 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4077 | alc260_hp_3013_automute(codec); |
| 4078 | } |
| 4079 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4080 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 4081 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 4082 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 4083 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4084 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 4085 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4086 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4087 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4088 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4089 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4090 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4091 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4092 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4093 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4094 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4095 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4096 | { } /* end */ |
| 4097 | }; |
| 4098 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4099 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4100 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4101 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4102 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4103 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4104 | * revisions available in early 2006. Therefore for now allow the |
| 4105 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4106 | * that the lack of mic bias for this NID is intentional we could change the |
| 4107 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4108 | * |
| 4109 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4110 | * don't appear to make the mic bias available from the "line" jack, even |
| 4111 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4112 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4113 | * and the output jack. If this turns out to be the case for all such |
| 4114 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4115 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4116 | * |
| 4117 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4118 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4119 | * controls for such models. On models without a "mono speaker" the control |
| 4120 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4121 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4122 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4123 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4124 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4125 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4126 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4127 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4128 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4129 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4130 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4131 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4132 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4133 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4134 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4135 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4136 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4137 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4138 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4139 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4140 | { } /* end */ |
| 4141 | }; |
| 4142 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4143 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4144 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4145 | */ |
| 4146 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4147 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4148 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4149 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4150 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4151 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4152 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4153 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4154 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4155 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4156 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4157 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4158 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4159 | { } /* end */ |
| 4160 | }; |
| 4161 | |
| 4162 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4163 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4164 | */ |
| 4165 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4166 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4167 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4168 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4169 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4170 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4171 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4172 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4173 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4174 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4175 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4176 | { } /* end */ |
| 4177 | }; |
| 4178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4179 | /* capture mixer elements */ |
| 4180 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4181 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4182 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4183 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4184 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4185 | { |
| 4186 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4187 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4188 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4189 | */ |
| 4190 | /* .name = "Capture Source", */ |
| 4191 | .name = "Input Source", |
| 4192 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4193 | .info = alc_mux_enum_info, |
| 4194 | .get = alc_mux_enum_get, |
| 4195 | .put = alc_mux_enum_put, |
| 4196 | }, |
| 4197 | { } /* end */ |
| 4198 | }; |
| 4199 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4200 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4201 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4202 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4203 | { |
| 4204 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4205 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4206 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4207 | */ |
| 4208 | /* .name = "Capture Source", */ |
| 4209 | .name = "Input Source", |
| 4210 | .count = 1, |
| 4211 | .info = alc_mux_enum_info, |
| 4212 | .get = alc_mux_enum_get, |
| 4213 | .put = alc_mux_enum_put, |
| 4214 | }, |
| 4215 | { } /* end */ |
| 4216 | }; |
| 4217 | |
| 4218 | /* |
| 4219 | * initialization verbs |
| 4220 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4221 | static struct hda_verb alc260_init_verbs[] = { |
| 4222 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4224 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4225 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4226 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4227 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4228 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4229 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4230 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4231 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4232 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4233 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4234 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4235 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4236 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4237 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4238 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4239 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4240 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4241 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4242 | /* set connection select to line in (default select for this ADC) */ |
| 4243 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4244 | /* mute capture amp left and right */ |
| 4245 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4246 | /* set connection select to line in (default select for this ADC) */ |
| 4247 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4248 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4249 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4250 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4251 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4252 | /* set vol=0 HP mixer amp left and right */ |
| 4253 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4254 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4255 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4256 | /* set vol=0 Mono mixer amp left and right */ |
| 4257 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4258 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4259 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4260 | /* unmute LINE-2 out pin */ |
| 4261 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4262 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4263 | * Line In 2 = 0x03 |
| 4264 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4265 | /* mute analog inputs */ |
| 4266 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4267 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4268 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4269 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4271 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4272 | /* mute Front out path */ |
| 4273 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4274 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4275 | /* mute Headphone out path */ |
| 4276 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4277 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4278 | /* mute Mono out path */ |
| 4279 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4280 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4281 | { } |
| 4282 | }; |
| 4283 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4284 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4285 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4286 | /* Headphone and output */ |
| 4287 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4288 | /* mono output */ |
| 4289 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4290 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4291 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4292 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4293 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4294 | /* Line In pin widget for input */ |
| 4295 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4296 | /* Line-2 pin widget for output */ |
| 4297 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4298 | /* CD pin widget for input */ |
| 4299 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4300 | /* unmute amp left and right */ |
| 4301 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4302 | /* set connection select to line in (default select for this ADC) */ |
| 4303 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4304 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4305 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4306 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4307 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4308 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4309 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4310 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4311 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4312 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4313 | * Line In 2 = 0x03 |
| 4314 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4315 | /* mute analog inputs */ |
| 4316 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4317 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4318 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4319 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4320 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4321 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4322 | /* Unmute Front out path */ |
| 4323 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4325 | /* Unmute Headphone out path */ |
| 4326 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4328 | /* Unmute Mono out path */ |
| 4329 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4330 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4331 | { } |
| 4332 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4333 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4334 | |
| 4335 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4336 | /* Line out and output */ |
| 4337 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4338 | /* mono output */ |
| 4339 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4340 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4341 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4342 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4343 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4344 | /* Line In pin widget for input */ |
| 4345 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4346 | /* Headphone pin widget for output */ |
| 4347 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4348 | /* CD pin widget for input */ |
| 4349 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4350 | /* unmute amp left and right */ |
| 4351 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4352 | /* set connection select to line in (default select for this ADC) */ |
| 4353 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4354 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4356 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4357 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4358 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4359 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4360 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4361 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4362 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4363 | * Line In 2 = 0x03 |
| 4364 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4365 | /* mute analog inputs */ |
| 4366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4369 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4370 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4371 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4372 | /* Unmute Front out path */ |
| 4373 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4374 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4375 | /* Unmute Headphone out path */ |
| 4376 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4377 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4378 | /* Unmute Mono out path */ |
| 4379 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4380 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4381 | { } |
| 4382 | }; |
| 4383 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4384 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4385 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4386 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4387 | */ |
| 4388 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4389 | /* Disable all GPIOs */ |
| 4390 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4391 | /* Internal speaker is connected to headphone pin */ |
| 4392 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4393 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4394 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4395 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4396 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4397 | /* Ensure all other unused pins are disabled and muted. */ |
| 4398 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4399 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4400 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4401 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4402 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4403 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4404 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4405 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4406 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4407 | /* Disable digital (SPDIF) pins */ |
| 4408 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4409 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4410 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4411 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4412 | * when acting as an output. |
| 4413 | */ |
| 4414 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4415 | |
| 4416 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4417 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4419 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4420 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4421 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4422 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4423 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4424 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4425 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4426 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4427 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4428 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4429 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4430 | * If the pin mode is changed by the user the pin mode control will |
| 4431 | * take care of enabling the pin's input/output buffers as needed. |
| 4432 | * Therefore there's no need to enable the input buffer at this |
| 4433 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4434 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4435 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4436 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4437 | * mixer ctrl) |
| 4438 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4439 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4440 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4441 | /* Mute capture amp left and right */ |
| 4442 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4443 | /* Set ADC connection select to match default mixer setting - line |
| 4444 | * in (on mic1 pin) |
| 4445 | */ |
| 4446 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4447 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4448 | /* Do the same for the second ADC: mute capture input amp and |
| 4449 | * set ADC connection to line in (on mic1 pin) |
| 4450 | */ |
| 4451 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4452 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4453 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4454 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4458 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4459 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4460 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4461 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4462 | {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] | 4463 | |
| 4464 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4465 | }; |
| 4466 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4467 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4468 | * similar laptops (adapted from Fujitsu init verbs). |
| 4469 | */ |
| 4470 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4471 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4472 | * the headphone jack. Turn this on and rely on the standard mute |
| 4473 | * methods whenever the user wants to turn these outputs off. |
| 4474 | */ |
| 4475 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4476 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4477 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4478 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4479 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4480 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4481 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4482 | /* Line In jack is connected to Line1 pin */ |
| 4483 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4484 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4485 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4486 | /* Ensure all other unused pins are disabled and muted. */ |
| 4487 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4488 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4489 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4490 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4491 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4492 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4493 | /* Disable digital (SPDIF) pins */ |
| 4494 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4495 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4496 | |
| 4497 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4498 | * bus when acting as outputs. |
| 4499 | */ |
| 4500 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4501 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4502 | |
| 4503 | /* Start with output sum widgets muted and their output gains at min */ |
| 4504 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4505 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4506 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4507 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4508 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4509 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4510 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4511 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4512 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4513 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4514 | /* Unmute Line-out pin widget amp left and right |
| 4515 | * (no equiv mixer ctrl) |
| 4516 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4517 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4518 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4519 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4520 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4521 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4522 | * will take care of enabling the pin's input/output buffers as needed. |
| 4523 | * Therefore there's no need to enable the input buffer at this |
| 4524 | * stage. |
| 4525 | */ |
| 4526 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4527 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4528 | |
| 4529 | /* Mute capture amp left and right */ |
| 4530 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4531 | /* Set ADC connection select to match default mixer setting - mic |
| 4532 | * (on mic1 pin) |
| 4533 | */ |
| 4534 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4535 | |
| 4536 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4537 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4538 | */ |
| 4539 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4540 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4541 | |
| 4542 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4543 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4544 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4545 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4546 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4547 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4551 | |
| 4552 | { } |
| 4553 | }; |
| 4554 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4555 | static struct hda_verb alc260_will_verbs[] = { |
| 4556 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4557 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4558 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4559 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4560 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4561 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4562 | {} |
| 4563 | }; |
| 4564 | |
| 4565 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4566 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4567 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4568 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4569 | |
| 4570 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4571 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4572 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4573 | |
| 4574 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4575 | {} |
| 4576 | }; |
| 4577 | |
| 4578 | /* toggle speaker-output according to the hp-jack state */ |
| 4579 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4580 | { |
| 4581 | unsigned int present; |
| 4582 | |
| 4583 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4584 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4585 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4586 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4587 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4588 | AC_VERB_SET_GPIO_DATA, 1); |
| 4589 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4590 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4591 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4592 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4593 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4594 | AC_VERB_SET_GPIO_DATA, 0); |
| 4595 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4596 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4597 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4598 | } |
| 4599 | } |
| 4600 | |
| 4601 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4602 | unsigned int res) |
| 4603 | { |
| 4604 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4605 | alc260_replacer_672v_automute(codec); |
| 4606 | } |
| 4607 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4608 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4609 | * configuration. |
| 4610 | */ |
| 4611 | #ifdef CONFIG_SND_DEBUG |
| 4612 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4613 | 0x02, |
| 4614 | }; |
| 4615 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4616 | 0x04, 0x05, |
| 4617 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4618 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4619 | * the signal assignments are different. This assumes that the first ADC |
| 4620 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4621 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4622 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4623 | { |
| 4624 | .num_items = 7, |
| 4625 | .items = { |
| 4626 | { "MIC1 pin", 0x0 }, |
| 4627 | { "MIC2 pin", 0x1 }, |
| 4628 | { "LINE1 pin", 0x2 }, |
| 4629 | { "LINE2 pin", 0x3 }, |
| 4630 | { "CD pin", 0x4 }, |
| 4631 | { "LINE-OUT pin", 0x5 }, |
| 4632 | { "HP-OUT pin", 0x6 }, |
| 4633 | }, |
| 4634 | }, |
| 4635 | { |
| 4636 | .num_items = 8, |
| 4637 | .items = { |
| 4638 | { "MIC1 pin", 0x0 }, |
| 4639 | { "MIC2 pin", 0x1 }, |
| 4640 | { "LINE1 pin", 0x2 }, |
| 4641 | { "LINE2 pin", 0x3 }, |
| 4642 | { "CD pin", 0x4 }, |
| 4643 | { "Mixer", 0x5 }, |
| 4644 | { "LINE-OUT pin", 0x6 }, |
| 4645 | { "HP-OUT pin", 0x7 }, |
| 4646 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4647 | }, |
| 4648 | }; |
| 4649 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4650 | /* Output driver widgets */ |
| 4651 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4652 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4653 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4654 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4655 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4656 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4657 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4658 | /* Modes for retasking pin widgets |
| 4659 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4660 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4661 | * mention this restriction. At this stage it's not clear whether |
| 4662 | * this behaviour is intentional or is a hardware bug in chip |
| 4663 | * revisions available at least up until early 2006. Therefore for |
| 4664 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4665 | * choices, but if it turns out that the lack of mic bias for these |
| 4666 | * NIDs is intentional we could change their modes from |
| 4667 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4668 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4669 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4670 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4671 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4672 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4673 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4674 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4675 | |
| 4676 | /* Loopback mixer controls */ |
| 4677 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4678 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4679 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4680 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4681 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4682 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4683 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4684 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4685 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4686 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4687 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4688 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4689 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4690 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4691 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4692 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4693 | |
| 4694 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4695 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4696 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4697 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4698 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4699 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4700 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4701 | * is ambigious as to which NID is which; testing on laptops which |
| 4702 | * make this output available should provide clarification. |
| 4703 | */ |
| 4704 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4705 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4706 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4707 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4708 | * this output to turn on an external amplifier. |
| 4709 | */ |
| 4710 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4711 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4712 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4713 | { } /* end */ |
| 4714 | }; |
| 4715 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4716 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4717 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4718 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4719 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4720 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4721 | /* Enable retasking pins as output, initially without power amp */ |
| 4722 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4723 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4724 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4725 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4726 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4727 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4728 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4729 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4730 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4731 | * payload also sets the generation to 0, output to be in "consumer" |
| 4732 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4733 | * control. |
| 4734 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4735 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4736 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4737 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4738 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4739 | * OUT1 sum bus when acting as an output. |
| 4740 | */ |
| 4741 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4742 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4743 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4744 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4745 | |
| 4746 | /* Start with output sum widgets muted and their output gains at min */ |
| 4747 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4749 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4751 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4752 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4753 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4754 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4755 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4756 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4757 | /* Unmute retasking pin widget output buffers since the default |
| 4758 | * state appears to be output. As the pin mode is changed by the |
| 4759 | * user the pin mode control will take care of enabling the pin's |
| 4760 | * input/output buffers as needed. |
| 4761 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4762 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4763 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4765 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4766 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4767 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4768 | /* Also unmute the mono-out pin widget */ |
| 4769 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4770 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4771 | /* Mute capture amp left and right */ |
| 4772 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4773 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4774 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4775 | */ |
| 4776 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4777 | |
| 4778 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4779 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4780 | */ |
| 4781 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4782 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4783 | |
| 4784 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4785 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4786 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4788 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4789 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4790 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4791 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4792 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4793 | |
| 4794 | { } |
| 4795 | }; |
| 4796 | #endif |
| 4797 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4798 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4799 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4800 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4801 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4802 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4803 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | /* |
| 4805 | * for BIOS auto-configuration |
| 4806 | */ |
| 4807 | |
| 4808 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4809 | const char *pfx) |
| 4810 | { |
| 4811 | hda_nid_t nid_vol; |
| 4812 | unsigned long vol_val, sw_val; |
| 4813 | char name[32]; |
| 4814 | int err; |
| 4815 | |
| 4816 | if (nid >= 0x0f && nid < 0x11) { |
| 4817 | nid_vol = nid - 0x7; |
| 4818 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4819 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4820 | } else if (nid == 0x11) { |
| 4821 | nid_vol = nid - 0x7; |
| 4822 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4823 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4824 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4825 | nid_vol = 0x08; |
| 4826 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4827 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4828 | } else |
| 4829 | return 0; /* N/A */ |
| 4830 | |
| 4831 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4832 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4833 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4834 | return err; |
| 4835 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4836 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4837 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4838 | return err; |
| 4839 | return 1; |
| 4840 | } |
| 4841 | |
| 4842 | /* add playback controls from the parsed DAC table */ |
| 4843 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4844 | const struct auto_pin_cfg *cfg) |
| 4845 | { |
| 4846 | hda_nid_t nid; |
| 4847 | int err; |
| 4848 | |
| 4849 | spec->multiout.num_dacs = 1; |
| 4850 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4851 | spec->multiout.dac_nids[0] = 0x02; |
| 4852 | |
| 4853 | nid = cfg->line_out_pins[0]; |
| 4854 | if (nid) { |
| 4855 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4856 | if (err < 0) |
| 4857 | return err; |
| 4858 | } |
| 4859 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4860 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4861 | if (nid) { |
| 4862 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4863 | if (err < 0) |
| 4864 | return err; |
| 4865 | } |
| 4866 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4867 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4868 | if (nid) { |
| 4869 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4870 | if (err < 0) |
| 4871 | return err; |
| 4872 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4873 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4874 | } |
| 4875 | |
| 4876 | /* create playback/capture controls for input pins */ |
| 4877 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4878 | const struct auto_pin_cfg *cfg) |
| 4879 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4880 | struct hda_input_mux *imux = &spec->private_imux; |
| 4881 | int i, err, idx; |
| 4882 | |
| 4883 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4884 | if (cfg->input_pins[i] >= 0x12) { |
| 4885 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4886 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4887 | auto_pin_cfg_labels[i], idx, |
| 4888 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4889 | if (err < 0) |
| 4890 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4891 | imux->items[imux->num_items].label = |
| 4892 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4893 | imux->items[imux->num_items].index = idx; |
| 4894 | imux->num_items++; |
| 4895 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4896 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4897 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4898 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4899 | auto_pin_cfg_labels[i], idx, |
| 4900 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4901 | if (err < 0) |
| 4902 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4903 | imux->items[imux->num_items].label = |
| 4904 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4905 | imux->items[imux->num_items].index = idx; |
| 4906 | imux->num_items++; |
| 4907 | } |
| 4908 | } |
| 4909 | return 0; |
| 4910 | } |
| 4911 | |
| 4912 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4913 | hda_nid_t nid, int pin_type, |
| 4914 | int sel_idx) |
| 4915 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4916 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4917 | /* need the manual connection? */ |
| 4918 | if (nid >= 0x12) { |
| 4919 | int idx = nid - 0x12; |
| 4920 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4921 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4922 | } |
| 4923 | } |
| 4924 | |
| 4925 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4926 | { |
| 4927 | struct alc_spec *spec = codec->spec; |
| 4928 | hda_nid_t nid; |
| 4929 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4930 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4931 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4932 | if (nid) { |
| 4933 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4934 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4935 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4936 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4937 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4938 | if (nid) |
| 4939 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4940 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4941 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4942 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4943 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4944 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4945 | |
| 4946 | #define ALC260_PIN_CD_NID 0x16 |
| 4947 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4948 | { |
| 4949 | struct alc_spec *spec = codec->spec; |
| 4950 | int i; |
| 4951 | |
| 4952 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4953 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4954 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4955 | snd_hda_codec_write(codec, nid, 0, |
| 4956 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4957 | i <= AUTO_PIN_FRONT_MIC ? |
| 4958 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4959 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4960 | snd_hda_codec_write(codec, nid, 0, |
| 4961 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4962 | AMP_OUT_MUTE); |
| 4963 | } |
| 4964 | } |
| 4965 | } |
| 4966 | |
| 4967 | /* |
| 4968 | * generic initialization of ADC, input mixers and output mixers |
| 4969 | */ |
| 4970 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4971 | /* |
| 4972 | * Unmute ADC0-1 and set the default input to mic-in |
| 4973 | */ |
| 4974 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4975 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4976 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4977 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4978 | |
| 4979 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4980 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4981 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4982 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4983 | */ |
| 4984 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4985 | /* mute analog inputs */ |
| 4986 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4987 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4988 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4989 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4990 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4991 | |
| 4992 | /* |
| 4993 | * Set up output mixers (0x08 - 0x0a) |
| 4994 | */ |
| 4995 | /* set vol=0 to output mixers */ |
| 4996 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4997 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4998 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4999 | /* set up input amps for analog loopback */ |
| 5000 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5001 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5002 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5003 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5004 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5005 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5006 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5007 | |
| 5008 | { } |
| 5009 | }; |
| 5010 | |
| 5011 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 5012 | { |
| 5013 | struct alc_spec *spec = codec->spec; |
| 5014 | unsigned int wcap; |
| 5015 | int err; |
| 5016 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 5017 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5018 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 5019 | alc260_ignore); |
| 5020 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5021 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5022 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 5023 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5024 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5025 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5026 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5027 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 5028 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5029 | return err; |
| 5030 | |
| 5031 | spec->multiout.max_channels = 2; |
| 5032 | |
| 5033 | if (spec->autocfg.dig_out_pin) |
| 5034 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 5035 | if (spec->kctl_alloc) |
| 5036 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 5037 | |
| 5038 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 5039 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5040 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5041 | spec->input_mux = &spec->private_imux; |
| 5042 | |
| 5043 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5044 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5045 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 5046 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5047 | spec->adc_nids = alc260_adc_nids_alt; |
| 5048 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 5049 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5050 | } else { |
| 5051 | spec->adc_nids = alc260_adc_nids; |
| 5052 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 5053 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5054 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 5055 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5056 | |
| 5057 | return 1; |
| 5058 | } |
| 5059 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5060 | /* additional initialization for auto-configuration model */ |
| 5061 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5062 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5063 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5064 | alc260_auto_init_multi_out(codec); |
| 5065 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 5066 | if (spec->unsol_event) |
| 5067 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5068 | } |
| 5069 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5070 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5071 | static struct hda_amp_list alc260_loopbacks[] = { |
| 5072 | { 0x07, HDA_INPUT, 0 }, |
| 5073 | { 0x07, HDA_INPUT, 1 }, |
| 5074 | { 0x07, HDA_INPUT, 2 }, |
| 5075 | { 0x07, HDA_INPUT, 3 }, |
| 5076 | { 0x07, HDA_INPUT, 4 }, |
| 5077 | { } /* end */ |
| 5078 | }; |
| 5079 | #endif |
| 5080 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5081 | /* |
| 5082 | * ALC260 configurations |
| 5083 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5084 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 5085 | [ALC260_BASIC] = "basic", |
| 5086 | [ALC260_HP] = "hp", |
| 5087 | [ALC260_HP_3013] = "hp-3013", |
| 5088 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 5089 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5090 | [ALC260_WILL] = "will", |
| 5091 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5092 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5093 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5094 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5095 | [ALC260_AUTO] = "auto", |
| 5096 | }; |
| 5097 | |
| 5098 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5099 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5100 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5101 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5102 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5103 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5104 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5105 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5106 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5107 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5108 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5109 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5110 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5111 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5112 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5113 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5114 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5115 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5116 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5117 | {} |
| 5118 | }; |
| 5119 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5120 | static struct alc_config_preset alc260_presets[] = { |
| 5121 | [ALC260_BASIC] = { |
| 5122 | .mixers = { alc260_base_output_mixer, |
| 5123 | alc260_input_mixer, |
| 5124 | alc260_pc_beep_mixer, |
| 5125 | alc260_capture_mixer }, |
| 5126 | .init_verbs = { alc260_init_verbs }, |
| 5127 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5128 | .dac_nids = alc260_dac_nids, |
| 5129 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5130 | .adc_nids = alc260_adc_nids, |
| 5131 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5132 | .channel_mode = alc260_modes, |
| 5133 | .input_mux = &alc260_capture_source, |
| 5134 | }, |
| 5135 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5136 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5137 | alc260_input_mixer, |
| 5138 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5139 | .init_verbs = { alc260_init_verbs, |
| 5140 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5141 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5142 | .dac_nids = alc260_dac_nids, |
| 5143 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5144 | .adc_nids = alc260_hp_adc_nids, |
| 5145 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5146 | .channel_mode = alc260_modes, |
| 5147 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5148 | .unsol_event = alc260_hp_unsol_event, |
| 5149 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5150 | }, |
| 5151 | [ALC260_HP_3013] = { |
| 5152 | .mixers = { alc260_hp_3013_mixer, |
| 5153 | alc260_input_mixer, |
| 5154 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5155 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5156 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5157 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5158 | .dac_nids = alc260_dac_nids, |
| 5159 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5160 | .adc_nids = alc260_hp_adc_nids, |
| 5161 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5162 | .channel_mode = alc260_modes, |
| 5163 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5164 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5165 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5166 | }, |
| 5167 | [ALC260_FUJITSU_S702X] = { |
| 5168 | .mixers = { alc260_fujitsu_mixer, |
| 5169 | alc260_capture_mixer }, |
| 5170 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5171 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5172 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5173 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5174 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5175 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5176 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5177 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5178 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5179 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5180 | [ALC260_ACER] = { |
| 5181 | .mixers = { alc260_acer_mixer, |
| 5182 | alc260_capture_mixer }, |
| 5183 | .init_verbs = { alc260_acer_init_verbs }, |
| 5184 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5185 | .dac_nids = alc260_dac_nids, |
| 5186 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5187 | .adc_nids = alc260_dual_adc_nids, |
| 5188 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5189 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5190 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5191 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5192 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5193 | [ALC260_WILL] = { |
| 5194 | .mixers = { alc260_will_mixer, |
| 5195 | alc260_capture_mixer }, |
| 5196 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5197 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5198 | .dac_nids = alc260_dac_nids, |
| 5199 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5200 | .adc_nids = alc260_adc_nids, |
| 5201 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5202 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5203 | .channel_mode = alc260_modes, |
| 5204 | .input_mux = &alc260_capture_source, |
| 5205 | }, |
| 5206 | [ALC260_REPLACER_672V] = { |
| 5207 | .mixers = { alc260_replacer_672v_mixer, |
| 5208 | alc260_capture_mixer }, |
| 5209 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5210 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5211 | .dac_nids = alc260_dac_nids, |
| 5212 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5213 | .adc_nids = alc260_adc_nids, |
| 5214 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5215 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5216 | .channel_mode = alc260_modes, |
| 5217 | .input_mux = &alc260_capture_source, |
| 5218 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5219 | .init_hook = alc260_replacer_672v_automute, |
| 5220 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5221 | #ifdef CONFIG_SND_DEBUG |
| 5222 | [ALC260_TEST] = { |
| 5223 | .mixers = { alc260_test_mixer, |
| 5224 | alc260_capture_mixer }, |
| 5225 | .init_verbs = { alc260_test_init_verbs }, |
| 5226 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5227 | .dac_nids = alc260_test_dac_nids, |
| 5228 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5229 | .adc_nids = alc260_test_adc_nids, |
| 5230 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5231 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5232 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5233 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5234 | }, |
| 5235 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5236 | }; |
| 5237 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5238 | static int patch_alc260(struct hda_codec *codec) |
| 5239 | { |
| 5240 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5241 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5242 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5243 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5244 | if (spec == NULL) |
| 5245 | return -ENOMEM; |
| 5246 | |
| 5247 | codec->spec = spec; |
| 5248 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5249 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5250 | alc260_models, |
| 5251 | alc260_cfg_tbl); |
| 5252 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5253 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5254 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5255 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5256 | } |
| 5257 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5258 | if (board_config == ALC260_AUTO) { |
| 5259 | /* automatic parse from the BIOS config */ |
| 5260 | err = alc260_parse_auto_config(codec); |
| 5261 | if (err < 0) { |
| 5262 | alc_free(codec); |
| 5263 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5264 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5265 | printk(KERN_INFO |
| 5266 | "hda_codec: Cannot set up configuration " |
| 5267 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5268 | board_config = ALC260_BASIC; |
| 5269 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5270 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5271 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5272 | if (board_config != ALC260_AUTO) |
| 5273 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5274 | |
| 5275 | spec->stream_name_analog = "ALC260 Analog"; |
| 5276 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5277 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5278 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5279 | spec->stream_name_digital = "ALC260 Digital"; |
| 5280 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5281 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5282 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5283 | spec->vmaster_nid = 0x08; |
| 5284 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5285 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5286 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5287 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5288 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5289 | if (!spec->loopback.amplist) |
| 5290 | spec->loopback.amplist = alc260_loopbacks; |
| 5291 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5292 | |
| 5293 | return 0; |
| 5294 | } |
| 5295 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5296 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5297 | /* |
| 5298 | * ALC882 support |
| 5299 | * |
| 5300 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5301 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5302 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5303 | * 6-channel independent captures. |
| 5304 | * |
| 5305 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5306 | * driver yet). |
| 5307 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5308 | #define ALC882_DIGOUT_NID 0x06 |
| 5309 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5310 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5311 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5312 | { 8, NULL } |
| 5313 | }; |
| 5314 | |
| 5315 | static hda_nid_t alc882_dac_nids[4] = { |
| 5316 | /* front, rear, clfe, rear_surr */ |
| 5317 | 0x02, 0x03, 0x04, 0x05 |
| 5318 | }; |
| 5319 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5320 | /* identical with ALC880 */ |
| 5321 | #define alc882_adc_nids alc880_adc_nids |
| 5322 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5323 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5324 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5325 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5326 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5327 | /* input MUX */ |
| 5328 | /* FIXME: should be a matrix-type input source selection */ |
| 5329 | |
| 5330 | static struct hda_input_mux alc882_capture_source = { |
| 5331 | .num_items = 4, |
| 5332 | .items = { |
| 5333 | { "Mic", 0x0 }, |
| 5334 | { "Front Mic", 0x1 }, |
| 5335 | { "Line", 0x2 }, |
| 5336 | { "CD", 0x4 }, |
| 5337 | }, |
| 5338 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5339 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5340 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5341 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5342 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5343 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5344 | { |
| 5345 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5346 | struct alc_spec *spec = codec->spec; |
| 5347 | const struct hda_input_mux *imux = spec->input_mux; |
| 5348 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5349 | hda_nid_t nid = spec->capsrc_nids ? |
| 5350 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5351 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5352 | unsigned int i, idx; |
| 5353 | |
| 5354 | idx = ucontrol->value.enumerated.item[0]; |
| 5355 | if (idx >= imux->num_items) |
| 5356 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5357 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5358 | return 0; |
| 5359 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5360 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5361 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5362 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5363 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5364 | } |
| 5365 | *cur_val = idx; |
| 5366 | return 1; |
| 5367 | } |
| 5368 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5369 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5370 | * 2ch mode |
| 5371 | */ |
| 5372 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5373 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5374 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5375 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5376 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5377 | { } /* end */ |
| 5378 | }; |
| 5379 | |
| 5380 | /* |
| 5381 | * 6ch mode |
| 5382 | */ |
| 5383 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5384 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5385 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5386 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5387 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5388 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5389 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5390 | { } /* end */ |
| 5391 | }; |
| 5392 | |
| 5393 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5394 | { 2, alc882_3ST_ch2_init }, |
| 5395 | { 6, alc882_3ST_ch6_init }, |
| 5396 | }; |
| 5397 | |
| 5398 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5399 | * 6ch mode |
| 5400 | */ |
| 5401 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5402 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5403 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5404 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5405 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5406 | { } /* end */ |
| 5407 | }; |
| 5408 | |
| 5409 | /* |
| 5410 | * 8ch mode |
| 5411 | */ |
| 5412 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5413 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5414 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5415 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5416 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5417 | { } /* end */ |
| 5418 | }; |
| 5419 | |
| 5420 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5421 | { 6, alc882_sixstack_ch6_init }, |
| 5422 | { 8, alc882_sixstack_ch8_init }, |
| 5423 | }; |
| 5424 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5425 | /* |
| 5426 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5427 | */ |
| 5428 | |
| 5429 | /* |
| 5430 | * 2ch mode |
| 5431 | */ |
| 5432 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5433 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5434 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5435 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5436 | { } /* end */ |
| 5437 | }; |
| 5438 | |
| 5439 | /* |
| 5440 | * 6ch mode |
| 5441 | */ |
| 5442 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5443 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5444 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5445 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5446 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5447 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5448 | { } /* end */ |
| 5449 | }; |
| 5450 | |
| 5451 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5452 | { 2, alc885_mbp_ch2_init }, |
| 5453 | { 6, alc885_mbp_ch6_init }, |
| 5454 | }; |
| 5455 | |
| 5456 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5457 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5458 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5459 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5460 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5461 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5462 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5463 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5464 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5465 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5466 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5467 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5468 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5469 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5470 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5471 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5472 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5473 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5474 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5475 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5476 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5477 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5478 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5479 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5480 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5481 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5482 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5483 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5484 | { } /* end */ |
| 5485 | }; |
| 5486 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5487 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5488 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5489 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5490 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5491 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5492 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5493 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5494 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5495 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5496 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5497 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5498 | { } /* end */ |
| 5499 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5500 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5501 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5502 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5503 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5504 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5505 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5506 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5507 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5508 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5509 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5510 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5511 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5512 | { } /* end */ |
| 5513 | }; |
| 5514 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5515 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5516 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5517 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5518 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5519 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5520 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5521 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5522 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5523 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5524 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5525 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5526 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5527 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5528 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5529 | { } /* end */ |
| 5530 | }; |
| 5531 | |
| 5532 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5533 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5534 | */ |
| 5535 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5536 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5537 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5538 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5539 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5540 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5541 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5542 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5543 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5544 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5545 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5546 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5547 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5548 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5549 | { } /* end */ |
| 5550 | }; |
| 5551 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5552 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5553 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5554 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5555 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5556 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5557 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5558 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5559 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5560 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5561 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5562 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5563 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5564 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5565 | { } /* end */ |
| 5566 | }; |
| 5567 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5568 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5569 | { |
| 5570 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5571 | .name = "Channel Mode", |
| 5572 | .info = alc_ch_mode_info, |
| 5573 | .get = alc_ch_mode_get, |
| 5574 | .put = alc_ch_mode_put, |
| 5575 | }, |
| 5576 | { } /* end */ |
| 5577 | }; |
| 5578 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5579 | static struct hda_verb alc882_init_verbs[] = { |
| 5580 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5581 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5582 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5583 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5584 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5585 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5586 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5587 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5588 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5589 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5592 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5593 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5595 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5596 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5597 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5598 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5599 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5600 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5601 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5602 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5603 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5604 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5605 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5606 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5607 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5608 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5609 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5610 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5611 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5612 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5613 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5614 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5615 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5616 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5617 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5618 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5619 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5620 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5621 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5622 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5623 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5624 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5625 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5626 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5627 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5628 | |
| 5629 | /* FIXME: use matrix-type input source selection */ |
| 5630 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5631 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5632 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5633 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5634 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5635 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5636 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5637 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5638 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5639 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5640 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5641 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5642 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5643 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5644 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5645 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5646 | /* ADC1: mute amp left and right */ |
| 5647 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5648 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5649 | /* ADC2: mute amp left and right */ |
| 5650 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5651 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5652 | /* ADC3: mute amp left and right */ |
| 5653 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5654 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5655 | |
| 5656 | { } |
| 5657 | }; |
| 5658 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5659 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5660 | /* change to EAPD mode */ |
| 5661 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5662 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5663 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5664 | }; |
| 5665 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5666 | /* Mac Pro test */ |
| 5667 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5668 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5669 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5670 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5671 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5672 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5673 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5674 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5675 | { } /* end */ |
| 5676 | }; |
| 5677 | |
| 5678 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5679 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5680 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5681 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5682 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5683 | /* Front Pin: output 0 (0x0c) */ |
| 5684 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5685 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5686 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5687 | /* Front Mic pin: input vref at 80% */ |
| 5688 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5689 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5690 | /* Speaker: output */ |
| 5691 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5692 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5693 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5694 | /* Headphone output (output 0 - 0x0c) */ |
| 5695 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5696 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5697 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5698 | |
| 5699 | /* FIXME: use matrix-type input source selection */ |
| 5700 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5701 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5703 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5704 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5705 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5706 | /* Input mixer2 */ |
| 5707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5708 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5709 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5710 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5711 | /* Input mixer3 */ |
| 5712 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5713 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5714 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5715 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5716 | /* ADC1: mute amp left and right */ |
| 5717 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5718 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5719 | /* ADC2: mute amp left and right */ |
| 5720 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5721 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5722 | /* ADC3: mute amp left and right */ |
| 5723 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5724 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5725 | |
| 5726 | { } |
| 5727 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5728 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5729 | /* Macbook Pro rev3 */ |
| 5730 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5731 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5732 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5733 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5734 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5735 | /* Rear mixer */ |
| 5736 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5737 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5738 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5739 | /* Front Pin: output 0 (0x0c) */ |
| 5740 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5741 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5742 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5743 | /* HP Pin: output 0 (0x0d) */ |
| 5744 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5746 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5747 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5748 | /* Mic (rear) pin: input vref at 80% */ |
| 5749 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5750 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5751 | /* Front Mic pin: input vref at 80% */ |
| 5752 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5753 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5754 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5755 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5756 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5757 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5758 | |
| 5759 | /* FIXME: use matrix-type input source selection */ |
| 5760 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5761 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5762 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5763 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5764 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5765 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5766 | /* Input mixer2 */ |
| 5767 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5768 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5769 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5770 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5771 | /* Input mixer3 */ |
| 5772 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5773 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5774 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5775 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5776 | /* ADC1: mute amp left and right */ |
| 5777 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5778 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5779 | /* ADC2: mute amp left and right */ |
| 5780 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5781 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5782 | /* ADC3: mute amp left and right */ |
| 5783 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5784 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5785 | |
| 5786 | { } |
| 5787 | }; |
| 5788 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5789 | /* iMac 24 mixer. */ |
| 5790 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5791 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5792 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5793 | { } /* end */ |
| 5794 | }; |
| 5795 | |
| 5796 | /* iMac 24 init verbs. */ |
| 5797 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5798 | /* Internal speakers: output 0 (0x0c) */ |
| 5799 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5800 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5801 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5802 | /* Internal speakers: output 0 (0x0c) */ |
| 5803 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5804 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5805 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5806 | /* Headphone: output 0 (0x0c) */ |
| 5807 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5808 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5809 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5810 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5811 | /* Front Mic: input vref at 80% */ |
| 5812 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5813 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5814 | { } |
| 5815 | }; |
| 5816 | |
| 5817 | /* Toggle speaker-output according to the hp-jack state */ |
| 5818 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5819 | { |
| 5820 | unsigned int present; |
| 5821 | |
| 5822 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5823 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5824 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5825 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5826 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5827 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5828 | } |
| 5829 | |
| 5830 | /* Processes unsolicited events. */ |
| 5831 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5832 | unsigned int res) |
| 5833 | { |
| 5834 | /* Headphone insertion or removal. */ |
| 5835 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5836 | alc885_imac24_automute(codec); |
| 5837 | } |
| 5838 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5839 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5840 | { |
| 5841 | unsigned int present; |
| 5842 | |
| 5843 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5845 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5846 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5847 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5848 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5849 | |
| 5850 | } |
| 5851 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5852 | unsigned int res) |
| 5853 | { |
| 5854 | /* Headphone insertion or removal. */ |
| 5855 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5856 | alc885_mbp3_automute(codec); |
| 5857 | } |
| 5858 | |
| 5859 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5860 | static struct hda_verb alc882_targa_verbs[] = { |
| 5861 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5862 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5863 | |
| 5864 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5865 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5866 | |
| 5867 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5868 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5869 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5870 | |
| 5871 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5872 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5873 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5874 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5875 | { } /* end */ |
| 5876 | }; |
| 5877 | |
| 5878 | /* toggle speaker-output according to the hp-jack state */ |
| 5879 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5880 | { |
| 5881 | unsigned int present; |
| 5882 | |
| 5883 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5885 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5886 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5887 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5888 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5889 | } |
| 5890 | |
| 5891 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5892 | { |
| 5893 | /* Looks like the unsol event is incompatible with the standard |
| 5894 | * definition. 4bit tag is placed at 26 bit! |
| 5895 | */ |
| 5896 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5897 | alc882_targa_automute(codec); |
| 5898 | } |
| 5899 | } |
| 5900 | |
| 5901 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5902 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5903 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5904 | |
| 5905 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5906 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5907 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5908 | |
| 5909 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5910 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5911 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5912 | |
| 5913 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5914 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5915 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5916 | { } /* end */ |
| 5917 | }; |
| 5918 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5919 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5921 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5922 | |
| 5923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5924 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5925 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5926 | |
| 5927 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5928 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5929 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5930 | |
| 5931 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5932 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5933 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5934 | { } /* end */ |
| 5935 | }; |
| 5936 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5937 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5938 | { |
| 5939 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5940 | |
| 5941 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5942 | AC_VERB_GET_GPIO_DATA, 0); |
| 5943 | |
| 5944 | if (!muted) |
| 5945 | gpiostate |= (1 << pin); |
| 5946 | else |
| 5947 | gpiostate &= ~(1 << pin); |
| 5948 | |
| 5949 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5950 | AC_VERB_GET_GPIO_MASK, 0); |
| 5951 | gpiomask |= (1 << pin); |
| 5952 | |
| 5953 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5954 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5955 | gpiodir |= (1 << pin); |
| 5956 | |
| 5957 | |
| 5958 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5959 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5960 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5961 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5962 | |
| 5963 | msleep(1); |
| 5964 | |
| 5965 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5966 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5967 | } |
| 5968 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5969 | /* set up GPIO at initialization */ |
| 5970 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5971 | { |
| 5972 | alc882_gpio_mute(codec, 0, 0); |
| 5973 | alc882_gpio_mute(codec, 1, 0); |
| 5974 | } |
| 5975 | |
| 5976 | /* set up GPIO and update auto-muting at initialization */ |
| 5977 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5978 | { |
| 5979 | alc885_macpro_init_hook(codec); |
| 5980 | alc885_imac24_automute(codec); |
| 5981 | } |
| 5982 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5983 | /* |
| 5984 | * generic initialization of ADC, input mixers and output mixers |
| 5985 | */ |
| 5986 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5987 | /* |
| 5988 | * Unmute ADC0-2 and set the default input to mic-in |
| 5989 | */ |
| 5990 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5991 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5992 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5993 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5994 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5995 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5996 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5997 | /* 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] | 5998 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5999 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 6000 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6001 | */ |
| 6002 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6003 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6004 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6005 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6006 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6007 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6008 | |
| 6009 | /* |
| 6010 | * Set up output mixers (0x0c - 0x0f) |
| 6011 | */ |
| 6012 | /* set vol=0 to output mixers */ |
| 6013 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6014 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6015 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6016 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6017 | /* set up input amps for analog loopback */ |
| 6018 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 6019 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6020 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6021 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6022 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6023 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6024 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6025 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6026 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6027 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6028 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6029 | |
| 6030 | /* FIXME: use matrix-type input source selection */ |
| 6031 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6032 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 6033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6034 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6035 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6036 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6037 | /* Input mixer2 */ |
| 6038 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6039 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6040 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6041 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6042 | /* Input mixer3 */ |
| 6043 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 6044 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 6045 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 6046 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 6047 | |
| 6048 | { } |
| 6049 | }; |
| 6050 | |
| 6051 | /* capture mixer elements */ |
| 6052 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 6053 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6054 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6055 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6056 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6057 | { |
| 6058 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6059 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6060 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6061 | */ |
| 6062 | /* .name = "Capture Source", */ |
| 6063 | .name = "Input Source", |
| 6064 | .count = 2, |
| 6065 | .info = alc882_mux_enum_info, |
| 6066 | .get = alc882_mux_enum_get, |
| 6067 | .put = alc882_mux_enum_put, |
| 6068 | }, |
| 6069 | { } /* end */ |
| 6070 | }; |
| 6071 | |
| 6072 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 6073 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 6074 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 6075 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 6076 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 6077 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 6078 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 6079 | { |
| 6080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6081 | /* The multiple "Capture Source" controls confuse alsamixer |
| 6082 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6083 | */ |
| 6084 | /* .name = "Capture Source", */ |
| 6085 | .name = "Input Source", |
| 6086 | .count = 3, |
| 6087 | .info = alc882_mux_enum_info, |
| 6088 | .get = alc882_mux_enum_get, |
| 6089 | .put = alc882_mux_enum_put, |
| 6090 | }, |
| 6091 | { } /* end */ |
| 6092 | }; |
| 6093 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6094 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6095 | #define alc882_loopbacks alc880_loopbacks |
| 6096 | #endif |
| 6097 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6098 | /* pcm configuration: identiacal with ALC880 */ |
| 6099 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6100 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6101 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6102 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6103 | |
| 6104 | /* |
| 6105 | * configuration and preset |
| 6106 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6107 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6108 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6109 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6110 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6111 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6112 | [ALC882_TARGA] = "targa", |
| 6113 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6114 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6115 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6116 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6117 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6118 | [ALC882_AUTO] = "auto", |
| 6119 | }; |
| 6120 | |
| 6121 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6122 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6123 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6124 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6125 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6126 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6127 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6128 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6129 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6130 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6131 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6132 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6133 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6134 | {} |
| 6135 | }; |
| 6136 | |
| 6137 | static struct alc_config_preset alc882_presets[] = { |
| 6138 | [ALC882_3ST_DIG] = { |
| 6139 | .mixers = { alc882_base_mixer }, |
| 6140 | .init_verbs = { alc882_init_verbs }, |
| 6141 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6142 | .dac_nids = alc882_dac_nids, |
| 6143 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6144 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6145 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6146 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6147 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6148 | .input_mux = &alc882_capture_source, |
| 6149 | }, |
| 6150 | [ALC882_6ST_DIG] = { |
| 6151 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6152 | .init_verbs = { alc882_init_verbs }, |
| 6153 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6154 | .dac_nids = alc882_dac_nids, |
| 6155 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6156 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6157 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6158 | .channel_mode = alc882_sixstack_modes, |
| 6159 | .input_mux = &alc882_capture_source, |
| 6160 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6161 | [ALC882_ARIMA] = { |
| 6162 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6163 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6164 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6165 | .dac_nids = alc882_dac_nids, |
| 6166 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6167 | .channel_mode = alc882_sixstack_modes, |
| 6168 | .input_mux = &alc882_capture_source, |
| 6169 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6170 | [ALC882_W2JC] = { |
| 6171 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6172 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6173 | alc880_gpio1_init_verbs }, |
| 6174 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6175 | .dac_nids = alc882_dac_nids, |
| 6176 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6177 | .channel_mode = alc880_threestack_modes, |
| 6178 | .need_dac_fix = 1, |
| 6179 | .input_mux = &alc882_capture_source, |
| 6180 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6181 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6182 | [ALC885_MBP3] = { |
| 6183 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6184 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6185 | alc880_gpio1_init_verbs }, |
| 6186 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6187 | .dac_nids = alc882_dac_nids, |
| 6188 | .channel_mode = alc885_mbp_6ch_modes, |
| 6189 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6190 | .input_mux = &alc882_capture_source, |
| 6191 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6192 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6193 | .unsol_event = alc885_mbp3_unsol_event, |
| 6194 | .init_hook = alc885_mbp3_automute, |
| 6195 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6196 | [ALC885_MACPRO] = { |
| 6197 | .mixers = { alc882_macpro_mixer }, |
| 6198 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6199 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6200 | .dac_nids = alc882_dac_nids, |
| 6201 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6202 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6203 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6204 | .channel_mode = alc882_ch_modes, |
| 6205 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6206 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6207 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6208 | [ALC885_IMAC24] = { |
| 6209 | .mixers = { alc885_imac24_mixer }, |
| 6210 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6211 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6212 | .dac_nids = alc882_dac_nids, |
| 6213 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6214 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6215 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6216 | .channel_mode = alc882_ch_modes, |
| 6217 | .input_mux = &alc882_capture_source, |
| 6218 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6219 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6220 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6221 | [ALC882_TARGA] = { |
| 6222 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6223 | alc882_capture_mixer }, |
| 6224 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6225 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6226 | .dac_nids = alc882_dac_nids, |
| 6227 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6228 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6229 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6230 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6231 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6232 | .channel_mode = alc882_3ST_6ch_modes, |
| 6233 | .need_dac_fix = 1, |
| 6234 | .input_mux = &alc882_capture_source, |
| 6235 | .unsol_event = alc882_targa_unsol_event, |
| 6236 | .init_hook = alc882_targa_automute, |
| 6237 | }, |
| 6238 | [ALC882_ASUS_A7J] = { |
| 6239 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6240 | alc882_capture_mixer }, |
| 6241 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6242 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6243 | .dac_nids = alc882_dac_nids, |
| 6244 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6245 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6246 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6247 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6248 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6249 | .channel_mode = alc882_3ST_6ch_modes, |
| 6250 | .need_dac_fix = 1, |
| 6251 | .input_mux = &alc882_capture_source, |
| 6252 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6253 | [ALC882_ASUS_A7M] = { |
| 6254 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6255 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6256 | alc880_gpio1_init_verbs, |
| 6257 | alc882_asus_a7m_verbs }, |
| 6258 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6259 | .dac_nids = alc882_dac_nids, |
| 6260 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6261 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6262 | .channel_mode = alc880_threestack_modes, |
| 6263 | .need_dac_fix = 1, |
| 6264 | .input_mux = &alc882_capture_source, |
| 6265 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | }; |
| 6267 | |
| 6268 | |
| 6269 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6270 | * Pin config fixes |
| 6271 | */ |
| 6272 | enum { |
| 6273 | PINFIX_ABIT_AW9D_MAX |
| 6274 | }; |
| 6275 | |
| 6276 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6277 | { 0x15, 0x01080104 }, /* side */ |
| 6278 | { 0x16, 0x01011012 }, /* rear */ |
| 6279 | { 0x17, 0x01016011 }, /* clfe */ |
| 6280 | { } |
| 6281 | }; |
| 6282 | |
| 6283 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6284 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6285 | }; |
| 6286 | |
| 6287 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6288 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6289 | {} |
| 6290 | }; |
| 6291 | |
| 6292 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6293 | * BIOS auto configuration |
| 6294 | */ |
| 6295 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6296 | hda_nid_t nid, int pin_type, |
| 6297 | int dac_idx) |
| 6298 | { |
| 6299 | /* set as output */ |
| 6300 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6301 | int idx; |
| 6302 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6303 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6304 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6305 | idx = 4; |
| 6306 | else |
| 6307 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6308 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6309 | |
| 6310 | } |
| 6311 | |
| 6312 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6313 | { |
| 6314 | struct alc_spec *spec = codec->spec; |
| 6315 | int i; |
| 6316 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6317 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6318 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6319 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6320 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6321 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6322 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6323 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6324 | } |
| 6325 | } |
| 6326 | |
| 6327 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6328 | { |
| 6329 | struct alc_spec *spec = codec->spec; |
| 6330 | hda_nid_t pin; |
| 6331 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6332 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6333 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6334 | /* use dac 0 */ |
| 6335 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6336 | pin = spec->autocfg.speaker_pins[0]; |
| 6337 | if (pin) |
| 6338 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6339 | } |
| 6340 | |
| 6341 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6342 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6343 | |
| 6344 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6345 | { |
| 6346 | struct alc_spec *spec = codec->spec; |
| 6347 | int i; |
| 6348 | |
| 6349 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6350 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6351 | unsigned int vref; |
| 6352 | if (!nid) |
| 6353 | continue; |
| 6354 | vref = PIN_IN; |
| 6355 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { |
| 6356 | if (snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP) & |
| 6357 | AC_PINCAP_VREF_80) |
| 6358 | vref = PIN_VREF80; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6359 | } |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 6360 | snd_hda_codec_write(codec, nid, 0, |
| 6361 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); |
| 6362 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
| 6363 | snd_hda_codec_write(codec, nid, 0, |
| 6364 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 6365 | AMP_OUT_MUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6366 | } |
| 6367 | } |
| 6368 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6369 | /* add mic boosts if needed */ |
| 6370 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6371 | { |
| 6372 | struct alc_spec *spec = codec->spec; |
| 6373 | int err; |
| 6374 | hda_nid_t nid; |
| 6375 | |
| 6376 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6377 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6378 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6379 | "Mic Boost", |
| 6380 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6381 | if (err < 0) |
| 6382 | return err; |
| 6383 | } |
| 6384 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6385 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6386 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6387 | "Front Mic Boost", |
| 6388 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6389 | if (err < 0) |
| 6390 | return err; |
| 6391 | } |
| 6392 | return 0; |
| 6393 | } |
| 6394 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6395 | /* almost identical with ALC880 parser... */ |
| 6396 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6397 | { |
| 6398 | struct alc_spec *spec = codec->spec; |
| 6399 | int err = alc880_parse_auto_config(codec); |
| 6400 | |
| 6401 | if (err < 0) |
| 6402 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6403 | else if (!err) |
| 6404 | return 0; /* no config found */ |
| 6405 | |
| 6406 | err = alc_auto_add_mic_boost(codec); |
| 6407 | if (err < 0) |
| 6408 | return err; |
| 6409 | |
| 6410 | /* hack - override the init verbs */ |
| 6411 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6412 | |
| 6413 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6414 | } |
| 6415 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6416 | /* additional initialization for auto-configuration model */ |
| 6417 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6418 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6419 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6420 | alc882_auto_init_multi_out(codec); |
| 6421 | alc882_auto_init_hp_out(codec); |
| 6422 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6423 | if (spec->unsol_event) |
| 6424 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6425 | } |
| 6426 | |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6427 | static int patch_alc883(struct hda_codec *codec); /* called in patch_alc882() */ |
| 6428 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6429 | static int patch_alc882(struct hda_codec *codec) |
| 6430 | { |
| 6431 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6432 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6433 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6434 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6435 | if (spec == NULL) |
| 6436 | return -ENOMEM; |
| 6437 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6438 | codec->spec = spec; |
| 6439 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6440 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6441 | alc882_models, |
| 6442 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6443 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6444 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6445 | /* Pick up systems that don't supply PCI SSID */ |
| 6446 | switch (codec->subsystem_id) { |
| 6447 | case 0x106b0c00: /* Mac Pro */ |
| 6448 | board_config = ALC885_MACPRO; |
| 6449 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6450 | case 0x106b1000: /* iMac 24 */ |
| 6451 | board_config = ALC885_IMAC24; |
| 6452 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6453 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6454 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6455 | board_config = ALC885_MBP3; |
| 6456 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6457 | default: |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 6458 | /* ALC889A is handled better as ALC888-compatible */ |
| 6459 | if (codec->revision_id == 0x100103) { |
| 6460 | alc_free(codec); |
| 6461 | return patch_alc883(codec); |
| 6462 | } |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6463 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6464 | "trying auto-probe from BIOS...\n"); |
| 6465 | board_config = ALC882_AUTO; |
| 6466 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6467 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6468 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6469 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6470 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6471 | if (board_config == ALC882_AUTO) { |
| 6472 | /* automatic parse from the BIOS config */ |
| 6473 | err = alc882_parse_auto_config(codec); |
| 6474 | if (err < 0) { |
| 6475 | alc_free(codec); |
| 6476 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6477 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6478 | printk(KERN_INFO |
| 6479 | "hda_codec: Cannot set up configuration " |
| 6480 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6481 | board_config = ALC882_3ST_DIG; |
| 6482 | } |
| 6483 | } |
| 6484 | |
| 6485 | if (board_config != ALC882_AUTO) |
| 6486 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6487 | |
| 6488 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6489 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6490 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6491 | /* FIXME: setup DAC5 */ |
| 6492 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6493 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6494 | |
| 6495 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6496 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6497 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6498 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6499 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6500 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6501 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6502 | /* get type */ |
| 6503 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6504 | if (wcap != AC_WID_AUD_IN) { |
| 6505 | spec->adc_nids = alc882_adc_nids_alt; |
| 6506 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6507 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6508 | spec->mixers[spec->num_mixers] = |
| 6509 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6510 | spec->num_mixers++; |
| 6511 | } else { |
| 6512 | spec->adc_nids = alc882_adc_nids; |
| 6513 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6514 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6515 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6516 | spec->num_mixers++; |
| 6517 | } |
| 6518 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6519 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6520 | spec->vmaster_nid = 0x0c; |
| 6521 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6522 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6523 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6524 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6525 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6526 | if (!spec->loopback.amplist) |
| 6527 | spec->loopback.amplist = alc882_loopbacks; |
| 6528 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6529 | |
| 6530 | return 0; |
| 6531 | } |
| 6532 | |
| 6533 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6534 | * ALC883 support |
| 6535 | * |
| 6536 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6537 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6538 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6539 | * 6-channel independent captures. |
| 6540 | * |
| 6541 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6542 | * driver yet). |
| 6543 | */ |
| 6544 | #define ALC883_DIGOUT_NID 0x06 |
| 6545 | #define ALC883_DIGIN_NID 0x0a |
| 6546 | |
| 6547 | static hda_nid_t alc883_dac_nids[4] = { |
| 6548 | /* front, rear, clfe, rear_surr */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 6549 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6550 | }; |
| 6551 | |
| 6552 | static hda_nid_t alc883_adc_nids[2] = { |
| 6553 | /* ADC1-2 */ |
| 6554 | 0x08, 0x09, |
| 6555 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6556 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6557 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6558 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6559 | /* input MUX */ |
| 6560 | /* FIXME: should be a matrix-type input source selection */ |
| 6561 | |
| 6562 | static struct hda_input_mux alc883_capture_source = { |
| 6563 | .num_items = 4, |
| 6564 | .items = { |
| 6565 | { "Mic", 0x0 }, |
| 6566 | { "Front Mic", 0x1 }, |
| 6567 | { "Line", 0x2 }, |
| 6568 | { "CD", 0x4 }, |
| 6569 | }, |
| 6570 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6571 | |
| 6572 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6573 | .num_items = 2, |
| 6574 | .items = { |
| 6575 | { "Mic", 0x1 }, |
| 6576 | { "Line", 0x2 }, |
| 6577 | }, |
| 6578 | }; |
| 6579 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6580 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6581 | .num_items = 4, |
| 6582 | .items = { |
| 6583 | { "Mic", 0x0 }, |
| 6584 | { "iMic", 0x1 }, |
| 6585 | { "Line", 0x2 }, |
| 6586 | { "CD", 0x4 }, |
| 6587 | }, |
| 6588 | }; |
| 6589 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6590 | static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { |
| 6591 | .num_items = 2, |
| 6592 | .items = { |
| 6593 | { "Mic", 0x0 }, |
| 6594 | { "Int Mic", 0x1 }, |
| 6595 | }, |
| 6596 | }; |
| 6597 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6598 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6599 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6600 | /* ALC883 has the ALC882-type input selection */ |
| 6601 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6602 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6603 | /* |
| 6604 | * 2ch mode |
| 6605 | */ |
| 6606 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6607 | { 2, NULL } |
| 6608 | }; |
| 6609 | |
| 6610 | /* |
| 6611 | * 2ch mode |
| 6612 | */ |
| 6613 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6614 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6615 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6616 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6617 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6618 | { } /* end */ |
| 6619 | }; |
| 6620 | |
| 6621 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6622 | * 4ch mode |
| 6623 | */ |
| 6624 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6625 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6626 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6627 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6628 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6629 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6630 | { } /* end */ |
| 6631 | }; |
| 6632 | |
| 6633 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6634 | * 6ch mode |
| 6635 | */ |
| 6636 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6637 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6638 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6639 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6640 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6641 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6642 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6643 | { } /* end */ |
| 6644 | }; |
| 6645 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6646 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6647 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6648 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6649 | { 6, alc883_3ST_ch6_init }, |
| 6650 | }; |
| 6651 | |
| 6652 | /* |
| 6653 | * 6ch mode |
| 6654 | */ |
| 6655 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6656 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6657 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6658 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6659 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6660 | { } /* end */ |
| 6661 | }; |
| 6662 | |
| 6663 | /* |
| 6664 | * 8ch mode |
| 6665 | */ |
| 6666 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6667 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6668 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6669 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6670 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6671 | { } /* end */ |
| 6672 | }; |
| 6673 | |
| 6674 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6675 | { 6, alc883_sixstack_ch6_init }, |
| 6676 | { 8, alc883_sixstack_ch8_init }, |
| 6677 | }; |
| 6678 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6679 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6680 | /* eanable EAPD on medion laptop */ |
| 6681 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6682 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6683 | { } |
| 6684 | }; |
| 6685 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6686 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6687 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6688 | */ |
| 6689 | |
| 6690 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6691 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6692 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6694 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6695 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6696 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6697 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6698 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6700 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6701 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6702 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6703 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6704 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6705 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6707 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6709 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6710 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6711 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6712 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6713 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6714 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6715 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6716 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6717 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6718 | { |
| 6719 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6720 | /* .name = "Capture Source", */ |
| 6721 | .name = "Input Source", |
| 6722 | .count = 2, |
| 6723 | .info = alc883_mux_enum_info, |
| 6724 | .get = alc883_mux_enum_get, |
| 6725 | .put = alc883_mux_enum_put, |
| 6726 | }, |
| 6727 | { } /* end */ |
| 6728 | }; |
| 6729 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6730 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6731 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6732 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6733 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6734 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6735 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6736 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6737 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6738 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6739 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6740 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6741 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6742 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6743 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6744 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6745 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6746 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6747 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6748 | { |
| 6749 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6750 | /* .name = "Capture Source", */ |
| 6751 | .name = "Input Source", |
| 6752 | .count = 2, |
| 6753 | .info = alc883_mux_enum_info, |
| 6754 | .get = alc883_mux_enum_get, |
| 6755 | .put = alc883_mux_enum_put, |
| 6756 | }, |
| 6757 | { } /* end */ |
| 6758 | }; |
| 6759 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 6760 | static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 6761 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6762 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6763 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6764 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6765 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6767 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6768 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6769 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6770 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6772 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6773 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6774 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6775 | { |
| 6776 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6777 | /* .name = "Capture Source", */ |
| 6778 | .name = "Input Source", |
| 6779 | .count = 2, |
| 6780 | .info = alc883_mux_enum_info, |
| 6781 | .get = alc883_mux_enum_get, |
| 6782 | .put = alc883_mux_enum_put, |
| 6783 | }, |
| 6784 | { } /* end */ |
| 6785 | }; |
| 6786 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 6787 | static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = { |
| 6788 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6789 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6790 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6791 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6792 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6794 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6797 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6798 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6799 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6800 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6801 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6802 | { |
| 6803 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6804 | /* .name = "Capture Source", */ |
| 6805 | .name = "Input Source", |
| 6806 | .count = 2, |
| 6807 | .info = alc883_mux_enum_info, |
| 6808 | .get = alc883_mux_enum_get, |
| 6809 | .put = alc883_mux_enum_put, |
| 6810 | }, |
| 6811 | { } /* end */ |
| 6812 | }; |
| 6813 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6814 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6815 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6816 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6818 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6819 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6820 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6821 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6822 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6823 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6824 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6825 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6826 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6828 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6829 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6830 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6831 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6832 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6833 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6834 | { |
| 6835 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6836 | /* .name = "Capture Source", */ |
| 6837 | .name = "Input Source", |
| 6838 | .count = 2, |
| 6839 | .info = alc883_mux_enum_info, |
| 6840 | .get = alc883_mux_enum_get, |
| 6841 | .put = alc883_mux_enum_put, |
| 6842 | }, |
| 6843 | { } /* end */ |
| 6844 | }; |
| 6845 | |
| 6846 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6847 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6848 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6849 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6850 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6851 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6852 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6853 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6854 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6855 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6856 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6857 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6858 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6859 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6860 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6861 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6862 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6863 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6864 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6865 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6866 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6867 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6868 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6870 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6871 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6872 | { |
| 6873 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6874 | /* .name = "Capture Source", */ |
| 6875 | .name = "Input Source", |
| 6876 | .count = 2, |
| 6877 | .info = alc883_mux_enum_info, |
| 6878 | .get = alc883_mux_enum_get, |
| 6879 | .put = alc883_mux_enum_put, |
| 6880 | }, |
| 6881 | { } /* end */ |
| 6882 | }; |
| 6883 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6884 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6885 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6886 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6887 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6888 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6889 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6890 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6891 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6892 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6893 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6894 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6895 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6896 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6897 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6898 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6899 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6900 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6901 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6902 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6903 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6904 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6905 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6906 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6907 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6908 | |
| 6909 | { |
| 6910 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6911 | /* .name = "Capture Source", */ |
| 6912 | .name = "Input Source", |
| 6913 | .count = 1, |
| 6914 | .info = alc883_mux_enum_info, |
| 6915 | .get = alc883_mux_enum_get, |
| 6916 | .put = alc883_mux_enum_put, |
| 6917 | }, |
| 6918 | { } /* end */ |
| 6919 | }; |
| 6920 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6921 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6922 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6923 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6924 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6925 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6926 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6927 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6928 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6929 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6930 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6931 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6932 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6933 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6934 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6937 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6938 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6939 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6940 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6941 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6942 | { |
| 6943 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6944 | /* .name = "Capture Source", */ |
| 6945 | .name = "Input Source", |
| 6946 | .count = 2, |
| 6947 | .info = alc883_mux_enum_info, |
| 6948 | .get = alc883_mux_enum_get, |
| 6949 | .put = alc883_mux_enum_put, |
| 6950 | }, |
| 6951 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6952 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6953 | |
| 6954 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6956 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6957 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6958 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6959 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6961 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6962 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 6963 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6964 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 6965 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6966 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6967 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6968 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6969 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6970 | { |
| 6971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6972 | /* .name = "Capture Source", */ |
| 6973 | .name = "Input Source", |
| 6974 | .count = 2, |
| 6975 | .info = alc883_mux_enum_info, |
| 6976 | .get = alc883_mux_enum_get, |
| 6977 | .put = alc883_mux_enum_put, |
| 6978 | }, |
| 6979 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6980 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6981 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6982 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6984 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6985 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6986 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6989 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6990 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6991 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6992 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6993 | { |
| 6994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6995 | /* .name = "Capture Source", */ |
| 6996 | .name = "Input Source", |
| 6997 | .count = 1, |
| 6998 | .info = alc883_mux_enum_info, |
| 6999 | .get = alc883_mux_enum_get, |
| 7000 | .put = alc883_mux_enum_put, |
| 7001 | }, |
| 7002 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7003 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7004 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7005 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 7006 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7007 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 7008 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7009 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7013 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 7014 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 7015 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7016 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7017 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7018 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7019 | { |
| 7020 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7021 | /* .name = "Capture Source", */ |
| 7022 | .name = "Input Source", |
| 7023 | .count = 2, |
| 7024 | .info = alc883_mux_enum_info, |
| 7025 | .get = alc883_mux_enum_get, |
| 7026 | .put = alc883_mux_enum_put, |
| 7027 | }, |
| 7028 | { } /* end */ |
| 7029 | }; |
| 7030 | |
| 7031 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 7032 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7033 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7034 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7035 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7036 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7037 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7038 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 7039 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7040 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7041 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7042 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7043 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7044 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7045 | { |
| 7046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7047 | /* .name = "Capture Source", */ |
| 7048 | .name = "Input Source", |
| 7049 | .count = 2, |
| 7050 | .info = alc883_mux_enum_info, |
| 7051 | .get = alc883_mux_enum_get, |
| 7052 | .put = alc883_mux_enum_put, |
| 7053 | }, |
| 7054 | { } /* end */ |
| 7055 | }; |
| 7056 | |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7057 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7058 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7059 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7061 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7062 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7063 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7064 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7066 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7067 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7068 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7069 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7070 | { |
| 7071 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7072 | /* .name = "Capture Source", */ |
| 7073 | .name = "Input Source", |
| 7074 | .count = 2, |
| 7075 | .info = alc883_mux_enum_info, |
| 7076 | .get = alc883_mux_enum_get, |
| 7077 | .put = alc883_mux_enum_put, |
| 7078 | }, |
| 7079 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7080 | }; |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7081 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7082 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7083 | { |
| 7084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7085 | .name = "Channel Mode", |
| 7086 | .info = alc_ch_mode_info, |
| 7087 | .get = alc_ch_mode_get, |
| 7088 | .put = alc_ch_mode_put, |
| 7089 | }, |
| 7090 | { } /* end */ |
| 7091 | }; |
| 7092 | |
| 7093 | static struct hda_verb alc883_init_verbs[] = { |
| 7094 | /* ADC1: mute amp left and right */ |
| 7095 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7096 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7097 | /* ADC2: mute amp left and right */ |
| 7098 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7099 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7100 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7103 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7104 | /* Rear mixer */ |
| 7105 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7106 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7107 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7108 | /* CLFE mixer */ |
| 7109 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7110 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7111 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7112 | /* Side mixer */ |
| 7113 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7115 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7116 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7117 | /* mute analog input loopbacks */ |
| 7118 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7119 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7120 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7121 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7122 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7123 | |
| 7124 | /* Front Pin: output 0 (0x0c) */ |
| 7125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7127 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7128 | /* Rear Pin: output 1 (0x0d) */ |
| 7129 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7130 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7131 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7132 | /* CLFE Pin: output 2 (0x0e) */ |
| 7133 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7134 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7135 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7136 | /* Side Pin: output 3 (0x0f) */ |
| 7137 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7138 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7139 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7140 | /* Mic (rear) pin: input vref at 80% */ |
| 7141 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7142 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7143 | /* Front Mic pin: input vref at 80% */ |
| 7144 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7145 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7146 | /* Line In pin: input */ |
| 7147 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7148 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7149 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7150 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7151 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7152 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7153 | /* CD pin widget for input */ |
| 7154 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7155 | |
| 7156 | /* FIXME: use matrix-type input source selection */ |
| 7157 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7158 | /* Input mixer2 */ |
| 7159 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7161 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7162 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7163 | /* Input mixer3 */ |
| 7164 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7165 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7166 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7167 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7168 | { } |
| 7169 | }; |
| 7170 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7171 | /* toggle speaker-output according to the hp-jack state */ |
| 7172 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7173 | { |
| 7174 | unsigned int present; |
| 7175 | |
| 7176 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7177 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7178 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7179 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7180 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7181 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7182 | } |
| 7183 | |
| 7184 | /* auto-toggle front mic */ |
| 7185 | /* |
| 7186 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7187 | { |
| 7188 | unsigned int present; |
| 7189 | unsigned char bits; |
| 7190 | |
| 7191 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7192 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7193 | bits = present ? HDA_AMP_MUTE : 0; |
| 7194 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7195 | } |
| 7196 | */ |
| 7197 | |
| 7198 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7199 | { |
| 7200 | alc883_mitac_hp_automute(codec); |
| 7201 | /* alc883_mitac_mic_automute(codec); */ |
| 7202 | } |
| 7203 | |
| 7204 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7205 | unsigned int res) |
| 7206 | { |
| 7207 | switch (res >> 26) { |
| 7208 | case ALC880_HP_EVENT: |
| 7209 | alc883_mitac_hp_automute(codec); |
| 7210 | break; |
| 7211 | case ALC880_MIC_EVENT: |
| 7212 | /* alc883_mitac_mic_automute(codec); */ |
| 7213 | break; |
| 7214 | } |
| 7215 | } |
| 7216 | |
| 7217 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7218 | /* HP */ |
| 7219 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7221 | /* Subwoofer */ |
| 7222 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7223 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7224 | |
| 7225 | /* enable unsolicited event */ |
| 7226 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7227 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7228 | |
| 7229 | { } /* end */ |
| 7230 | }; |
| 7231 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7232 | static struct hda_verb alc883_clevo_m720_verbs[] = { |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7233 | /* HP */ |
| 7234 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7235 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7236 | /* Int speaker */ |
| 7237 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7238 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7239 | |
| 7240 | /* enable unsolicited event */ |
| 7241 | {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] | 7242 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7243 | |
| 7244 | { } /* end */ |
| 7245 | }; |
| 7246 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7247 | static struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = { |
| 7248 | /* HP */ |
| 7249 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7250 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7251 | /* Subwoofer */ |
| 7252 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7253 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7254 | |
| 7255 | /* enable unsolicited event */ |
| 7256 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7257 | |
| 7258 | { } /* end */ |
| 7259 | }; |
| 7260 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7261 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7264 | |
| 7265 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7266 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7267 | |
| 7268 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7269 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7270 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7271 | |
| 7272 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7273 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7274 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7275 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7276 | |
| 7277 | { } /* end */ |
| 7278 | }; |
| 7279 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7280 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7281 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7282 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7283 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7284 | { } /* end */ |
| 7285 | }; |
| 7286 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7287 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7288 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7289 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7290 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7292 | { } /* end */ |
| 7293 | }; |
| 7294 | |
| 7295 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7296 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7297 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7298 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7299 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7300 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7301 | { } /* end */ |
| 7302 | }; |
| 7303 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7304 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7305 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7306 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7307 | |
| 7308 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7309 | |
| 7310 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7311 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7312 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7313 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7314 | { } /* end */ |
| 7315 | }; |
| 7316 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7317 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7318 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
Herton Ronaldo Krzesinski | f32a19e | 2008-03-18 09:27:08 +0100 | [diff] [blame] | 7319 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7320 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7321 | { } |
| 7322 | }; |
| 7323 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7324 | static struct hda_verb alc888_6st_dell_verbs[] = { |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7325 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7326 | { } |
| 7327 | }; |
| 7328 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7329 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7330 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7331 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7332 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7333 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7334 | { } |
| 7335 | }; |
| 7336 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7337 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7338 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7339 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7340 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7341 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7342 | { } |
| 7343 | }; |
| 7344 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7345 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7346 | { 2, alc888_3st_hp_2ch_init }, |
| 7347 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7348 | }; |
| 7349 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7350 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7351 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7352 | { |
| 7353 | unsigned int present; |
| 7354 | |
| 7355 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7356 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7357 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7358 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7359 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7360 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7361 | } |
| 7362 | |
| 7363 | /* toggle RCA according to the front-jack state */ |
| 7364 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7365 | { |
| 7366 | unsigned int present; |
| 7367 | |
| 7368 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7369 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7370 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7371 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7372 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7373 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7374 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7375 | unsigned int res) |
| 7376 | { |
| 7377 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7378 | alc888_lenovo_ms7195_front_automute(codec); |
| 7379 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7380 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7381 | } |
| 7382 | |
| 7383 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7385 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7386 | |
| 7387 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7388 | |
| 7389 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7390 | { } /* end */ |
| 7391 | }; |
| 7392 | |
| 7393 | /* toggle speaker-output according to the hp-jack state */ |
| 7394 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7395 | { |
| 7396 | unsigned int present; |
| 7397 | |
| 7398 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7399 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7400 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7401 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7402 | } |
| 7403 | |
| 7404 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7405 | unsigned int res) |
| 7406 | { |
| 7407 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7408 | alc883_medion_md2_automute(codec); |
| 7409 | } |
| 7410 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7411 | /* toggle speaker-output according to the hp-jack state */ |
| 7412 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7413 | { |
| 7414 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7415 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7416 | |
| 7417 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7418 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7419 | bits = present ? HDA_AMP_MUTE : 0; |
| 7420 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7421 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7422 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7423 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7424 | } |
| 7425 | |
| 7426 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7427 | { |
| 7428 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7429 | alc883_tagra_automute(codec); |
| 7430 | } |
| 7431 | |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7432 | /* toggle speaker-output according to the hp-jack state */ |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7433 | static void alc883_clevo_m720_hp_automute(struct hda_codec *codec) |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7434 | { |
| 7435 | unsigned int present; |
| 7436 | unsigned char bits; |
| 7437 | |
| 7438 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7439 | & AC_PINSENSE_PRESENCE; |
| 7440 | bits = present ? HDA_AMP_MUTE : 0; |
| 7441 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7442 | HDA_AMP_MUTE, bits); |
| 7443 | } |
| 7444 | |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7445 | static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) |
| 7446 | { |
| 7447 | unsigned int present; |
| 7448 | |
| 7449 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7450 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7451 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 7452 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7453 | } |
| 7454 | |
| 7455 | static void alc883_clevo_m720_automute(struct hda_codec *codec) |
| 7456 | { |
| 7457 | alc883_clevo_m720_hp_automute(codec); |
| 7458 | alc883_clevo_m720_mic_automute(codec); |
| 7459 | } |
| 7460 | |
| 7461 | static void alc883_clevo_m720_unsol_event(struct hda_codec *codec, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7462 | unsigned int res) |
| 7463 | { |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7464 | switch (res >> 26) { |
| 7465 | case ALC880_HP_EVENT: |
| 7466 | alc883_clevo_m720_hp_automute(codec); |
| 7467 | break; |
| 7468 | case ALC880_MIC_EVENT: |
| 7469 | alc883_clevo_m720_mic_automute(codec); |
| 7470 | break; |
| 7471 | } |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7472 | } |
| 7473 | |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7474 | /* toggle speaker-output according to the hp-jack state */ |
| 7475 | static void alc883_2ch_fujitsu_pi2515_automute(struct hda_codec *codec) |
| 7476 | { |
| 7477 | unsigned int present; |
| 7478 | unsigned char bits; |
| 7479 | |
| 7480 | present = snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 7481 | & AC_PINSENSE_PRESENCE; |
| 7482 | bits = present ? HDA_AMP_MUTE : 0; |
| 7483 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7484 | HDA_AMP_MUTE, bits); |
| 7485 | } |
| 7486 | |
| 7487 | static void alc883_2ch_fujitsu_pi2515_unsol_event(struct hda_codec *codec, |
| 7488 | unsigned int res) |
| 7489 | { |
| 7490 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7491 | alc883_2ch_fujitsu_pi2515_automute(codec); |
| 7492 | } |
| 7493 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7494 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7495 | { |
| 7496 | unsigned int present; |
| 7497 | unsigned char bits; |
| 7498 | |
| 7499 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7500 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7501 | bits = present ? 0x80 : 0; |
| 7502 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7503 | 0x80, bits); |
| 7504 | } |
| 7505 | |
| 7506 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7507 | unsigned int res) |
| 7508 | { |
| 7509 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7510 | alc883_haier_w66_automute(codec); |
| 7511 | } |
| 7512 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7513 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7514 | { |
| 7515 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7516 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7517 | |
| 7518 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7519 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7520 | bits = present ? HDA_AMP_MUTE : 0; |
| 7521 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7522 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7523 | } |
| 7524 | |
| 7525 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7526 | { |
| 7527 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7528 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7529 | |
| 7530 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7531 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7532 | bits = present ? HDA_AMP_MUTE : 0; |
| 7533 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7534 | HDA_AMP_MUTE, bits); |
| 7535 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7536 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7537 | } |
| 7538 | |
| 7539 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7540 | unsigned int res) |
| 7541 | { |
| 7542 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7543 | alc883_lenovo_101e_all_automute(codec); |
| 7544 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7545 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7546 | } |
| 7547 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7548 | /* toggle speaker-output according to the hp-jack state */ |
| 7549 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7550 | { |
| 7551 | unsigned int present; |
| 7552 | |
| 7553 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7554 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7555 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7556 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7557 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7558 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7559 | } |
| 7560 | |
| 7561 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7562 | unsigned int res) |
| 7563 | { |
| 7564 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7565 | alc883_acer_aspire_automute(codec); |
| 7566 | } |
| 7567 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7568 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7569 | /* HP Pin: output 0 (0x0c) */ |
| 7570 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7571 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7572 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7573 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7574 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7575 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7576 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7577 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7578 | /* eanable EAPD on medion laptop */ |
| 7579 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7580 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7581 | /* enable unsolicited event */ |
| 7582 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7583 | { } |
| 7584 | }; |
| 7585 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7586 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7587 | { |
| 7588 | unsigned int present; |
| 7589 | |
| 7590 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7591 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7592 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7593 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7594 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7595 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7596 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7597 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7598 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7599 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7600 | } |
| 7601 | |
| 7602 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7603 | unsigned int res) |
| 7604 | { |
| 7605 | switch (res >> 26) { |
| 7606 | case ALC880_HP_EVENT: |
| 7607 | printk("hp_event\n"); |
| 7608 | alc888_6st_dell_front_automute(codec); |
| 7609 | break; |
| 7610 | } |
| 7611 | } |
| 7612 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7613 | /* |
| 7614 | * generic initialization of ADC, input mixers and output mixers |
| 7615 | */ |
| 7616 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7617 | /* |
| 7618 | * Unmute ADC0-2 and set the default input to mic-in |
| 7619 | */ |
| 7620 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7621 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7622 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7623 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7624 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7625 | /* 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] | 7626 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7627 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7628 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7629 | */ |
| 7630 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7631 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7632 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7633 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7634 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7635 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7636 | |
| 7637 | /* |
| 7638 | * Set up output mixers (0x0c - 0x0f) |
| 7639 | */ |
| 7640 | /* set vol=0 to output mixers */ |
| 7641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7642 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7643 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7644 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7645 | /* set up input amps for analog loopback */ |
| 7646 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7647 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7648 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7649 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7650 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7651 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7652 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7653 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7654 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7655 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7656 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7657 | |
| 7658 | /* FIXME: use matrix-type input source selection */ |
| 7659 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7660 | /* Input mixer1 */ |
| 7661 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7662 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7663 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7664 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7665 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7666 | /* Input mixer2 */ |
| 7667 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7668 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7669 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7670 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7671 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7672 | |
| 7673 | { } |
| 7674 | }; |
| 7675 | |
| 7676 | /* capture mixer elements */ |
| 7677 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7678 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7679 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7680 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7681 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7682 | { |
| 7683 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7684 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7685 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7686 | */ |
| 7687 | /* .name = "Capture Source", */ |
| 7688 | .name = "Input Source", |
| 7689 | .count = 2, |
| 7690 | .info = alc882_mux_enum_info, |
| 7691 | .get = alc882_mux_enum_get, |
| 7692 | .put = alc882_mux_enum_put, |
| 7693 | }, |
| 7694 | { } /* end */ |
| 7695 | }; |
| 7696 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7697 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7698 | #define alc883_loopbacks alc880_loopbacks |
| 7699 | #endif |
| 7700 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7701 | /* pcm configuration: identiacal with ALC880 */ |
| 7702 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7703 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7704 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7705 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7706 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7707 | |
| 7708 | /* |
| 7709 | * configuration and preset |
| 7710 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7711 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7712 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7713 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7714 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7715 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7716 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7717 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7718 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7719 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7720 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7721 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7722 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7723 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7724 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7725 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7726 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7727 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7728 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7729 | [ALC883_MITAC] = "mitac", |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7730 | [ALC883_CLEVO_M720] = "clevo-m720", |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7731 | [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7732 | [ALC883_AUTO] = "auto", |
| 7733 | }; |
| 7734 | |
| 7735 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7736 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7737 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7738 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7739 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7740 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7741 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7742 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7743 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7744 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
Herton Ronaldo Krzesinski | 5d85f8d | 2008-03-20 12:13:46 +0100 | [diff] [blame] | 7745 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7746 | 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] | 7747 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7748 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7749 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7750 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7751 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7752 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7753 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7754 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7755 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
Jiang zhe | 4383fae | 2008-04-14 12:58:57 +0200 | [diff] [blame] | 7756 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7757 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
Pascal Terjan | 8280823 | 2008-03-04 11:33:28 +0100 | [diff] [blame] | 7758 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7759 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7760 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7761 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7762 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7763 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7764 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7765 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7766 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7767 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7768 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7769 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7770 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 86d34b7 | 2008-03-18 09:27:59 +0100 | [diff] [blame] | 7771 | SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7772 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7773 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7774 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7775 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7776 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
| 7777 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7778 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7779 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7780 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 7781 | SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7782 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7783 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7784 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7785 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7786 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7787 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7788 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7789 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7790 | {} |
| 7791 | }; |
| 7792 | |
| 7793 | static struct alc_config_preset alc883_presets[] = { |
| 7794 | [ALC883_3ST_2ch_DIG] = { |
| 7795 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7796 | .init_verbs = { alc883_init_verbs }, |
| 7797 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7798 | .dac_nids = alc883_dac_nids, |
| 7799 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7800 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7801 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7802 | .channel_mode = alc883_3ST_2ch_modes, |
| 7803 | .input_mux = &alc883_capture_source, |
| 7804 | }, |
| 7805 | [ALC883_3ST_6ch_DIG] = { |
| 7806 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7807 | .init_verbs = { alc883_init_verbs }, |
| 7808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7809 | .dac_nids = alc883_dac_nids, |
| 7810 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7811 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7812 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7813 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7814 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7815 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7816 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7817 | [ALC883_3ST_6ch] = { |
| 7818 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7819 | .init_verbs = { alc883_init_verbs }, |
| 7820 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7821 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7822 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7823 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7824 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7825 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7826 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7827 | [ALC883_6ST_DIG] = { |
| 7828 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7829 | .init_verbs = { alc883_init_verbs }, |
| 7830 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7831 | .dac_nids = alc883_dac_nids, |
| 7832 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7833 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7834 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7835 | .channel_mode = alc883_sixstack_modes, |
| 7836 | .input_mux = &alc883_capture_source, |
| 7837 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7838 | [ALC883_TARGA_DIG] = { |
| 7839 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7840 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7841 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7842 | .dac_nids = alc883_dac_nids, |
| 7843 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7844 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7845 | .channel_mode = alc883_3ST_6ch_modes, |
| 7846 | .need_dac_fix = 1, |
| 7847 | .input_mux = &alc883_capture_source, |
| 7848 | .unsol_event = alc883_tagra_unsol_event, |
| 7849 | .init_hook = alc883_tagra_automute, |
| 7850 | }, |
| 7851 | [ALC883_TARGA_2ch_DIG] = { |
| 7852 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7853 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7855 | .dac_nids = alc883_dac_nids, |
| 7856 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7857 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7858 | .channel_mode = alc883_3ST_2ch_modes, |
| 7859 | .input_mux = &alc883_capture_source, |
| 7860 | .unsol_event = alc883_tagra_unsol_event, |
| 7861 | .init_hook = alc883_tagra_automute, |
| 7862 | }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7863 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7864 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7865 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7866 | * and the headphone jack. Turn this on and rely on the |
| 7867 | * standard mute methods whenever the user wants to turn |
| 7868 | * these outputs off. |
| 7869 | */ |
| 7870 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7871 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7872 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7873 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7874 | .channel_mode = alc883_3ST_2ch_modes, |
| 7875 | .input_mux = &alc883_capture_source, |
| 7876 | }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7877 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7878 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7879 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7880 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7881 | .dac_nids = alc883_dac_nids, |
| 7882 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a867 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7883 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7884 | .channel_mode = alc883_3ST_2ch_modes, |
| 7885 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7886 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7887 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7888 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7889 | [ALC883_MEDION] = { |
| 7890 | .mixers = { alc883_fivestack_mixer, |
| 7891 | alc883_chmode_mixer }, |
| 7892 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7893 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7894 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7895 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7896 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7897 | .channel_mode = alc883_sixstack_modes, |
| 7898 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7899 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7900 | [ALC883_MEDION_MD2] = { |
| 7901 | .mixers = { alc883_medion_md2_mixer}, |
| 7902 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7903 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7904 | .dac_nids = alc883_dac_nids, |
| 7905 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7906 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7907 | .channel_mode = alc883_3ST_2ch_modes, |
| 7908 | .input_mux = &alc883_capture_source, |
| 7909 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7910 | .init_hook = alc883_medion_md2_automute, |
| 7911 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7912 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7913 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7914 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7915 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7916 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7917 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7918 | .channel_mode = alc883_3ST_2ch_modes, |
| 7919 | .input_mux = &alc883_capture_source, |
| 7920 | }, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7921 | [ALC883_CLEVO_M720] = { |
| 7922 | .mixers = { alc883_clevo_m720_mixer }, |
| 7923 | .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs }, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7924 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7925 | .dac_nids = alc883_dac_nids, |
| 7926 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7927 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7928 | .channel_mode = alc883_3ST_2ch_modes, |
| 7929 | .input_mux = &alc883_capture_source, |
Herton Ronaldo Krzesinski | 0c4cc44 | 2008-03-22 10:26:05 +0100 | [diff] [blame] | 7930 | .unsol_event = alc883_clevo_m720_unsol_event, |
| 7931 | .init_hook = alc883_clevo_m720_automute, |
Jiang zhe | 368c7a9 | 2008-03-04 11:20:33 +0100 | [diff] [blame] | 7932 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7933 | [ALC883_LENOVO_101E_2ch] = { |
| 7934 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7935 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7936 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7937 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7938 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7939 | .channel_mode = alc883_3ST_2ch_modes, |
| 7940 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7941 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7942 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7943 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7944 | [ALC883_LENOVO_NB0763] = { |
| 7945 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7946 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7947 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7948 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7949 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7950 | .channel_mode = alc883_3ST_2ch_modes, |
| 7951 | .need_dac_fix = 1, |
| 7952 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7953 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7954 | .init_hook = alc883_medion_md2_automute, |
| 7955 | }, |
| 7956 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7957 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7958 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7959 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7960 | .dac_nids = alc883_dac_nids, |
| 7961 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7962 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7963 | .channel_mode = alc883_3ST_6ch_modes, |
| 7964 | .need_dac_fix = 1, |
| 7965 | .input_mux = &alc883_capture_source, |
| 7966 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7967 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7968 | }, |
| 7969 | [ALC883_HAIER_W66] = { |
| 7970 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7971 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7972 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7973 | .dac_nids = alc883_dac_nids, |
| 7974 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7975 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7976 | .channel_mode = alc883_3ST_2ch_modes, |
| 7977 | .input_mux = &alc883_capture_source, |
| 7978 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7979 | .init_hook = alc883_haier_w66_automute, |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7980 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7981 | [ALC888_3ST_HP] = { |
Herton Ronaldo Krzesinski | eea6419 | 2008-03-20 12:14:59 +0100 | [diff] [blame] | 7982 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7983 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7984 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7985 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7986 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7987 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7988 | .need_dac_fix = 1, |
| 7989 | .input_mux = &alc883_capture_source, |
| 7990 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7991 | [ALC888_6ST_DELL] = { |
Herton Ronaldo Krzesinski | f24dbdc | 2008-03-20 12:14:28 +0100 | [diff] [blame] | 7992 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7993 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7994 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7995 | .dac_nids = alc883_dac_nids, |
| 7996 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7997 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7998 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7999 | .channel_mode = alc883_sixstack_modes, |
| 8000 | .input_mux = &alc883_capture_source, |
| 8001 | .unsol_event = alc888_6st_dell_unsol_event, |
| 8002 | .init_hook = alc888_6st_dell_front_automute, |
| 8003 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8004 | [ALC883_MITAC] = { |
| 8005 | .mixers = { alc883_mitac_mixer }, |
| 8006 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 8007 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8008 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 8009 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8010 | .channel_mode = alc883_3ST_2ch_modes, |
| 8011 | .input_mux = &alc883_capture_source, |
| 8012 | .unsol_event = alc883_mitac_unsol_event, |
| 8013 | .init_hook = alc883_mitac_automute, |
| 8014 | }, |
Jiang zhe | fb97dc6 | 2008-03-06 11:07:11 +0100 | [diff] [blame] | 8015 | [ALC883_FUJITSU_PI2515] = { |
| 8016 | .mixers = { alc883_2ch_fujitsu_pi2515_mixer }, |
| 8017 | .init_verbs = { alc883_init_verbs, |
| 8018 | alc883_2ch_fujitsu_pi2515_verbs}, |
| 8019 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 8020 | .dac_nids = alc883_dac_nids, |
| 8021 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 8022 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 8023 | .channel_mode = alc883_3ST_2ch_modes, |
| 8024 | .input_mux = &alc883_fujitsu_pi2515_capture_source, |
| 8025 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
| 8026 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
| 8027 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8028 | }; |
| 8029 | |
| 8030 | |
| 8031 | /* |
| 8032 | * BIOS auto configuration |
| 8033 | */ |
| 8034 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 8035 | hda_nid_t nid, int pin_type, |
| 8036 | int dac_idx) |
| 8037 | { |
| 8038 | /* set as output */ |
| 8039 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8040 | int idx; |
| 8041 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8042 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8043 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 8044 | idx = 4; |
| 8045 | else |
| 8046 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8047 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 8048 | |
| 8049 | } |
| 8050 | |
| 8051 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 8052 | { |
| 8053 | struct alc_spec *spec = codec->spec; |
| 8054 | int i; |
| 8055 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8056 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8057 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8058 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8059 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8060 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 8061 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8062 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8063 | } |
| 8064 | } |
| 8065 | |
| 8066 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 8067 | { |
| 8068 | struct alc_spec *spec = codec->spec; |
| 8069 | hda_nid_t pin; |
| 8070 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8071 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8072 | if (pin) /* connect to front */ |
| 8073 | /* use dac 0 */ |
| 8074 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8075 | pin = spec->autocfg.speaker_pins[0]; |
| 8076 | if (pin) |
| 8077 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8078 | } |
| 8079 | |
| 8080 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 8081 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 8082 | |
| 8083 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 8084 | { |
| 8085 | struct alc_spec *spec = codec->spec; |
| 8086 | int i; |
| 8087 | |
| 8088 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 8089 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 8090 | if (alc883_is_input_pin(nid)) { |
| 8091 | snd_hda_codec_write(codec, nid, 0, |
| 8092 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8093 | (i <= AUTO_PIN_FRONT_MIC ? |
| 8094 | PIN_VREF80 : PIN_IN)); |
| 8095 | if (nid != ALC883_PIN_CD_NID) |
| 8096 | snd_hda_codec_write(codec, nid, 0, |
| 8097 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 8098 | AMP_OUT_MUTE); |
| 8099 | } |
| 8100 | } |
| 8101 | } |
| 8102 | |
| 8103 | /* almost identical with ALC880 parser... */ |
| 8104 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 8105 | { |
| 8106 | struct alc_spec *spec = codec->spec; |
| 8107 | int err = alc880_parse_auto_config(codec); |
| 8108 | |
| 8109 | if (err < 0) |
| 8110 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8111 | else if (!err) |
| 8112 | return 0; /* no config found */ |
| 8113 | |
| 8114 | err = alc_auto_add_mic_boost(codec); |
| 8115 | if (err < 0) |
| 8116 | return err; |
| 8117 | |
| 8118 | /* hack - override the init verbs */ |
| 8119 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 8120 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 8121 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8122 | |
| 8123 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8124 | } |
| 8125 | |
| 8126 | /* additional initialization for auto-configuration model */ |
| 8127 | static void alc883_auto_init(struct hda_codec *codec) |
| 8128 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8129 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8130 | alc883_auto_init_multi_out(codec); |
| 8131 | alc883_auto_init_hp_out(codec); |
| 8132 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 8133 | if (spec->unsol_event) |
| 8134 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8135 | } |
| 8136 | |
| 8137 | static int patch_alc883(struct hda_codec *codec) |
| 8138 | { |
| 8139 | struct alc_spec *spec; |
| 8140 | int err, board_config; |
| 8141 | |
| 8142 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 8143 | if (spec == NULL) |
| 8144 | return -ENOMEM; |
| 8145 | |
| 8146 | codec->spec = spec; |
| 8147 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8148 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 8149 | alc883_models, |
| 8150 | alc883_cfg_tbl); |
| 8151 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8152 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8153 | "trying auto-probe from BIOS...\n"); |
| 8154 | board_config = ALC883_AUTO; |
| 8155 | } |
| 8156 | |
| 8157 | if (board_config == ALC883_AUTO) { |
| 8158 | /* automatic parse from the BIOS config */ |
| 8159 | err = alc883_parse_auto_config(codec); |
| 8160 | if (err < 0) { |
| 8161 | alc_free(codec); |
| 8162 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8163 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8164 | printk(KERN_INFO |
| 8165 | "hda_codec: Cannot set up configuration " |
| 8166 | "from BIOS. Using base mode...\n"); |
| 8167 | board_config = ALC883_3ST_2ch_DIG; |
| 8168 | } |
| 8169 | } |
| 8170 | |
| 8171 | if (board_config != ALC883_AUTO) |
| 8172 | setup_preset(spec, &alc883_presets[board_config]); |
| 8173 | |
| 8174 | spec->stream_name_analog = "ALC883 Analog"; |
| 8175 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8176 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8177 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8178 | |
| 8179 | spec->stream_name_digital = "ALC883 Digital"; |
| 8180 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8181 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8182 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8183 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8184 | spec->adc_nids = alc883_adc_nids; |
| 8185 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8186 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8187 | spec->vmaster_nid = 0x0c; |
| 8188 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8189 | codec->patch_ops = alc_patch_ops; |
| 8190 | if (board_config == ALC883_AUTO) |
| 8191 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8192 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8193 | if (!spec->loopback.amplist) |
| 8194 | spec->loopback.amplist = alc883_loopbacks; |
| 8195 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8196 | |
| 8197 | return 0; |
| 8198 | } |
| 8199 | |
| 8200 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8201 | * ALC262 support |
| 8202 | */ |
| 8203 | |
| 8204 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8205 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8206 | |
| 8207 | #define alc262_dac_nids alc260_dac_nids |
| 8208 | #define alc262_adc_nids alc882_adc_nids |
| 8209 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8210 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8211 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8212 | |
| 8213 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8214 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8215 | |
| 8216 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8217 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8218 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8219 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8220 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8221 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8222 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8223 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8224 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8225 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8226 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8227 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8228 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8229 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8230 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8231 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8232 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8233 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8234 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8235 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8236 | }; |
| 8237 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8238 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8239 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8240 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8241 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8242 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8243 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8244 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8245 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8246 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8247 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8248 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8249 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8250 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8251 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8252 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8253 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8254 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8255 | { } /* end */ |
| 8256 | }; |
| 8257 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8258 | /* update HP, line and mono-out pins according to the master switch */ |
| 8259 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8260 | { |
| 8261 | struct alc_spec *spec = codec->spec; |
| 8262 | int val = spec->master_sw; |
| 8263 | |
| 8264 | /* HP & line-out */ |
| 8265 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8266 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8267 | val ? PIN_HP : 0); |
| 8268 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8269 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8270 | val ? PIN_HP : 0); |
| 8271 | /* mono (speaker) depending on the HP jack sense */ |
| 8272 | val = val && !spec->jack_present; |
| 8273 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8274 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8275 | val ? PIN_OUT : 0); |
| 8276 | } |
| 8277 | |
| 8278 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8279 | { |
| 8280 | struct alc_spec *spec = codec->spec; |
| 8281 | unsigned int presence; |
| 8282 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8283 | AC_VERB_GET_PIN_SENSE, 0); |
| 8284 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8285 | alc262_hp_master_update(codec); |
| 8286 | } |
| 8287 | |
| 8288 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8289 | { |
| 8290 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8291 | return; |
| 8292 | alc262_hp_bpc_automute(codec); |
| 8293 | } |
| 8294 | |
| 8295 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8296 | { |
| 8297 | struct alc_spec *spec = codec->spec; |
| 8298 | unsigned int presence; |
| 8299 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8300 | AC_VERB_GET_PIN_SENSE, 0); |
| 8301 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8302 | alc262_hp_master_update(codec); |
| 8303 | } |
| 8304 | |
| 8305 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8306 | unsigned int res) |
| 8307 | { |
| 8308 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8309 | return; |
| 8310 | alc262_hp_wildwest_automute(codec); |
| 8311 | } |
| 8312 | |
| 8313 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8314 | struct snd_ctl_elem_value *ucontrol) |
| 8315 | { |
| 8316 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8317 | struct alc_spec *spec = codec->spec; |
| 8318 | *ucontrol->value.integer.value = spec->master_sw; |
| 8319 | return 0; |
| 8320 | } |
| 8321 | |
| 8322 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8323 | struct snd_ctl_elem_value *ucontrol) |
| 8324 | { |
| 8325 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8326 | struct alc_spec *spec = codec->spec; |
| 8327 | int val = !!*ucontrol->value.integer.value; |
| 8328 | |
| 8329 | if (val == spec->master_sw) |
| 8330 | return 0; |
| 8331 | spec->master_sw = val; |
| 8332 | alc262_hp_master_update(codec); |
| 8333 | return 1; |
| 8334 | } |
| 8335 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8336 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8337 | { |
| 8338 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8339 | .name = "Master Playback Switch", |
| 8340 | .info = snd_ctl_boolean_mono_info, |
| 8341 | .get = alc262_hp_master_sw_get, |
| 8342 | .put = alc262_hp_master_sw_put, |
| 8343 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8344 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8345 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8346 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8347 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8348 | HDA_OUTPUT), |
| 8349 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8350 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8353 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8354 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8355 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8356 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8357 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8358 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8359 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8360 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8361 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8362 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8363 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8364 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8365 | { } /* end */ |
| 8366 | }; |
| 8367 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8368 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8369 | { |
| 8370 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8371 | .name = "Master Playback Switch", |
| 8372 | .info = snd_ctl_boolean_mono_info, |
| 8373 | .get = alc262_hp_master_sw_get, |
| 8374 | .put = alc262_hp_master_sw_put, |
| 8375 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8376 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8377 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8378 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8379 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8380 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8381 | HDA_OUTPUT), |
| 8382 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8383 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8384 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8385 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8386 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8387 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8388 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8389 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8390 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8391 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8392 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8393 | { } /* end */ |
| 8394 | }; |
| 8395 | |
| 8396 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8397 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8398 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8399 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8400 | { } /* end */ |
| 8401 | }; |
| 8402 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8403 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8404 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8405 | { |
| 8406 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8407 | |
| 8408 | if (force || !spec->sense_updated) { |
| 8409 | unsigned int present; |
| 8410 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8411 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8412 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8413 | spec->sense_updated = 1; |
| 8414 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8415 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8416 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8417 | } |
| 8418 | |
| 8419 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8420 | unsigned int res) |
| 8421 | { |
| 8422 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8423 | return; |
| 8424 | alc262_hp_t5735_automute(codec, 1); |
| 8425 | } |
| 8426 | |
| 8427 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8428 | { |
| 8429 | alc262_hp_t5735_automute(codec, 1); |
| 8430 | } |
| 8431 | |
| 8432 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8433 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8434 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8435 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8436 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8437 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8438 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8439 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8440 | { } /* end */ |
| 8441 | }; |
| 8442 | |
| 8443 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8444 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8445 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8446 | |
| 8447 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8448 | { } |
| 8449 | }; |
| 8450 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8451 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8452 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8454 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8455 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8458 | { } /* end */ |
| 8459 | }; |
| 8460 | |
| 8461 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8462 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8463 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8464 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8465 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8466 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8467 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8468 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8469 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8470 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8471 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8472 | {} |
| 8473 | }; |
| 8474 | |
| 8475 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8476 | .num_items = 1, |
| 8477 | .items = { |
| 8478 | { "Line", 0x1 }, |
| 8479 | }, |
| 8480 | }; |
| 8481 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8482 | /* bind hp and internal speaker mute (with plug check) */ |
| 8483 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8484 | struct snd_ctl_elem_value *ucontrol) |
| 8485 | { |
| 8486 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8487 | long *valp = ucontrol->value.integer.value; |
| 8488 | int change; |
| 8489 | |
| 8490 | /* change hp mute */ |
| 8491 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8492 | HDA_AMP_MUTE, |
| 8493 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8494 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8495 | HDA_AMP_MUTE, |
| 8496 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8497 | if (change) { |
| 8498 | /* change speaker according to HP jack state */ |
| 8499 | struct alc_spec *spec = codec->spec; |
| 8500 | unsigned int mute; |
| 8501 | if (spec->jack_present) |
| 8502 | mute = HDA_AMP_MUTE; |
| 8503 | else |
| 8504 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8505 | HDA_OUTPUT, 0); |
| 8506 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8507 | HDA_AMP_MUTE, mute); |
| 8508 | } |
| 8509 | return change; |
| 8510 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8511 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8512 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8513 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8514 | { |
| 8515 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8516 | .name = "Master Playback Switch", |
| 8517 | .info = snd_hda_mixer_amp_switch_info, |
| 8518 | .get = snd_hda_mixer_amp_switch_get, |
| 8519 | .put = alc262_sony_master_sw_put, |
| 8520 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8521 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8522 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8523 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8524 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8525 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8526 | { } /* end */ |
| 8527 | }; |
| 8528 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8529 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8530 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8531 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8532 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8533 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8534 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8535 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8536 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8537 | { } /* end */ |
| 8538 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8539 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8540 | #define alc262_capture_mixer alc882_capture_mixer |
| 8541 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8542 | |
| 8543 | /* |
| 8544 | * generic initialization of ADC, input mixers and output mixers |
| 8545 | */ |
| 8546 | static struct hda_verb alc262_init_verbs[] = { |
| 8547 | /* |
| 8548 | * Unmute ADC0-2 and set the default input to mic-in |
| 8549 | */ |
| 8550 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8552 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8553 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8554 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8555 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8556 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8557 | /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8558 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8559 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8560 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8561 | */ |
| 8562 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8563 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8564 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8565 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8566 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8567 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8568 | |
| 8569 | /* |
| 8570 | * Set up output mixers (0x0c - 0x0e) |
| 8571 | */ |
| 8572 | /* set vol=0 to output mixers */ |
| 8573 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8574 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8575 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8576 | /* set up input amps for analog loopback */ |
| 8577 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8578 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8579 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8580 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8583 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8584 | |
| 8585 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8586 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8587 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8588 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8589 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8590 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8591 | |
| 8592 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8593 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8594 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8595 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8596 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8597 | |
| 8598 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8599 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8600 | |
| 8601 | /* FIXME: use matrix-type input source selection */ |
| 8602 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8603 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8604 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8605 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8606 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8607 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8608 | /* Input mixer2 */ |
| 8609 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8610 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8611 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8612 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8613 | /* Input mixer3 */ |
| 8614 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8615 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8616 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8617 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8618 | |
| 8619 | { } |
| 8620 | }; |
| 8621 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8622 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8623 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8624 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8625 | {} |
| 8626 | }; |
| 8627 | |
| 8628 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8629 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8630 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8631 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8632 | |
| 8633 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8634 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8635 | {} |
| 8636 | }; |
| 8637 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8638 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8639 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8640 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8641 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8642 | |
| 8643 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Akio Idehara | 7b1e879 | 2008-06-09 22:46:07 +0900 | [diff] [blame^] | 8645 | {} |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8646 | }; |
| 8647 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8648 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8649 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8650 | { |
| 8651 | struct alc_spec *spec = codec->spec; |
| 8652 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8653 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8654 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8655 | /* need to execute and sync at first */ |
| 8656 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8657 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8658 | AC_VERB_GET_PIN_SENSE, 0); |
| 8659 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8660 | if (spec->jack_present) { |
| 8661 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8662 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8663 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8664 | } else { |
| 8665 | /* unmute internal speaker if necessary */ |
| 8666 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8667 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8668 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8669 | } |
| 8670 | } |
| 8671 | |
| 8672 | /* unsolicited event for HP jack sensing */ |
| 8673 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8674 | unsigned int res) |
| 8675 | { |
| 8676 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8677 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8678 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8679 | } |
| 8680 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8681 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8682 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8683 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8684 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8685 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8686 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8687 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8688 | AC_VERB_GET_PIN_SENSE, 0); |
| 8689 | present = (present & 0x80000000) != 0; |
| 8690 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8691 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8692 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8693 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8694 | } else { |
| 8695 | /* unmute internal speaker if necessary */ |
| 8696 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8697 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8698 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8699 | } |
| 8700 | } |
| 8701 | |
| 8702 | /* unsolicited event for HP jack sensing */ |
| 8703 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8704 | unsigned int res) |
| 8705 | { |
| 8706 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8707 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8708 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8709 | } |
| 8710 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8711 | /* |
| 8712 | * fujitsu model |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8713 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
| 8714 | * 0x1b = port replicator headphone out |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8715 | */ |
| 8716 | |
| 8717 | #define ALC_HP_EVENT 0x37 |
| 8718 | |
| 8719 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8720 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8721 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8722 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8723 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8724 | {} |
| 8725 | }; |
| 8726 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8727 | static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { |
| 8728 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8729 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8730 | {} |
| 8731 | }; |
| 8732 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8733 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8734 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8735 | .items = { |
| 8736 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8737 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8738 | { "CD", 0x4 }, |
| 8739 | }, |
| 8740 | }; |
| 8741 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8742 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8743 | .num_items = 5, |
| 8744 | .items = { |
| 8745 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8746 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8747 | { "Line", 0x2 }, |
| 8748 | { "CD", 0x4 }, |
| 8749 | { "AUX IN", 0x6 }, |
| 8750 | }, |
| 8751 | }; |
| 8752 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8753 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8754 | .num_items = 4, |
| 8755 | .items = { |
| 8756 | { "Mic", 0x0 }, |
| 8757 | { "Front Mic", 0x2 }, |
| 8758 | { "Line", 0x1 }, |
| 8759 | { "CD", 0x4 }, |
| 8760 | }, |
| 8761 | }; |
| 8762 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8763 | /* mute/unmute internal speaker according to the hp jacks and mute state */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8764 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8765 | { |
| 8766 | struct alc_spec *spec = codec->spec; |
| 8767 | unsigned int mute; |
| 8768 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8769 | if (force || !spec->sense_updated) { |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8770 | unsigned int present; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8771 | /* need to execute and sync at first */ |
| 8772 | 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] | 8773 | /* check laptop HP jack */ |
| 8774 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8775 | AC_VERB_GET_PIN_SENSE, 0); |
| 8776 | /* need to execute and sync at first */ |
| 8777 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8778 | /* check docking HP jack */ |
| 8779 | present |= snd_hda_codec_read(codec, 0x1b, 0, |
| 8780 | AC_VERB_GET_PIN_SENSE, 0); |
| 8781 | if (present & AC_PINSENSE_PRESENCE) |
| 8782 | spec->jack_present = 1; |
| 8783 | else |
| 8784 | spec->jack_present = 0; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8785 | spec->sense_updated = 1; |
| 8786 | } |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8787 | /* unmute internal speaker only if both HPs are unplugged and |
| 8788 | * master switch is on |
| 8789 | */ |
| 8790 | if (spec->jack_present) |
| 8791 | mute = HDA_AMP_MUTE; |
| 8792 | else |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8793 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8794 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8795 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8796 | } |
| 8797 | |
| 8798 | /* unsolicited event for HP jack sensing */ |
| 8799 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8800 | unsigned int res) |
| 8801 | { |
| 8802 | if ((res >> 26) != ALC_HP_EVENT) |
| 8803 | return; |
| 8804 | alc262_fujitsu_automute(codec, 1); |
| 8805 | } |
| 8806 | |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 8807 | static void alc262_fujitsu_init_hook(struct hda_codec *codec) |
| 8808 | { |
| 8809 | alc262_fujitsu_automute(codec, 1); |
| 8810 | } |
| 8811 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8812 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8813 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8814 | .ops = &snd_hda_bind_vol, |
| 8815 | .values = { |
| 8816 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8817 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8818 | 0 |
| 8819 | }, |
| 8820 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8821 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8822 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8823 | static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force) |
| 8824 | { |
| 8825 | struct alc_spec *spec = codec->spec; |
| 8826 | unsigned int mute; |
| 8827 | |
| 8828 | if (force || !spec->sense_updated) { |
| 8829 | unsigned int present_int_hp; |
| 8830 | /* need to execute and sync at first */ |
| 8831 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8832 | present_int_hp = snd_hda_codec_read(codec, 0x1b, 0, |
| 8833 | AC_VERB_GET_PIN_SENSE, 0); |
| 8834 | spec->jack_present = (present_int_hp & 0x80000000) != 0; |
| 8835 | spec->sense_updated = 1; |
| 8836 | } |
| 8837 | if (spec->jack_present) { |
| 8838 | /* mute internal speaker */ |
| 8839 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8840 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8841 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8842 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8843 | } else { |
| 8844 | /* unmute internal speaker if necessary */ |
| 8845 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
| 8846 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8847 | HDA_AMP_MUTE, mute); |
| 8848 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 8849 | HDA_AMP_MUTE, mute); |
| 8850 | } |
| 8851 | } |
| 8852 | |
| 8853 | /* unsolicited event for HP jack sensing */ |
| 8854 | static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, |
| 8855 | unsigned int res) |
| 8856 | { |
| 8857 | if ((res >> 26) != ALC_HP_EVENT) |
| 8858 | return; |
| 8859 | alc262_lenovo_3000_automute(codec, 1); |
| 8860 | } |
| 8861 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8862 | /* bind hp and internal speaker mute (with plug check) */ |
| 8863 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8864 | struct snd_ctl_elem_value *ucontrol) |
| 8865 | { |
| 8866 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8867 | long *valp = ucontrol->value.integer.value; |
| 8868 | int change; |
| 8869 | |
Tony Vroon | 5d9fab2 | 2008-03-14 17:09:18 +0100 | [diff] [blame] | 8870 | change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8871 | HDA_AMP_MUTE, |
| 8872 | valp ? 0 : HDA_AMP_MUTE); |
| 8873 | change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8874 | HDA_AMP_MUTE, |
| 8875 | valp ? 0 : HDA_AMP_MUTE); |
| 8876 | |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8877 | if (change) |
| 8878 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8879 | return change; |
| 8880 | } |
| 8881 | |
| 8882 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8883 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8884 | { |
| 8885 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8886 | .name = "Master Playback Switch", |
| 8887 | .info = snd_hda_mixer_amp_switch_info, |
| 8888 | .get = snd_hda_mixer_amp_switch_get, |
| 8889 | .put = alc262_fujitsu_master_sw_put, |
| 8890 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8891 | }, |
| 8892 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8893 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Tony Vroon | 06a9c30 | 2008-04-14 13:31:45 +0200 | [diff] [blame] | 8894 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), |
| 8895 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8896 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8897 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8898 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8899 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8900 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8901 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8902 | { } /* end */ |
| 8903 | }; |
| 8904 | |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 8905 | /* bind hp and internal speaker mute (with plug check) */ |
| 8906 | static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8907 | struct snd_ctl_elem_value *ucontrol) |
| 8908 | { |
| 8909 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8910 | long *valp = ucontrol->value.integer.value; |
| 8911 | int change; |
| 8912 | |
| 8913 | change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 8914 | HDA_AMP_MUTE, |
| 8915 | valp ? 0 : HDA_AMP_MUTE); |
| 8916 | |
| 8917 | if (change) |
| 8918 | alc262_lenovo_3000_automute(codec, 0); |
| 8919 | return change; |
| 8920 | } |
| 8921 | |
| 8922 | static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { |
| 8923 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
| 8924 | { |
| 8925 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8926 | .name = "Master Playback Switch", |
| 8927 | .info = snd_hda_mixer_amp_switch_info, |
| 8928 | .get = snd_hda_mixer_amp_switch_get, |
| 8929 | .put = alc262_lenovo_3000_master_sw_put, |
| 8930 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), |
| 8931 | }, |
| 8932 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8933 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8934 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8935 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8936 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8937 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8938 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8939 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 8940 | { } /* end */ |
| 8941 | }; |
| 8942 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8943 | /* additional init verbs for Benq laptops */ |
| 8944 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8945 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8946 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8947 | {} |
| 8948 | }; |
| 8949 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8950 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8951 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8952 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8953 | |
| 8954 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8955 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8956 | {} |
| 8957 | }; |
| 8958 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8959 | /* Samsung Q1 Ultra Vista model setup */ |
| 8960 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8961 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8962 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8965 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8966 | HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT), |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8967 | { } /* end */ |
| 8968 | }; |
| 8969 | |
| 8970 | static struct hda_verb alc262_ultra_verbs[] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8971 | /* output mixer */ |
| 8972 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8973 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8974 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8975 | /* speaker */ |
| 8976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8978 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8979 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8980 | /* HP */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8981 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 8982 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 8983 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8984 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8985 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8986 | /* internal mic */ |
| 8987 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 8988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8989 | /* ADC, choose mic */ |
| 8990 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8991 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8992 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8993 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8994 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8995 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8996 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8997 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8998 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
| 8999 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)}, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9000 | {} |
| 9001 | }; |
| 9002 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9003 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9004 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 9005 | { |
| 9006 | struct alc_spec *spec = codec->spec; |
| 9007 | unsigned int mute; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9008 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9009 | mute = 0; |
| 9010 | /* auto-mute only when HP is used as HP */ |
| 9011 | if (!spec->cur_mux[0]) { |
| 9012 | unsigned int present; |
| 9013 | /* need to execute and sync at first */ |
| 9014 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 9015 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 9016 | AC_VERB_GET_PIN_SENSE, 0); |
| 9017 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 9018 | if (spec->jack_present) |
| 9019 | mute = HDA_AMP_MUTE; |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9020 | } |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9021 | /* mute/unmute internal speaker */ |
| 9022 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9023 | HDA_AMP_MUTE, mute); |
| 9024 | /* mute/unmute HP */ |
| 9025 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9026 | HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE); |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9027 | } |
| 9028 | |
| 9029 | /* unsolicited event for HP jack sensing */ |
| 9030 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 9031 | unsigned int res) |
| 9032 | { |
| 9033 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9034 | return; |
| 9035 | alc262_ultra_automute(codec); |
| 9036 | } |
| 9037 | |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9038 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 9039 | .num_items = 2, |
| 9040 | .items = { |
| 9041 | { "Mic", 0x1 }, |
| 9042 | { "Headphone", 0x7 }, |
| 9043 | }, |
| 9044 | }; |
| 9045 | |
| 9046 | static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9047 | struct snd_ctl_elem_value *ucontrol) |
| 9048 | { |
| 9049 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9050 | struct alc_spec *spec = codec->spec; |
| 9051 | int ret; |
| 9052 | |
| 9053 | ret = alc882_mux_enum_put(kcontrol, ucontrol); |
| 9054 | if (!ret) |
| 9055 | return 0; |
| 9056 | /* reprogram the HP pin as mic or HP according to the input source */ |
| 9057 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 9058 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 9059 | spec->cur_mux[0] ? PIN_VREF80 : PIN_HP); |
| 9060 | alc262_ultra_automute(codec); /* mute/unmute HP */ |
| 9061 | return ret; |
| 9062 | } |
| 9063 | |
| 9064 | static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = { |
| 9065 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 9066 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 9067 | { |
| 9068 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9069 | .name = "Capture Source", |
| 9070 | .info = alc882_mux_enum_info, |
| 9071 | .get = alc882_mux_enum_get, |
| 9072 | .put = alc262_ultra_mux_enum_put, |
| 9073 | }, |
| 9074 | { } /* end */ |
| 9075 | }; |
| 9076 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9077 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9078 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9079 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9080 | { |
| 9081 | hda_nid_t nid; |
| 9082 | int err; |
| 9083 | |
| 9084 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 9085 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9086 | spec->multiout.dac_nids[0] = 2; |
| 9087 | |
| 9088 | nid = cfg->line_out_pins[0]; |
| 9089 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9090 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9091 | "Front Playback Volume", |
| 9092 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 9093 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9094 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9095 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9096 | "Front Playback Switch", |
| 9097 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 9098 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9099 | return err; |
| 9100 | } |
| 9101 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 9102 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9103 | if (nid) { |
| 9104 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9105 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9106 | "Speaker Playback Volume", |
| 9107 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9108 | HDA_OUTPUT)); |
| 9109 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9110 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9111 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9112 | "Speaker Playback Switch", |
| 9113 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9114 | HDA_OUTPUT)); |
| 9115 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9116 | return err; |
| 9117 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9118 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9119 | "Speaker Playback Switch", |
| 9120 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9121 | HDA_OUTPUT)); |
| 9122 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9123 | return err; |
| 9124 | } |
| 9125 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 9126 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9127 | if (nid) { |
| 9128 | /* spec->multiout.hp_nid = 2; */ |
| 9129 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9130 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9131 | "Headphone Playback Volume", |
| 9132 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 9133 | HDA_OUTPUT)); |
| 9134 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9135 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9136 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9137 | "Headphone Playback Switch", |
| 9138 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 9139 | HDA_OUTPUT)); |
| 9140 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9141 | return err; |
| 9142 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9143 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9144 | "Headphone Playback Switch", |
| 9145 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 9146 | HDA_OUTPUT)); |
| 9147 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9148 | return err; |
| 9149 | } |
| 9150 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9151 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9152 | } |
| 9153 | |
| 9154 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9155 | #define alc262_auto_create_analog_input_ctls \ |
| 9156 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9157 | |
| 9158 | /* |
| 9159 | * generic initialization of ADC, input mixers and output mixers |
| 9160 | */ |
| 9161 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 9162 | /* |
| 9163 | * Unmute ADC0-2 and set the default input to mic-in |
| 9164 | */ |
| 9165 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9166 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9167 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9168 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9169 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9170 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9171 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9172 | /* 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] | 9173 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9174 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9175 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9176 | */ |
| 9177 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9178 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9179 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9180 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9181 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9182 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9183 | |
| 9184 | /* |
| 9185 | * Set up output mixers (0x0c - 0x0f) |
| 9186 | */ |
| 9187 | /* set vol=0 to output mixers */ |
| 9188 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9189 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9190 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9191 | |
| 9192 | /* set up input amps for analog loopback */ |
| 9193 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9194 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9195 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9196 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9197 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9198 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9199 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9200 | |
| 9201 | /* FIXME: use matrix-type input source selection */ |
| 9202 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9203 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9204 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9205 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9206 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9207 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9208 | /* Input mixer2 */ |
| 9209 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9210 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9211 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9212 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9213 | /* Input mixer3 */ |
| 9214 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9215 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 9216 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 9217 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 9218 | |
| 9219 | { } |
| 9220 | }; |
| 9221 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9222 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 9223 | /* |
| 9224 | * Unmute ADC0-2 and set the default input to mic-in |
| 9225 | */ |
| 9226 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9228 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9229 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9230 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9231 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9232 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9233 | /* 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] | 9234 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9235 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 9236 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9237 | */ |
| 9238 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9239 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9240 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9241 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9242 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9243 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9244 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9245 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9246 | |
| 9247 | /* |
| 9248 | * Set up output mixers (0x0c - 0x0e) |
| 9249 | */ |
| 9250 | /* set vol=0 to output mixers */ |
| 9251 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9252 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9253 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9254 | |
| 9255 | /* set up input amps for analog loopback */ |
| 9256 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9257 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9258 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9259 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9260 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9261 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9262 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9263 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9264 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9265 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9266 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 9267 | |
| 9268 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9269 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9270 | |
| 9271 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9272 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9273 | |
| 9274 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9275 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9276 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9277 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9278 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9279 | |
| 9280 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9281 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9282 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9283 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9284 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9285 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9286 | |
| 9287 | |
| 9288 | /* FIXME: use matrix-type input source selection */ |
| 9289 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9290 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9291 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9292 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9293 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9294 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9295 | /* Input mixer2 */ |
| 9296 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9297 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9298 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9299 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9300 | /* Input mixer3 */ |
| 9301 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9302 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9303 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9304 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9305 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9306 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9307 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9308 | { } |
| 9309 | }; |
| 9310 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9311 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9312 | /* |
| 9313 | * Unmute ADC0-2 and set the default input to mic-in |
| 9314 | */ |
| 9315 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9316 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9317 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9318 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9319 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9320 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9321 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9322 | /* 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] | 9323 | * mixer widget |
| 9324 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9325 | * panel mic (mic 2) |
| 9326 | */ |
| 9327 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9328 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9329 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9330 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9336 | /* |
| 9337 | * Set up output mixers (0x0c - 0x0e) |
| 9338 | */ |
| 9339 | /* set vol=0 to output mixers */ |
| 9340 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9341 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9342 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9343 | |
| 9344 | /* set up input amps for analog loopback */ |
| 9345 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9350 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9352 | |
| 9353 | |
| 9354 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9355 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9357 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9358 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9360 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9361 | |
| 9362 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9363 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9364 | |
| 9365 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9366 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9367 | |
| 9368 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9369 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9370 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9371 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9372 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9373 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9374 | |
| 9375 | /* FIXME: use matrix-type input source selection */ |
| 9376 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9377 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9379 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9380 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9381 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9382 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9383 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9384 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9385 | /* Input mixer2 */ |
| 9386 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9387 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9388 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9389 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9390 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9391 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9393 | /* Input mixer3 */ |
| 9394 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9395 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9396 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9399 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9401 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9402 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9403 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9404 | { } |
| 9405 | }; |
| 9406 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9407 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9408 | #define alc262_loopbacks alc880_loopbacks |
| 9409 | #endif |
| 9410 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9411 | /* pcm configuration: identiacal with ALC880 */ |
| 9412 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9413 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9414 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9415 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9416 | |
| 9417 | /* |
| 9418 | * BIOS auto configuration |
| 9419 | */ |
| 9420 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9421 | { |
| 9422 | struct alc_spec *spec = codec->spec; |
| 9423 | int err; |
| 9424 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9425 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9426 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9427 | alc262_ignore); |
| 9428 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9429 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9430 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9431 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9432 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9433 | if (err < 0) |
| 9434 | return err; |
| 9435 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9436 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9437 | return err; |
| 9438 | |
| 9439 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9440 | |
| 9441 | if (spec->autocfg.dig_out_pin) |
| 9442 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9443 | if (spec->autocfg.dig_in_pin) |
| 9444 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9445 | |
| 9446 | if (spec->kctl_alloc) |
| 9447 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9448 | |
| 9449 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9450 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9451 | spec->input_mux = &spec->private_imux; |
| 9452 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9453 | err = alc_auto_add_mic_boost(codec); |
| 9454 | if (err < 0) |
| 9455 | return err; |
| 9456 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9457 | return 1; |
| 9458 | } |
| 9459 | |
| 9460 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9461 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9462 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9463 | |
| 9464 | |
| 9465 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9466 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9467 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9468 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9469 | alc262_auto_init_multi_out(codec); |
| 9470 | alc262_auto_init_hp_out(codec); |
| 9471 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9472 | if (spec->unsol_event) |
| 9473 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9474 | } |
| 9475 | |
| 9476 | /* |
| 9477 | * configuration and preset |
| 9478 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9479 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9480 | [ALC262_BASIC] = "basic", |
| 9481 | [ALC262_HIPPO] = "hippo", |
| 9482 | [ALC262_HIPPO_1] = "hippo_1", |
| 9483 | [ALC262_FUJITSU] = "fujitsu", |
| 9484 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9485 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9486 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9487 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9488 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9489 | [ALC262_BENQ_T31] = "benq-t31", |
| 9490 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9491 | [ALC262_ULTRA] = "ultra", |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9492 | [ALC262_LENOVO_3000] = "lenovo-3000", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9493 | [ALC262_AUTO] = "auto", |
| 9494 | }; |
| 9495 | |
| 9496 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9497 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9498 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9499 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9500 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9501 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9502 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9503 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9504 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9505 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9506 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9507 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9508 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9509 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9510 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9511 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9512 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9513 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9514 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9515 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9516 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9517 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9518 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9519 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9520 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9521 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9522 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9523 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9524 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9525 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9526 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9527 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9528 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9529 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9530 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9531 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9532 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9533 | {} |
| 9534 | }; |
| 9535 | |
| 9536 | static struct alc_config_preset alc262_presets[] = { |
| 9537 | [ALC262_BASIC] = { |
| 9538 | .mixers = { alc262_base_mixer }, |
| 9539 | .init_verbs = { alc262_init_verbs }, |
| 9540 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9541 | .dac_nids = alc262_dac_nids, |
| 9542 | .hp_nid = 0x03, |
| 9543 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9544 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9545 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9546 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9547 | [ALC262_HIPPO] = { |
| 9548 | .mixers = { alc262_base_mixer }, |
| 9549 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9550 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9551 | .dac_nids = alc262_dac_nids, |
| 9552 | .hp_nid = 0x03, |
| 9553 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9554 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9555 | .channel_mode = alc262_modes, |
| 9556 | .input_mux = &alc262_capture_source, |
| 9557 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9558 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9559 | }, |
| 9560 | [ALC262_HIPPO_1] = { |
| 9561 | .mixers = { alc262_hippo1_mixer }, |
| 9562 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9563 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9564 | .dac_nids = alc262_dac_nids, |
| 9565 | .hp_nid = 0x02, |
| 9566 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9567 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9568 | .channel_mode = alc262_modes, |
| 9569 | .input_mux = &alc262_capture_source, |
| 9570 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9571 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9572 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9573 | [ALC262_FUJITSU] = { |
| 9574 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9575 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9576 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9577 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9578 | .dac_nids = alc262_dac_nids, |
| 9579 | .hp_nid = 0x03, |
| 9580 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9581 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9582 | .channel_mode = alc262_modes, |
| 9583 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9584 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | ebc7a40 | 2008-05-20 09:23:05 +0200 | [diff] [blame] | 9585 | .init_hook = alc262_fujitsu_init_hook, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9586 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9587 | [ALC262_HP_BPC] = { |
| 9588 | .mixers = { alc262_HP_BPC_mixer }, |
| 9589 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9590 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9591 | .dac_nids = alc262_dac_nids, |
| 9592 | .hp_nid = 0x03, |
| 9593 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9594 | .channel_mode = alc262_modes, |
| 9595 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9596 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9597 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9598 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9599 | [ALC262_HP_BPC_D7000_WF] = { |
| 9600 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9601 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9602 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9603 | .dac_nids = alc262_dac_nids, |
| 9604 | .hp_nid = 0x03, |
| 9605 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9606 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9607 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9608 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9609 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9610 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9611 | [ALC262_HP_BPC_D7000_WL] = { |
| 9612 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9613 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9614 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9615 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9616 | .dac_nids = alc262_dac_nids, |
| 9617 | .hp_nid = 0x03, |
| 9618 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9619 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9620 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9621 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9622 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9623 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9624 | [ALC262_HP_TC_T5735] = { |
| 9625 | .mixers = { alc262_hp_t5735_mixer }, |
| 9626 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9627 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9628 | .dac_nids = alc262_dac_nids, |
| 9629 | .hp_nid = 0x03, |
| 9630 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9631 | .channel_mode = alc262_modes, |
| 9632 | .input_mux = &alc262_capture_source, |
| 9633 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9634 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9635 | }, |
| 9636 | [ALC262_HP_RP5700] = { |
| 9637 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9638 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9639 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9640 | .dac_nids = alc262_dac_nids, |
| 9641 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9642 | .channel_mode = alc262_modes, |
| 9643 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9644 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9645 | [ALC262_BENQ_ED8] = { |
| 9646 | .mixers = { alc262_base_mixer }, |
| 9647 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9648 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9649 | .dac_nids = alc262_dac_nids, |
| 9650 | .hp_nid = 0x03, |
| 9651 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9652 | .channel_mode = alc262_modes, |
| 9653 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9654 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9655 | [ALC262_SONY_ASSAMD] = { |
| 9656 | .mixers = { alc262_sony_mixer }, |
| 9657 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9658 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9659 | .dac_nids = alc262_dac_nids, |
| 9660 | .hp_nid = 0x02, |
| 9661 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9662 | .channel_mode = alc262_modes, |
| 9663 | .input_mux = &alc262_capture_source, |
| 9664 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9665 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9666 | }, |
| 9667 | [ALC262_BENQ_T31] = { |
| 9668 | .mixers = { alc262_benq_t31_mixer }, |
| 9669 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9670 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9671 | .dac_nids = alc262_dac_nids, |
| 9672 | .hp_nid = 0x03, |
| 9673 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9674 | .channel_mode = alc262_modes, |
| 9675 | .input_mux = &alc262_capture_source, |
| 9676 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9677 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9678 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9679 | [ALC262_ULTRA] = { |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9680 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
| 9681 | .init_verbs = { alc262_ultra_verbs }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9682 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9683 | .dac_nids = alc262_dac_nids, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9684 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9685 | .channel_mode = alc262_modes, |
| 9686 | .input_mux = &alc262_ultra_capture_source, |
Takashi Iwai | bb9f76c | 2008-03-12 12:51:09 +0100 | [diff] [blame] | 9687 | .adc_nids = alc262_adc_nids, /* ADC0 */ |
| 9688 | .capsrc_nids = alc262_capsrc_nids, |
| 9689 | .num_adc_nids = 1, /* single ADC */ |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9690 | .unsol_event = alc262_ultra_unsol_event, |
| 9691 | .init_hook = alc262_ultra_automute, |
| 9692 | }, |
Jiang zhe | 0e31daf | 2008-03-20 12:12:39 +0100 | [diff] [blame] | 9693 | [ALC262_LENOVO_3000] = { |
| 9694 | .mixers = { alc262_lenovo_3000_mixer }, |
| 9695 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9696 | alc262_lenovo_3000_unsol_verbs }, |
| 9697 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9698 | .dac_nids = alc262_dac_nids, |
| 9699 | .hp_nid = 0x03, |
| 9700 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9701 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9702 | .channel_mode = alc262_modes, |
| 9703 | .input_mux = &alc262_fujitsu_capture_source, |
| 9704 | .unsol_event = alc262_lenovo_3000_unsol_event, |
| 9705 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9706 | }; |
| 9707 | |
| 9708 | static int patch_alc262(struct hda_codec *codec) |
| 9709 | { |
| 9710 | struct alc_spec *spec; |
| 9711 | int board_config; |
| 9712 | int err; |
| 9713 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9714 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9715 | if (spec == NULL) |
| 9716 | return -ENOMEM; |
| 9717 | |
| 9718 | codec->spec = spec; |
| 9719 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9720 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9721 | * under-run |
| 9722 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9723 | { |
| 9724 | int tmp; |
| 9725 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9726 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9727 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9728 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9729 | } |
| 9730 | #endif |
| 9731 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9732 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9733 | alc262_models, |
| 9734 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9735 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9736 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9737 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9738 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9739 | board_config = ALC262_AUTO; |
| 9740 | } |
| 9741 | |
| 9742 | if (board_config == ALC262_AUTO) { |
| 9743 | /* automatic parse from the BIOS config */ |
| 9744 | err = alc262_parse_auto_config(codec); |
| 9745 | if (err < 0) { |
| 9746 | alc_free(codec); |
| 9747 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9748 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9749 | printk(KERN_INFO |
| 9750 | "hda_codec: Cannot set up configuration " |
| 9751 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9752 | board_config = ALC262_BASIC; |
| 9753 | } |
| 9754 | } |
| 9755 | |
| 9756 | if (board_config != ALC262_AUTO) |
| 9757 | setup_preset(spec, &alc262_presets[board_config]); |
| 9758 | |
| 9759 | spec->stream_name_analog = "ALC262 Analog"; |
| 9760 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9761 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9762 | |
| 9763 | spec->stream_name_digital = "ALC262 Digital"; |
| 9764 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9765 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9766 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9767 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9768 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9769 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9770 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9771 | /* get type */ |
| 9772 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9773 | if (wcap != AC_WID_AUD_IN) { |
| 9774 | spec->adc_nids = alc262_adc_nids_alt; |
| 9775 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9776 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9777 | spec->mixers[spec->num_mixers] = |
| 9778 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9779 | spec->num_mixers++; |
| 9780 | } else { |
| 9781 | spec->adc_nids = alc262_adc_nids; |
| 9782 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9783 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9784 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9785 | spec->num_mixers++; |
| 9786 | } |
| 9787 | } |
| 9788 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9789 | spec->vmaster_nid = 0x0c; |
| 9790 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9791 | codec->patch_ops = alc_patch_ops; |
| 9792 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9793 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9794 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9795 | if (!spec->loopback.amplist) |
| 9796 | spec->loopback.amplist = alc262_loopbacks; |
| 9797 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9798 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9799 | return 0; |
| 9800 | } |
| 9801 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9802 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9803 | * ALC268 channel source setting (2 channel) |
| 9804 | */ |
| 9805 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9806 | #define alc268_modes alc260_modes |
| 9807 | |
| 9808 | static hda_nid_t alc268_dac_nids[2] = { |
| 9809 | /* front, hp */ |
| 9810 | 0x02, 0x03 |
| 9811 | }; |
| 9812 | |
| 9813 | static hda_nid_t alc268_adc_nids[2] = { |
| 9814 | /* ADC0-1 */ |
| 9815 | 0x08, 0x07 |
| 9816 | }; |
| 9817 | |
| 9818 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9819 | /* ADC0 */ |
| 9820 | 0x08 |
| 9821 | }; |
| 9822 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9823 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9824 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9825 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9826 | /* output mixer control */ |
| 9827 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9828 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9829 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9830 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9831 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9832 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9833 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9834 | { } |
| 9835 | }; |
| 9836 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 9837 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9838 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9839 | .ops = &snd_hda_bind_sw, |
| 9840 | .values = { |
| 9841 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9842 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9843 | 0 |
| 9844 | }, |
| 9845 | }; |
| 9846 | |
| 9847 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9848 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9849 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9850 | { } |
| 9851 | }; |
| 9852 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9853 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9854 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9855 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9856 | { } |
| 9857 | }; |
| 9858 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9859 | /* Toshiba specific */ |
| 9860 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9861 | |
| 9862 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9863 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9864 | { } /* end */ |
| 9865 | }; |
| 9866 | |
| 9867 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9868 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9869 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9870 | .ops = &snd_hda_bind_vol, |
| 9871 | .values = { |
| 9872 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9873 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9874 | 0 |
| 9875 | }, |
| 9876 | }; |
| 9877 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9878 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9879 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9880 | { |
| 9881 | struct alc_spec *spec = codec->spec; |
| 9882 | unsigned int mute; |
| 9883 | |
| 9884 | if (force || !spec->sense_updated) { |
| 9885 | unsigned int present; |
| 9886 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9887 | AC_VERB_GET_PIN_SENSE, 0); |
| 9888 | spec->jack_present = (present & 0x80000000) != 0; |
| 9889 | spec->sense_updated = 1; |
| 9890 | } |
| 9891 | if (spec->jack_present) |
| 9892 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9893 | else /* unmute internal speaker if necessary */ |
| 9894 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9895 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9896 | HDA_AMP_MUTE, mute); |
| 9897 | } |
| 9898 | |
| 9899 | |
| 9900 | /* bind hp and internal speaker mute (with plug check) */ |
| 9901 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9902 | struct snd_ctl_elem_value *ucontrol) |
| 9903 | { |
| 9904 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9905 | long *valp = ucontrol->value.integer.value; |
| 9906 | int change; |
| 9907 | |
| 9908 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9909 | HDA_AMP_MUTE, |
| 9910 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9911 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9912 | HDA_AMP_MUTE, |
| 9913 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9914 | if (change) |
| 9915 | alc268_acer_automute(codec, 0); |
| 9916 | return change; |
| 9917 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9918 | |
| 9919 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9920 | /* output mixer control */ |
| 9921 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9922 | { |
| 9923 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9924 | .name = "Master Playback Switch", |
| 9925 | .info = snd_hda_mixer_amp_switch_info, |
| 9926 | .get = snd_hda_mixer_amp_switch_get, |
| 9927 | .put = alc268_acer_master_sw_put, |
| 9928 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9929 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9930 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9931 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9932 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9933 | { } |
| 9934 | }; |
| 9935 | |
| 9936 | static struct hda_verb alc268_acer_verbs[] = { |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9937 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
| 9938 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9939 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9940 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 9941 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 9942 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9943 | |
| 9944 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9945 | { } |
| 9946 | }; |
| 9947 | |
| 9948 | /* unsolicited event for HP jack sensing */ |
| 9949 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9950 | unsigned int res) |
| 9951 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9952 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9953 | return; |
| 9954 | alc268_toshiba_automute(codec); |
| 9955 | } |
| 9956 | |
| 9957 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9958 | unsigned int res) |
| 9959 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9960 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9961 | return; |
| 9962 | alc268_acer_automute(codec, 1); |
| 9963 | } |
| 9964 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9965 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9966 | { |
| 9967 | alc268_acer_automute(codec, 1); |
| 9968 | } |
| 9969 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9970 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9971 | /* output mixer control */ |
| 9972 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9973 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9974 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9975 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9976 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9977 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9978 | { } |
| 9979 | }; |
| 9980 | |
| 9981 | static struct hda_verb alc268_dell_verbs[] = { |
| 9982 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9983 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9984 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9985 | { } |
| 9986 | }; |
| 9987 | |
| 9988 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9989 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9990 | { |
| 9991 | unsigned int present; |
| 9992 | unsigned int mute; |
| 9993 | |
| 9994 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9995 | if (present & 0x80000000) |
| 9996 | mute = HDA_AMP_MUTE; |
| 9997 | else |
| 9998 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9999 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 10000 | HDA_AMP_MUTE, mute); |
| 10001 | } |
| 10002 | |
| 10003 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 10004 | unsigned int res) |
| 10005 | { |
| 10006 | if ((res >> 26) != ALC880_HP_EVENT) |
| 10007 | return; |
| 10008 | alc268_dell_automute(codec); |
| 10009 | } |
| 10010 | |
| 10011 | #define alc268_dell_init_hook alc268_dell_automute |
| 10012 | |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10013 | static struct snd_kcontrol_new alc267_quanta_il1_mixer[] = { |
| 10014 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 10015 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10016 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 10017 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10018 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10019 | HDA_BIND_MUTE("Mic Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10020 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 10021 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 10022 | { } |
| 10023 | }; |
| 10024 | |
| 10025 | static struct hda_verb alc267_quanta_il1_verbs[] = { |
| 10026 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 10027 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, |
| 10028 | { } |
| 10029 | }; |
| 10030 | |
| 10031 | static void alc267_quanta_il1_hp_automute(struct hda_codec *codec) |
| 10032 | { |
| 10033 | unsigned int present; |
| 10034 | |
| 10035 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0) |
| 10036 | & AC_PINSENSE_PRESENCE; |
| 10037 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 10038 | present ? 0 : PIN_OUT); |
| 10039 | } |
| 10040 | |
| 10041 | static void alc267_quanta_il1_mic_automute(struct hda_codec *codec) |
| 10042 | { |
| 10043 | unsigned int present; |
| 10044 | |
| 10045 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 10046 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 10047 | snd_hda_codec_write(codec, 0x23, 0, |
| 10048 | AC_VERB_SET_CONNECT_SEL, |
| 10049 | present ? 0x00 : 0x01); |
| 10050 | } |
| 10051 | |
| 10052 | static void alc267_quanta_il1_automute(struct hda_codec *codec) |
| 10053 | { |
| 10054 | alc267_quanta_il1_hp_automute(codec); |
| 10055 | alc267_quanta_il1_mic_automute(codec); |
| 10056 | } |
| 10057 | |
| 10058 | static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, |
| 10059 | unsigned int res) |
| 10060 | { |
| 10061 | switch (res >> 26) { |
| 10062 | case ALC880_HP_EVENT: |
| 10063 | alc267_quanta_il1_hp_automute(codec); |
| 10064 | break; |
| 10065 | case ALC880_MIC_EVENT: |
| 10066 | alc267_quanta_il1_mic_automute(codec); |
| 10067 | break; |
| 10068 | } |
| 10069 | } |
| 10070 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10071 | /* |
| 10072 | * generic initialization of ADC, input mixers and output mixers |
| 10073 | */ |
| 10074 | static struct hda_verb alc268_base_init_verbs[] = { |
| 10075 | /* Unmute DAC0-1 and set vol = 0 */ |
| 10076 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10077 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10078 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10079 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10080 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10081 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10082 | |
| 10083 | /* |
| 10084 | * Set up output mixers (0x0c - 0x0e) |
| 10085 | */ |
| 10086 | /* set vol=0 to output mixers */ |
| 10087 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10088 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10089 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10090 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10091 | |
| 10092 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10093 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10094 | |
| 10095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 10097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 10098 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10099 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10100 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10101 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10102 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10103 | |
| 10104 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10105 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10106 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10107 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10108 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10109 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10110 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10111 | |
| 10112 | /* set PCBEEP vol = 0, mute connections */ |
| 10113 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10114 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10115 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10116 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 10117 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 10118 | |
| 10119 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10120 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10121 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10123 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10124 | { } |
| 10125 | }; |
| 10126 | |
| 10127 | /* |
| 10128 | * generic initialization of ADC, input mixers and output mixers |
| 10129 | */ |
| 10130 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 10131 | /* set output DAC */ |
| 10132 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10133 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10134 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10135 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10136 | |
| 10137 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10138 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 10139 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10140 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10141 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 10142 | |
| 10143 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10144 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10145 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10146 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10147 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10148 | |
| 10149 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10150 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10151 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10152 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10153 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10154 | /* set PCBEEP vol = 0, mute connections */ |
| 10155 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10156 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10157 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10158 | |
| 10159 | { } |
| 10160 | }; |
| 10161 | |
| 10162 | #define alc268_mux_enum_info alc_mux_enum_info |
| 10163 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10164 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10165 | |
| 10166 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 10167 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10168 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10169 | { |
| 10170 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10171 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10172 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10173 | */ |
| 10174 | /* .name = "Capture Source", */ |
| 10175 | .name = "Input Source", |
| 10176 | .count = 1, |
| 10177 | .info = alc268_mux_enum_info, |
| 10178 | .get = alc268_mux_enum_get, |
| 10179 | .put = alc268_mux_enum_put, |
| 10180 | }, |
| 10181 | { } /* end */ |
| 10182 | }; |
| 10183 | |
| 10184 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 10185 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10186 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10187 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10188 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 10189 | { |
| 10190 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10191 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10192 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10193 | */ |
| 10194 | /* .name = "Capture Source", */ |
| 10195 | .name = "Input Source", |
| 10196 | .count = 2, |
| 10197 | .info = alc268_mux_enum_info, |
| 10198 | .get = alc268_mux_enum_get, |
| 10199 | .put = alc268_mux_enum_put, |
| 10200 | }, |
| 10201 | { } /* end */ |
| 10202 | }; |
| 10203 | |
| 10204 | static struct hda_input_mux alc268_capture_source = { |
| 10205 | .num_items = 4, |
| 10206 | .items = { |
| 10207 | { "Mic", 0x0 }, |
| 10208 | { "Front Mic", 0x1 }, |
| 10209 | { "Line", 0x2 }, |
| 10210 | { "CD", 0x3 }, |
| 10211 | }, |
| 10212 | }; |
| 10213 | |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10214 | static struct hda_input_mux alc268_acer_capture_source = { |
| 10215 | .num_items = 3, |
| 10216 | .items = { |
| 10217 | { "Mic", 0x0 }, |
| 10218 | { "Internal Mic", 0x6 }, |
| 10219 | { "Line", 0x2 }, |
| 10220 | }, |
| 10221 | }; |
| 10222 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10223 | #ifdef CONFIG_SND_DEBUG |
| 10224 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10225 | /* Volume widgets */ |
| 10226 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10227 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 10228 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 10229 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 10230 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 10231 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 10232 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 10233 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 10234 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 10235 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 10236 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 10237 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 10238 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 10239 | /* The below appears problematic on some hardwares */ |
| 10240 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10241 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10242 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 10243 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 10244 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 10245 | |
| 10246 | /* Modes for retasking pin widgets */ |
| 10247 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 10248 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 10249 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 10250 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 10251 | |
| 10252 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 10253 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 10254 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 10255 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 10256 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 10257 | |
| 10258 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 10259 | * The ALC268 does not have an SPDIF input. |
| 10260 | */ |
| 10261 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 10262 | |
| 10263 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 10264 | * this output to turn on an external amplifier. |
| 10265 | */ |
| 10266 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 10267 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 10268 | |
| 10269 | { } /* end */ |
| 10270 | }; |
| 10271 | #endif |
| 10272 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10273 | /* create input playback/capture controls for the given pin */ |
| 10274 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 10275 | const char *ctlname, int idx) |
| 10276 | { |
| 10277 | char name[32]; |
| 10278 | int err; |
| 10279 | |
| 10280 | sprintf(name, "%s Playback Volume", ctlname); |
| 10281 | if (nid == 0x14) { |
| 10282 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10283 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 10284 | HDA_OUTPUT)); |
| 10285 | if (err < 0) |
| 10286 | return err; |
| 10287 | } else if (nid == 0x15) { |
| 10288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 10289 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 10290 | HDA_OUTPUT)); |
| 10291 | if (err < 0) |
| 10292 | return err; |
| 10293 | } else |
| 10294 | return -1; |
| 10295 | sprintf(name, "%s Playback Switch", ctlname); |
| 10296 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 10297 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 10298 | if (err < 0) |
| 10299 | return err; |
| 10300 | return 0; |
| 10301 | } |
| 10302 | |
| 10303 | /* add playback controls from the parsed DAC table */ |
| 10304 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10305 | const struct auto_pin_cfg *cfg) |
| 10306 | { |
| 10307 | hda_nid_t nid; |
| 10308 | int err; |
| 10309 | |
| 10310 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 10311 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10312 | spec->multiout.dac_nids[0] = 2; |
| 10313 | spec->multiout.dac_nids[1] = 3; |
| 10314 | |
| 10315 | nid = cfg->line_out_pins[0]; |
| 10316 | if (nid) |
| 10317 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 10318 | |
| 10319 | nid = cfg->speaker_pins[0]; |
| 10320 | if (nid == 0x1d) { |
| 10321 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10322 | "Speaker Playback Volume", |
| 10323 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 10324 | if (err < 0) |
| 10325 | return err; |
| 10326 | } |
| 10327 | nid = cfg->hp_pins[0]; |
| 10328 | if (nid) |
| 10329 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 10330 | |
| 10331 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 10332 | if (nid == 0x16) { |
| 10333 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10334 | "Mono Playback Switch", |
| 10335 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 10336 | if (err < 0) |
| 10337 | return err; |
| 10338 | } |
| 10339 | return 0; |
| 10340 | } |
| 10341 | |
| 10342 | /* create playback/capture controls for input pins */ |
| 10343 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 10344 | const struct auto_pin_cfg *cfg) |
| 10345 | { |
| 10346 | struct hda_input_mux *imux = &spec->private_imux; |
| 10347 | int i, idx1; |
| 10348 | |
| 10349 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 10350 | switch(cfg->input_pins[i]) { |
| 10351 | case 0x18: |
| 10352 | idx1 = 0; /* Mic 1 */ |
| 10353 | break; |
| 10354 | case 0x19: |
| 10355 | idx1 = 1; /* Mic 2 */ |
| 10356 | break; |
| 10357 | case 0x1a: |
| 10358 | idx1 = 2; /* Line In */ |
| 10359 | break; |
| 10360 | case 0x1c: |
| 10361 | idx1 = 3; /* CD */ |
| 10362 | break; |
Takashi Iwai | 7194cae | 2008-03-06 16:58:17 +0100 | [diff] [blame] | 10363 | case 0x12: |
| 10364 | case 0x13: |
| 10365 | idx1 = 6; /* digital mics */ |
| 10366 | break; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10367 | default: |
| 10368 | continue; |
| 10369 | } |
| 10370 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 10371 | imux->items[imux->num_items].index = idx1; |
| 10372 | imux->num_items++; |
| 10373 | } |
| 10374 | return 0; |
| 10375 | } |
| 10376 | |
| 10377 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 10378 | { |
| 10379 | struct alc_spec *spec = codec->spec; |
| 10380 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 10381 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 10382 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 10383 | unsigned int dac_vol1, dac_vol2; |
| 10384 | |
| 10385 | if (speaker_nid) { |
| 10386 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 10387 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 10388 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10389 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10390 | AMP_IN_UNMUTE(1)); |
| 10391 | snd_hda_codec_write(codec, 0x10, 0, |
| 10392 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 10393 | AMP_IN_UNMUTE(1)); |
| 10394 | } else { |
| 10395 | snd_hda_codec_write(codec, 0x0f, 0, |
| 10396 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10397 | snd_hda_codec_write(codec, 0x10, 0, |
| 10398 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 10399 | } |
| 10400 | |
| 10401 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10402 | if (line_nid == 0x14) |
| 10403 | dac_vol2 = AMP_OUT_ZERO; |
| 10404 | else if (line_nid == 0x15) |
| 10405 | dac_vol1 = AMP_OUT_ZERO; |
| 10406 | if (hp_nid == 0x14) |
| 10407 | dac_vol2 = AMP_OUT_ZERO; |
| 10408 | else if (hp_nid == 0x15) |
| 10409 | dac_vol1 = AMP_OUT_ZERO; |
| 10410 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10411 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10412 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10413 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10414 | |
| 10415 | snd_hda_codec_write(codec, 0x02, 0, |
| 10416 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10417 | snd_hda_codec_write(codec, 0x03, 0, |
| 10418 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10419 | } |
| 10420 | |
| 10421 | /* pcm configuration: identiacal with ALC880 */ |
| 10422 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10423 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10424 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10425 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10426 | |
| 10427 | /* |
| 10428 | * BIOS auto configuration |
| 10429 | */ |
| 10430 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10431 | { |
| 10432 | struct alc_spec *spec = codec->spec; |
| 10433 | int err; |
| 10434 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10435 | |
| 10436 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10437 | alc268_ignore); |
| 10438 | if (err < 0) |
| 10439 | return err; |
| 10440 | if (!spec->autocfg.line_outs) |
| 10441 | return 0; /* can't find valid BIOS pin config */ |
| 10442 | |
| 10443 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10444 | if (err < 0) |
| 10445 | return err; |
| 10446 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10447 | if (err < 0) |
| 10448 | return err; |
| 10449 | |
| 10450 | spec->multiout.max_channels = 2; |
| 10451 | |
| 10452 | /* digital only support output */ |
| 10453 | if (spec->autocfg.dig_out_pin) |
| 10454 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10455 | |
| 10456 | if (spec->kctl_alloc) |
| 10457 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10458 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10459 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10460 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10461 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10462 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10463 | spec->num_mux_defs = 1; |
| 10464 | spec->input_mux = &spec->private_imux; |
| 10465 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10466 | err = alc_auto_add_mic_boost(codec); |
| 10467 | if (err < 0) |
| 10468 | return err; |
| 10469 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10470 | return 1; |
| 10471 | } |
| 10472 | |
| 10473 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10474 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10475 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10476 | |
| 10477 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10478 | static void alc268_auto_init(struct hda_codec *codec) |
| 10479 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10480 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10481 | alc268_auto_init_multi_out(codec); |
| 10482 | alc268_auto_init_hp_out(codec); |
| 10483 | alc268_auto_init_mono_speaker_out(codec); |
| 10484 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10485 | if (spec->unsol_event) |
| 10486 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10487 | } |
| 10488 | |
| 10489 | /* |
| 10490 | * configuration and preset |
| 10491 | */ |
| 10492 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10493 | [ALC267_QUANTA_IL1] = "quanta-il1", |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10494 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10495 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10496 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10497 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10498 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10499 | #ifdef CONFIG_SND_DEBUG |
| 10500 | [ALC268_TEST] = "test", |
| 10501 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10502 | [ALC268_AUTO] = "auto", |
| 10503 | }; |
| 10504 | |
| 10505 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | a0b8f7d | 2008-04-22 19:39:49 +0200 | [diff] [blame] | 10506 | SND_PCI_QUIRK(0x1025, 0x011e, "Acer Aspire 5720z", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10507 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10508 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10509 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10510 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10511 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10512 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10513 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10514 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10515 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Tony Vroon | 378bd6a | 2008-06-04 12:08:30 +0200 | [diff] [blame] | 10516 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10517 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10518 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10519 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10520 | {} |
| 10521 | }; |
| 10522 | |
| 10523 | static struct alc_config_preset alc268_presets[] = { |
Herton Ronaldo Krzesinski | eb5a662 | 2008-04-14 13:46:28 +0200 | [diff] [blame] | 10524 | [ALC267_QUANTA_IL1] = { |
| 10525 | .mixers = { alc267_quanta_il1_mixer }, |
| 10526 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10527 | alc267_quanta_il1_verbs }, |
| 10528 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10529 | .dac_nids = alc268_dac_nids, |
| 10530 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10531 | .adc_nids = alc268_adc_nids_alt, |
| 10532 | .hp_nid = 0x03, |
| 10533 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10534 | .channel_mode = alc268_modes, |
| 10535 | .input_mux = &alc268_capture_source, |
| 10536 | .unsol_event = alc267_quanta_il1_unsol_event, |
| 10537 | .init_hook = alc267_quanta_il1_automute, |
| 10538 | }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10539 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10540 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10541 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10542 | .init_verbs = { alc268_base_init_verbs }, |
| 10543 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10544 | .dac_nids = alc268_dac_nids, |
| 10545 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10546 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10547 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10548 | .hp_nid = 0x03, |
| 10549 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10550 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10551 | .channel_mode = alc268_modes, |
| 10552 | .input_mux = &alc268_capture_source, |
| 10553 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10554 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10555 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10556 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10557 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10558 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10559 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10560 | .dac_nids = alc268_dac_nids, |
| 10561 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10562 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10563 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10564 | .hp_nid = 0x03, |
| 10565 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10566 | .channel_mode = alc268_modes, |
| 10567 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10568 | .unsol_event = alc268_toshiba_unsol_event, |
| 10569 | .init_hook = alc268_toshiba_automute, |
| 10570 | }, |
| 10571 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10572 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10573 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10574 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10575 | alc268_acer_verbs }, |
| 10576 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10577 | .dac_nids = alc268_dac_nids, |
| 10578 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10579 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10580 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10581 | .hp_nid = 0x02, |
| 10582 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10583 | .channel_mode = alc268_modes, |
Takashi Iwai | 0ccb541 | 2008-03-06 16:58:35 +0100 | [diff] [blame] | 10584 | .input_mux = &alc268_acer_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10585 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10586 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10587 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10588 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10589 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10590 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10591 | alc268_dell_verbs }, |
| 10592 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10593 | .dac_nids = alc268_dac_nids, |
| 10594 | .hp_nid = 0x02, |
| 10595 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10596 | .channel_mode = alc268_modes, |
| 10597 | .unsol_event = alc268_dell_unsol_event, |
| 10598 | .init_hook = alc268_dell_init_hook, |
| 10599 | .input_mux = &alc268_capture_source, |
| 10600 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10601 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10602 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10603 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10604 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10605 | alc268_toshiba_verbs }, |
| 10606 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10607 | .dac_nids = alc268_dac_nids, |
| 10608 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10609 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10610 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10611 | .hp_nid = 0x03, |
| 10612 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10613 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10614 | .channel_mode = alc268_modes, |
| 10615 | .input_mux = &alc268_capture_source, |
| 10616 | .unsol_event = alc268_toshiba_unsol_event, |
| 10617 | .init_hook = alc268_toshiba_automute |
| 10618 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10619 | #ifdef CONFIG_SND_DEBUG |
| 10620 | [ALC268_TEST] = { |
| 10621 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10622 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10623 | alc268_volume_init_verbs }, |
| 10624 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10625 | .dac_nids = alc268_dac_nids, |
| 10626 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10627 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10628 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10629 | .hp_nid = 0x03, |
| 10630 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10631 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10632 | .channel_mode = alc268_modes, |
| 10633 | .input_mux = &alc268_capture_source, |
| 10634 | }, |
| 10635 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10636 | }; |
| 10637 | |
| 10638 | static int patch_alc268(struct hda_codec *codec) |
| 10639 | { |
| 10640 | struct alc_spec *spec; |
| 10641 | int board_config; |
| 10642 | int err; |
| 10643 | |
| 10644 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10645 | if (spec == NULL) |
| 10646 | return -ENOMEM; |
| 10647 | |
| 10648 | codec->spec = spec; |
| 10649 | |
| 10650 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10651 | alc268_models, |
| 10652 | alc268_cfg_tbl); |
| 10653 | |
| 10654 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10655 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10656 | "trying auto-probe from BIOS...\n"); |
| 10657 | board_config = ALC268_AUTO; |
| 10658 | } |
| 10659 | |
| 10660 | if (board_config == ALC268_AUTO) { |
| 10661 | /* automatic parse from the BIOS config */ |
| 10662 | err = alc268_parse_auto_config(codec); |
| 10663 | if (err < 0) { |
| 10664 | alc_free(codec); |
| 10665 | return err; |
| 10666 | } else if (!err) { |
| 10667 | printk(KERN_INFO |
| 10668 | "hda_codec: Cannot set up configuration " |
| 10669 | "from BIOS. Using base mode...\n"); |
| 10670 | board_config = ALC268_3ST; |
| 10671 | } |
| 10672 | } |
| 10673 | |
| 10674 | if (board_config != ALC268_AUTO) |
| 10675 | setup_preset(spec, &alc268_presets[board_config]); |
| 10676 | |
| 10677 | spec->stream_name_analog = "ALC268 Analog"; |
| 10678 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10679 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10680 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10681 | |
| 10682 | spec->stream_name_digital = "ALC268 Digital"; |
| 10683 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10684 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame] | 10685 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10686 | /* override the amp caps for beep generator */ |
| 10687 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10688 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10689 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10690 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10691 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10692 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10693 | if (!spec->adc_nids && spec->input_mux) { |
| 10694 | /* check whether NID 0x07 is valid */ |
| 10695 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10696 | int i; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10697 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10698 | /* get type */ |
| 10699 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | 67ebcb0 | 2008-02-19 15:03:57 +0100 | [diff] [blame] | 10700 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10701 | spec->adc_nids = alc268_adc_nids_alt; |
| 10702 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10703 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10704 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10705 | spec->num_mixers++; |
| 10706 | } else { |
| 10707 | spec->adc_nids = alc268_adc_nids; |
| 10708 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10709 | spec->mixers[spec->num_mixers] = |
| 10710 | alc268_capture_mixer; |
| 10711 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10712 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10713 | spec->capsrc_nids = alc268_capsrc_nids; |
Takashi Iwai | 85860c0 | 2008-02-19 15:00:15 +0100 | [diff] [blame] | 10714 | /* set default input source */ |
| 10715 | for (i = 0; i < spec->num_adc_nids; i++) |
| 10716 | snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], |
| 10717 | 0, AC_VERB_SET_CONNECT_SEL, |
| 10718 | spec->input_mux->items[0].index); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10719 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10720 | |
| 10721 | spec->vmaster_nid = 0x02; |
| 10722 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10723 | codec->patch_ops = alc_patch_ops; |
| 10724 | if (board_config == ALC268_AUTO) |
| 10725 | spec->init_hook = alc268_auto_init; |
| 10726 | |
| 10727 | return 0; |
| 10728 | } |
| 10729 | |
| 10730 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10731 | * ALC269 channel source setting (2 channel) |
| 10732 | */ |
| 10733 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10734 | |
| 10735 | #define alc269_dac_nids alc260_dac_nids |
| 10736 | |
| 10737 | static hda_nid_t alc269_adc_nids[1] = { |
| 10738 | /* ADC1 */ |
| 10739 | 0x07, |
| 10740 | }; |
| 10741 | |
| 10742 | #define alc269_modes alc260_modes |
| 10743 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10744 | |
| 10745 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10747 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10749 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10750 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10751 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10752 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10753 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10754 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10755 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10756 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10757 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10758 | { } /* end */ |
| 10759 | }; |
| 10760 | |
| 10761 | /* capture mixer elements */ |
| 10762 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10763 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10764 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10765 | { |
| 10766 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10767 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10768 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10769 | */ |
| 10770 | /* .name = "Capture Source", */ |
| 10771 | .name = "Input Source", |
| 10772 | .count = 1, |
| 10773 | .info = alc_mux_enum_info, |
| 10774 | .get = alc_mux_enum_get, |
| 10775 | .put = alc_mux_enum_put, |
| 10776 | }, |
| 10777 | { } /* end */ |
| 10778 | }; |
| 10779 | |
| 10780 | /* |
| 10781 | * generic initialization of ADC, input mixers and output mixers |
| 10782 | */ |
| 10783 | static struct hda_verb alc269_init_verbs[] = { |
| 10784 | /* |
| 10785 | * Unmute ADC0 and set the default input to mic-in |
| 10786 | */ |
| 10787 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10788 | |
| 10789 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10790 | * analog-loopback mixer widget |
| 10791 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10792 | * front panel mic (mic 2) |
| 10793 | */ |
| 10794 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10795 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10796 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10797 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10798 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10799 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10800 | |
| 10801 | /* |
| 10802 | * Set up output mixers (0x0c - 0x0e) |
| 10803 | */ |
| 10804 | /* set vol=0 to output mixers */ |
| 10805 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10806 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10807 | |
| 10808 | /* set up input amps for analog loopback */ |
| 10809 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10811 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10812 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10813 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10814 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10816 | |
| 10817 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10818 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10819 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10820 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10822 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10823 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10824 | |
| 10825 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10826 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10827 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10828 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10829 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10830 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10831 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10832 | |
| 10833 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10834 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10835 | |
| 10836 | /* FIXME: use matrix-type input source selection */ |
| 10837 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10838 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10839 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10840 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10841 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10842 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10843 | |
| 10844 | /* set EAPD */ |
| 10845 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10846 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10847 | { } |
| 10848 | }; |
| 10849 | |
| 10850 | /* add playback controls from the parsed DAC table */ |
| 10851 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10852 | const struct auto_pin_cfg *cfg) |
| 10853 | { |
| 10854 | hda_nid_t nid; |
| 10855 | int err; |
| 10856 | |
| 10857 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10858 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10859 | spec->multiout.dac_nids[0] = 2; |
| 10860 | |
| 10861 | nid = cfg->line_out_pins[0]; |
| 10862 | if (nid) { |
| 10863 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10864 | "Front Playback Volume", |
| 10865 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10866 | if (err < 0) |
| 10867 | return err; |
| 10868 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10869 | "Front Playback Switch", |
| 10870 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10871 | if (err < 0) |
| 10872 | return err; |
| 10873 | } |
| 10874 | |
| 10875 | nid = cfg->speaker_pins[0]; |
| 10876 | if (nid) { |
| 10877 | if (!cfg->line_out_pins[0]) { |
| 10878 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10879 | "Speaker Playback Volume", |
| 10880 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10881 | HDA_OUTPUT)); |
| 10882 | if (err < 0) |
| 10883 | return err; |
| 10884 | } |
| 10885 | if (nid == 0x16) { |
| 10886 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10887 | "Speaker Playback Switch", |
| 10888 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10889 | HDA_OUTPUT)); |
| 10890 | if (err < 0) |
| 10891 | return err; |
| 10892 | } else { |
| 10893 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10894 | "Speaker Playback Switch", |
| 10895 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10896 | HDA_OUTPUT)); |
| 10897 | if (err < 0) |
| 10898 | return err; |
| 10899 | } |
| 10900 | } |
| 10901 | nid = cfg->hp_pins[0]; |
| 10902 | if (nid) { |
| 10903 | /* spec->multiout.hp_nid = 2; */ |
| 10904 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10905 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10906 | "Headphone Playback Volume", |
| 10907 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10908 | HDA_OUTPUT)); |
| 10909 | if (err < 0) |
| 10910 | return err; |
| 10911 | } |
| 10912 | if (nid == 0x16) { |
| 10913 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10914 | "Headphone Playback Switch", |
| 10915 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10916 | HDA_OUTPUT)); |
| 10917 | if (err < 0) |
| 10918 | return err; |
| 10919 | } else { |
| 10920 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10921 | "Headphone Playback Switch", |
| 10922 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10923 | HDA_OUTPUT)); |
| 10924 | if (err < 0) |
| 10925 | return err; |
| 10926 | } |
| 10927 | } |
| 10928 | return 0; |
| 10929 | } |
| 10930 | |
| 10931 | #define alc269_auto_create_analog_input_ctls \ |
| 10932 | alc880_auto_create_analog_input_ctls |
| 10933 | |
| 10934 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10935 | #define alc269_loopbacks alc880_loopbacks |
| 10936 | #endif |
| 10937 | |
| 10938 | /* pcm configuration: identiacal with ALC880 */ |
| 10939 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10940 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10941 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10942 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10943 | |
| 10944 | /* |
| 10945 | * BIOS auto configuration |
| 10946 | */ |
| 10947 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10948 | { |
| 10949 | struct alc_spec *spec = codec->spec; |
| 10950 | int err; |
| 10951 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10952 | |
| 10953 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10954 | alc269_ignore); |
| 10955 | if (err < 0) |
| 10956 | return err; |
| 10957 | |
| 10958 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10959 | if (err < 0) |
| 10960 | return err; |
| 10961 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10962 | if (err < 0) |
| 10963 | return err; |
| 10964 | |
| 10965 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10966 | |
| 10967 | if (spec->autocfg.dig_out_pin) |
| 10968 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10969 | |
| 10970 | if (spec->kctl_alloc) |
| 10971 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10972 | |
| 10973 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10974 | spec->num_mux_defs = 1; |
| 10975 | spec->input_mux = &spec->private_imux; |
| 10976 | |
| 10977 | err = alc_auto_add_mic_boost(codec); |
| 10978 | if (err < 0) |
| 10979 | return err; |
| 10980 | |
| 10981 | return 1; |
| 10982 | } |
| 10983 | |
| 10984 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10985 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10986 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10987 | |
| 10988 | |
| 10989 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10990 | static void alc269_auto_init(struct hda_codec *codec) |
| 10991 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10992 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10993 | alc269_auto_init_multi_out(codec); |
| 10994 | alc269_auto_init_hp_out(codec); |
| 10995 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10996 | if (spec->unsol_event) |
| 10997 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10998 | } |
| 10999 | |
| 11000 | /* |
| 11001 | * configuration and preset |
| 11002 | */ |
| 11003 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 11004 | [ALC269_BASIC] = "basic", |
| 11005 | }; |
| 11006 | |
| 11007 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 11008 | {} |
| 11009 | }; |
| 11010 | |
| 11011 | static struct alc_config_preset alc269_presets[] = { |
| 11012 | [ALC269_BASIC] = { |
| 11013 | .mixers = { alc269_base_mixer }, |
| 11014 | .init_verbs = { alc269_init_verbs }, |
| 11015 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 11016 | .dac_nids = alc269_dac_nids, |
| 11017 | .hp_nid = 0x03, |
| 11018 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 11019 | .channel_mode = alc269_modes, |
| 11020 | .input_mux = &alc269_capture_source, |
| 11021 | }, |
| 11022 | }; |
| 11023 | |
| 11024 | static int patch_alc269(struct hda_codec *codec) |
| 11025 | { |
| 11026 | struct alc_spec *spec; |
| 11027 | int board_config; |
| 11028 | int err; |
| 11029 | |
| 11030 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 11031 | if (spec == NULL) |
| 11032 | return -ENOMEM; |
| 11033 | |
| 11034 | codec->spec = spec; |
| 11035 | |
| 11036 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 11037 | alc269_models, |
| 11038 | alc269_cfg_tbl); |
| 11039 | |
| 11040 | if (board_config < 0) { |
| 11041 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 11042 | "trying auto-probe from BIOS...\n"); |
| 11043 | board_config = ALC269_AUTO; |
| 11044 | } |
| 11045 | |
| 11046 | if (board_config == ALC269_AUTO) { |
| 11047 | /* automatic parse from the BIOS config */ |
| 11048 | err = alc269_parse_auto_config(codec); |
| 11049 | if (err < 0) { |
| 11050 | alc_free(codec); |
| 11051 | return err; |
| 11052 | } else if (!err) { |
| 11053 | printk(KERN_INFO |
| 11054 | "hda_codec: Cannot set up configuration " |
| 11055 | "from BIOS. Using base mode...\n"); |
| 11056 | board_config = ALC269_BASIC; |
| 11057 | } |
| 11058 | } |
| 11059 | |
| 11060 | if (board_config != ALC269_AUTO) |
| 11061 | setup_preset(spec, &alc269_presets[board_config]); |
| 11062 | |
| 11063 | spec->stream_name_analog = "ALC269 Analog"; |
| 11064 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 11065 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 11066 | |
| 11067 | spec->stream_name_digital = "ALC269 Digital"; |
| 11068 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 11069 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 11070 | |
| 11071 | spec->adc_nids = alc269_adc_nids; |
| 11072 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 11073 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 11074 | spec->num_mixers++; |
| 11075 | |
| 11076 | codec->patch_ops = alc_patch_ops; |
| 11077 | if (board_config == ALC269_AUTO) |
| 11078 | spec->init_hook = alc269_auto_init; |
| 11079 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11080 | if (!spec->loopback.amplist) |
| 11081 | spec->loopback.amplist = alc269_loopbacks; |
| 11082 | #endif |
| 11083 | |
| 11084 | return 0; |
| 11085 | } |
| 11086 | |
| 11087 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11088 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 11089 | */ |
| 11090 | |
| 11091 | /* |
| 11092 | * set the path ways for 2 channel output |
| 11093 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 11094 | */ |
| 11095 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 11096 | /* set pin widget 1Ah (line in) for input */ |
| 11097 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11098 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11099 | * the vref |
| 11100 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11101 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11102 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11103 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11104 | #if 0 |
| 11105 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11106 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11107 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11108 | { } /* end */ |
| 11109 | }; |
| 11110 | /* |
| 11111 | * 6ch mode |
| 11112 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 11113 | */ |
| 11114 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 11115 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11116 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11117 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11118 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11119 | |
| 11120 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11121 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11122 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11123 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11124 | #if 0 |
| 11125 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11126 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11127 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11128 | { } /* end */ |
| 11129 | }; |
| 11130 | |
| 11131 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 11132 | { 2, alc861_threestack_ch2_init }, |
| 11133 | { 6, alc861_threestack_ch6_init }, |
| 11134 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11135 | /* Set mic1 as input and unmute the mixer */ |
| 11136 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 11137 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11138 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11139 | { } /* end */ |
| 11140 | }; |
| 11141 | /* Set mic1 as output and mute mixer */ |
| 11142 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 11143 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11144 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11145 | { } /* end */ |
| 11146 | }; |
| 11147 | |
| 11148 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 11149 | { 2, alc861_uniwill_m31_ch2_init }, |
| 11150 | { 4, alc861_uniwill_m31_ch4_init }, |
| 11151 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11152 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11153 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 11154 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 11155 | /* set pin widget 1Ah (line in) for input */ |
| 11156 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11157 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 11158 | * the vref |
| 11159 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11160 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11161 | |
| 11162 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 11163 | #if 0 |
| 11164 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 11165 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 11166 | #endif |
| 11167 | { } /* end */ |
| 11168 | }; |
| 11169 | /* Set mic1 nad line-in as output and mute mixer */ |
| 11170 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 11171 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 11172 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11173 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11174 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 11175 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11176 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 11177 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11178 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11179 | |
| 11180 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 11181 | #if 0 |
| 11182 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 11183 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 11184 | #endif |
| 11185 | { } /* end */ |
| 11186 | }; |
| 11187 | |
| 11188 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 11189 | { 2, alc861_asus_ch2_init }, |
| 11190 | { 6, alc861_asus_ch6_init }, |
| 11191 | }; |
| 11192 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11193 | /* patch-ALC861 */ |
| 11194 | |
| 11195 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 11196 | /* output mixer control */ |
| 11197 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11198 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11199 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11200 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11201 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11202 | |
| 11203 | /*Input mixer control */ |
| 11204 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11205 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11206 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11207 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11209 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11212 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11213 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11215 | /* Capture mixer control */ |
| 11216 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11217 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11218 | { |
| 11219 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11220 | .name = "Capture Source", |
| 11221 | .count = 1, |
| 11222 | .info = alc_mux_enum_info, |
| 11223 | .get = alc_mux_enum_get, |
| 11224 | .put = alc_mux_enum_put, |
| 11225 | }, |
| 11226 | { } /* end */ |
| 11227 | }; |
| 11228 | |
| 11229 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 11230 | /* output mixer control */ |
| 11231 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11232 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11233 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11234 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11235 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11236 | |
| 11237 | /* Input mixer control */ |
| 11238 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11239 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11240 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11241 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11242 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11243 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11244 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11245 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11246 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11247 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11248 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11249 | /* Capture mixer control */ |
| 11250 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11251 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11252 | { |
| 11253 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11254 | .name = "Capture Source", |
| 11255 | .count = 1, |
| 11256 | .info = alc_mux_enum_info, |
| 11257 | .get = alc_mux_enum_get, |
| 11258 | .put = alc_mux_enum_put, |
| 11259 | }, |
| 11260 | { |
| 11261 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11262 | .name = "Channel Mode", |
| 11263 | .info = alc_ch_mode_info, |
| 11264 | .get = alc_ch_mode_get, |
| 11265 | .put = alc_ch_mode_put, |
| 11266 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 11267 | }, |
| 11268 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11269 | }; |
| 11270 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11271 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11272 | /* output mixer control */ |
| 11273 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11274 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11275 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11276 | |
| 11277 | /*Capture mixer control */ |
| 11278 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11279 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11280 | { |
| 11281 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11282 | .name = "Capture Source", |
| 11283 | .count = 1, |
| 11284 | .info = alc_mux_enum_info, |
| 11285 | .get = alc_mux_enum_get, |
| 11286 | .put = alc_mux_enum_put, |
| 11287 | }, |
| 11288 | |
| 11289 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11290 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11291 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11292 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 11293 | /* output mixer control */ |
| 11294 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11295 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11296 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11297 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11298 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 11299 | |
| 11300 | /* Input mixer control */ |
| 11301 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11302 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 11303 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11304 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11305 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11306 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11307 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11308 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11309 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 11310 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11311 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11312 | /* Capture mixer control */ |
| 11313 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11314 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11315 | { |
| 11316 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11317 | .name = "Capture Source", |
| 11318 | .count = 1, |
| 11319 | .info = alc_mux_enum_info, |
| 11320 | .get = alc_mux_enum_get, |
| 11321 | .put = alc_mux_enum_put, |
| 11322 | }, |
| 11323 | { |
| 11324 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11325 | .name = "Channel Mode", |
| 11326 | .info = alc_ch_mode_info, |
| 11327 | .get = alc_ch_mode_get, |
| 11328 | .put = alc_ch_mode_put, |
| 11329 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11330 | }, |
| 11331 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11332 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11333 | |
| 11334 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 11335 | /* output mixer control */ |
| 11336 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 11337 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 11338 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 11339 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 11340 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 11341 | |
| 11342 | /* Input mixer control */ |
| 11343 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 11344 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 11345 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11346 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11347 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 11348 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 11349 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 11350 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 11351 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11352 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 11353 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11354 | /* Capture mixer control */ |
| 11355 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11356 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11357 | { |
| 11358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11359 | .name = "Capture Source", |
| 11360 | .count = 1, |
| 11361 | .info = alc_mux_enum_info, |
| 11362 | .get = alc_mux_enum_get, |
| 11363 | .put = alc_mux_enum_put, |
| 11364 | }, |
| 11365 | { |
| 11366 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11367 | .name = "Channel Mode", |
| 11368 | .info = alc_ch_mode_info, |
| 11369 | .get = alc_ch_mode_get, |
| 11370 | .put = alc_ch_mode_put, |
| 11371 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 11372 | }, |
| 11373 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11374 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11375 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11376 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 11377 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11378 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 11379 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 11380 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 11381 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 11382 | { } |
| 11383 | }; |
| 11384 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11385 | /* |
| 11386 | * generic initialization of ADC, input mixers and output mixers |
| 11387 | */ |
| 11388 | static struct hda_verb alc861_base_init_verbs[] = { |
| 11389 | /* |
| 11390 | * Unmute ADC0 and set the default input to mic-in |
| 11391 | */ |
| 11392 | /* port-A for surround (rear panel) */ |
| 11393 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11394 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11395 | /* port-B for mic-in (rear panel) with vref */ |
| 11396 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11397 | /* port-C for line-in (rear panel) */ |
| 11398 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11399 | /* port-D for Front */ |
| 11400 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11401 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11402 | /* port-E for HP out (front panel) */ |
| 11403 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11404 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11405 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11406 | /* port-F for mic-in (front panel) with vref */ |
| 11407 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11408 | /* port-G for CLFE (rear panel) */ |
| 11409 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11410 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11411 | /* port-H for side (rear panel) */ |
| 11412 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11413 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11414 | /* CD-in */ |
| 11415 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11416 | /* route front mic to ADC1*/ |
| 11417 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11418 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11419 | |
| 11420 | /* Unmute DAC0~3 & spdif out*/ |
| 11421 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11422 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11423 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11424 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11425 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11426 | |
| 11427 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11428 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11429 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11430 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11431 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11432 | |
| 11433 | /* Unmute Stereo Mixer 15 */ |
| 11434 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11435 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11436 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11437 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11438 | |
| 11439 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11440 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11441 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11442 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11443 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11444 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11445 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11446 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | /* hp used DAC 3 (Front) */ |
| 11448 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11449 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11450 | |
| 11451 | { } |
| 11452 | }; |
| 11453 | |
| 11454 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11455 | /* |
| 11456 | * Unmute ADC0 and set the default input to mic-in |
| 11457 | */ |
| 11458 | /* port-A for surround (rear panel) */ |
| 11459 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11460 | /* port-B for mic-in (rear panel) with vref */ |
| 11461 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11462 | /* port-C for line-in (rear panel) */ |
| 11463 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11464 | /* port-D for Front */ |
| 11465 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11466 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11467 | /* port-E for HP out (front panel) */ |
| 11468 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11469 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11470 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11471 | /* port-F for mic-in (front panel) with vref */ |
| 11472 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11473 | /* port-G for CLFE (rear panel) */ |
| 11474 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11475 | /* port-H for side (rear panel) */ |
| 11476 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11477 | /* CD-in */ |
| 11478 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11479 | /* route front mic to ADC1*/ |
| 11480 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11481 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11482 | /* Unmute DAC0~3 & spdif out*/ |
| 11483 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11484 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11485 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11486 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11487 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11488 | |
| 11489 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11490 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11491 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11492 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11493 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11494 | |
| 11495 | /* Unmute Stereo Mixer 15 */ |
| 11496 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11497 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11498 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11499 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11500 | |
| 11501 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11502 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11503 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11504 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11505 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11506 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11507 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11508 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11509 | /* hp used DAC 3 (Front) */ |
| 11510 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11511 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11512 | { } |
| 11513 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11514 | |
| 11515 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11516 | /* |
| 11517 | * Unmute ADC0 and set the default input to mic-in |
| 11518 | */ |
| 11519 | /* port-A for surround (rear panel) */ |
| 11520 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11521 | /* port-B for mic-in (rear panel) with vref */ |
| 11522 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11523 | /* port-C for line-in (rear panel) */ |
| 11524 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11525 | /* port-D for Front */ |
| 11526 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11527 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11528 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11529 | /* this has to be set to VREF80 */ |
| 11530 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11531 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11532 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11533 | /* port-F for mic-in (front panel) with vref */ |
| 11534 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11535 | /* port-G for CLFE (rear panel) */ |
| 11536 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11537 | /* port-H for side (rear panel) */ |
| 11538 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11539 | /* CD-in */ |
| 11540 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11541 | /* route front mic to ADC1*/ |
| 11542 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11543 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11544 | /* Unmute DAC0~3 & spdif out*/ |
| 11545 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11546 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11547 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11548 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11550 | |
| 11551 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11552 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11553 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11554 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11555 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11556 | |
| 11557 | /* Unmute Stereo Mixer 15 */ |
| 11558 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11559 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11560 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11561 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11562 | |
| 11563 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11564 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11565 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11566 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11567 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11568 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11569 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11570 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11571 | /* hp used DAC 3 (Front) */ |
| 11572 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11573 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11574 | { } |
| 11575 | }; |
| 11576 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11577 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11578 | /* |
| 11579 | * Unmute ADC0 and set the default input to mic-in |
| 11580 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11581 | /* port-A for surround (rear panel) |
| 11582 | * according to codec#0 this is the HP jack |
| 11583 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11584 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11585 | /* route front PCM to HP */ |
| 11586 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11587 | /* port-B for mic-in (rear panel) with vref */ |
| 11588 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11589 | /* port-C for line-in (rear panel) */ |
| 11590 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11591 | /* port-D for Front */ |
| 11592 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11593 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11594 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11595 | /* this has to be set to VREF80 */ |
| 11596 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11597 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11598 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11599 | /* port-F for mic-in (front panel) with vref */ |
| 11600 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11601 | /* port-G for CLFE (rear panel) */ |
| 11602 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11603 | /* port-H for side (rear panel) */ |
| 11604 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11605 | /* CD-in */ |
| 11606 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11607 | /* route front mic to ADC1*/ |
| 11608 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11609 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11610 | /* Unmute DAC0~3 & spdif out*/ |
| 11611 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11612 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11613 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11614 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11615 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11616 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11617 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11618 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11619 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11620 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11621 | |
| 11622 | /* Unmute Stereo Mixer 15 */ |
| 11623 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11624 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11625 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11626 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11627 | |
| 11628 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11629 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11630 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11631 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11632 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11633 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11634 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11635 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11636 | /* hp used DAC 3 (Front) */ |
| 11637 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11638 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11639 | { } |
| 11640 | }; |
| 11641 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11642 | /* additional init verbs for ASUS laptops */ |
| 11643 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11644 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11645 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11646 | { } |
| 11647 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11648 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11649 | /* |
| 11650 | * generic initialization of ADC, input mixers and output mixers |
| 11651 | */ |
| 11652 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11653 | /* |
| 11654 | * Unmute ADC0 and set the default input to mic-in |
| 11655 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11656 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11657 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11658 | |
| 11659 | /* Unmute DAC0~3 & spdif out*/ |
| 11660 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11661 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11662 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11663 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11664 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11665 | |
| 11666 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11667 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11668 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11669 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11670 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11671 | |
| 11672 | /* Unmute Stereo Mixer 15 */ |
| 11673 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11674 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11675 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11676 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11677 | |
| 11678 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11679 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11680 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11681 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11682 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11683 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11684 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11685 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11686 | |
| 11687 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11688 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11689 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11690 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11691 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11692 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11693 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11694 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11695 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11696 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11697 | |
| 11698 | { } |
| 11699 | }; |
| 11700 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11701 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11702 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11703 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11704 | { } |
| 11705 | }; |
| 11706 | |
| 11707 | /* toggle speaker-output according to the hp-jack state */ |
| 11708 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11709 | { |
| 11710 | unsigned int present; |
| 11711 | |
| 11712 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11713 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11714 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11715 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11716 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11717 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11718 | } |
| 11719 | |
| 11720 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11721 | unsigned int res) |
| 11722 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11723 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11724 | alc861_toshiba_automute(codec); |
| 11725 | } |
| 11726 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11727 | /* pcm configuration: identiacal with ALC880 */ |
| 11728 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11729 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11730 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11731 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11732 | |
| 11733 | |
| 11734 | #define ALC861_DIGOUT_NID 0x07 |
| 11735 | |
| 11736 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11737 | { 8, NULL } |
| 11738 | }; |
| 11739 | |
| 11740 | static hda_nid_t alc861_dac_nids[4] = { |
| 11741 | /* front, surround, clfe, side */ |
| 11742 | 0x03, 0x06, 0x05, 0x04 |
| 11743 | }; |
| 11744 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11745 | static hda_nid_t alc660_dac_nids[3] = { |
| 11746 | /* front, clfe, surround */ |
| 11747 | 0x03, 0x05, 0x06 |
| 11748 | }; |
| 11749 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11750 | static hda_nid_t alc861_adc_nids[1] = { |
| 11751 | /* ADC0-2 */ |
| 11752 | 0x08, |
| 11753 | }; |
| 11754 | |
| 11755 | static struct hda_input_mux alc861_capture_source = { |
| 11756 | .num_items = 5, |
| 11757 | .items = { |
| 11758 | { "Mic", 0x0 }, |
| 11759 | { "Front Mic", 0x3 }, |
| 11760 | { "Line", 0x1 }, |
| 11761 | { "CD", 0x4 }, |
| 11762 | { "Mixer", 0x5 }, |
| 11763 | }, |
| 11764 | }; |
| 11765 | |
| 11766 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11767 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11768 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11769 | { |
| 11770 | int i; |
| 11771 | hda_nid_t nid; |
| 11772 | |
| 11773 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11774 | for (i = 0; i < cfg->line_outs; i++) { |
| 11775 | nid = cfg->line_out_pins[i]; |
| 11776 | if (nid) { |
| 11777 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11778 | continue; |
| 11779 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11780 | } |
| 11781 | } |
| 11782 | spec->multiout.num_dacs = cfg->line_outs; |
| 11783 | return 0; |
| 11784 | } |
| 11785 | |
| 11786 | /* add playback controls from the parsed DAC table */ |
| 11787 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11788 | const struct auto_pin_cfg *cfg) |
| 11789 | { |
| 11790 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11791 | static const char *chname[4] = { |
| 11792 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11793 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11794 | hda_nid_t nid; |
| 11795 | int i, idx, err; |
| 11796 | |
| 11797 | for (i = 0; i < cfg->line_outs; i++) { |
| 11798 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11799 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11800 | continue; |
| 11801 | if (nid == 0x05) { |
| 11802 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11803 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11804 | "Center Playback Switch", |
| 11805 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11806 | HDA_OUTPUT)); |
| 11807 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11808 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11809 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11810 | "LFE Playback Switch", |
| 11811 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11812 | HDA_OUTPUT)); |
| 11813 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11814 | return err; |
| 11815 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11816 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11817 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11818 | if (nid == alc861_dac_nids[idx]) |
| 11819 | break; |
| 11820 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11821 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11822 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11823 | HDA_OUTPUT)); |
| 11824 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11825 | return err; |
| 11826 | } |
| 11827 | } |
| 11828 | return 0; |
| 11829 | } |
| 11830 | |
| 11831 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11832 | { |
| 11833 | int err; |
| 11834 | hda_nid_t nid; |
| 11835 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11836 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11837 | return 0; |
| 11838 | |
| 11839 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11840 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11841 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11842 | "Headphone Playback Switch", |
| 11843 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11844 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11845 | return err; |
| 11846 | spec->multiout.hp_nid = nid; |
| 11847 | } |
| 11848 | return 0; |
| 11849 | } |
| 11850 | |
| 11851 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11852 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11853 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11854 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11855 | struct hda_input_mux *imux = &spec->private_imux; |
| 11856 | int i, err, idx, idx1; |
| 11857 | |
| 11858 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11859 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11860 | case 0x0c: |
| 11861 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11862 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11863 | break; |
| 11864 | case 0x0f: |
| 11865 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11866 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11867 | break; |
| 11868 | case 0x0d: |
| 11869 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11870 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11871 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11872 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11873 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11874 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11875 | break; |
| 11876 | case 0x11: |
| 11877 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11878 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11879 | break; |
| 11880 | default: |
| 11881 | continue; |
| 11882 | } |
| 11883 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11884 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11885 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11886 | if (err < 0) |
| 11887 | return err; |
| 11888 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11889 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11890 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11891 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11892 | } |
| 11893 | return 0; |
| 11894 | } |
| 11895 | |
| 11896 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11897 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11898 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11899 | |
| 11900 | { |
| 11901 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11902 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11903 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11904 | */ |
| 11905 | /* .name = "Capture Source", */ |
| 11906 | .name = "Input Source", |
| 11907 | .count = 1, |
| 11908 | .info = alc_mux_enum_info, |
| 11909 | .get = alc_mux_enum_get, |
| 11910 | .put = alc_mux_enum_put, |
| 11911 | }, |
| 11912 | { } /* end */ |
| 11913 | }; |
| 11914 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11915 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11916 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11917 | int pin_type, int dac_idx) |
| 11918 | { |
Jacek Luczak | 564c5be | 2008-05-03 18:41:23 +0200 | [diff] [blame] | 11919 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11920 | pin_type); |
| 11921 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11922 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11923 | } |
| 11924 | |
| 11925 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11926 | { |
| 11927 | struct alc_spec *spec = codec->spec; |
| 11928 | int i; |
| 11929 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11930 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11931 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11932 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11933 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11934 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11935 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11936 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11937 | } |
| 11938 | } |
| 11939 | |
| 11940 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11941 | { |
| 11942 | struct alc_spec *spec = codec->spec; |
| 11943 | hda_nid_t pin; |
| 11944 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11945 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11946 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11947 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11948 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11949 | pin = spec->autocfg.speaker_pins[0]; |
| 11950 | if (pin) |
| 11951 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11952 | } |
| 11953 | |
| 11954 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11955 | { |
| 11956 | struct alc_spec *spec = codec->spec; |
| 11957 | int i; |
| 11958 | |
| 11959 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11960 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11961 | if (nid >= 0x0c && nid <= 0x11) { |
| 11962 | snd_hda_codec_write(codec, nid, 0, |
| 11963 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11964 | i <= AUTO_PIN_FRONT_MIC ? |
| 11965 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11966 | } |
| 11967 | } |
| 11968 | } |
| 11969 | |
| 11970 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11971 | /* return 1 if successful, 0 if the proper config is not found, |
| 11972 | * or a negative error code |
| 11973 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11974 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11975 | { |
| 11976 | struct alc_spec *spec = codec->spec; |
| 11977 | int err; |
| 11978 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11979 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11980 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11981 | alc861_ignore); |
| 11982 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11983 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11984 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11985 | return 0; /* can't find valid BIOS pin config */ |
| 11986 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11987 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11988 | if (err < 0) |
| 11989 | return err; |
| 11990 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11991 | if (err < 0) |
| 11992 | return err; |
| 11993 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11994 | if (err < 0) |
| 11995 | return err; |
| 11996 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11997 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11998 | return err; |
| 11999 | |
| 12000 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12001 | |
| 12002 | if (spec->autocfg.dig_out_pin) |
| 12003 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 12004 | |
| 12005 | if (spec->kctl_alloc) |
| 12006 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12007 | |
| 12008 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 12009 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 12010 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12011 | spec->input_mux = &spec->private_imux; |
| 12012 | |
| 12013 | spec->adc_nids = alc861_adc_nids; |
| 12014 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 12015 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 12016 | spec->num_mixers++; |
| 12017 | |
| 12018 | return 1; |
| 12019 | } |
| 12020 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12021 | /* additional initialization for auto-configuration model */ |
| 12022 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12023 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12024 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12025 | alc861_auto_init_multi_out(codec); |
| 12026 | alc861_auto_init_hp_out(codec); |
| 12027 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12028 | if (spec->unsol_event) |
| 12029 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12030 | } |
| 12031 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12032 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12033 | static struct hda_amp_list alc861_loopbacks[] = { |
| 12034 | { 0x15, HDA_INPUT, 0 }, |
| 12035 | { 0x15, HDA_INPUT, 1 }, |
| 12036 | { 0x15, HDA_INPUT, 2 }, |
| 12037 | { 0x15, HDA_INPUT, 3 }, |
| 12038 | { } /* end */ |
| 12039 | }; |
| 12040 | #endif |
| 12041 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12042 | |
| 12043 | /* |
| 12044 | * configuration and preset |
| 12045 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12046 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 12047 | [ALC861_3ST] = "3stack", |
| 12048 | [ALC660_3ST] = "3stack-660", |
| 12049 | [ALC861_3ST_DIG] = "3stack-dig", |
| 12050 | [ALC861_6ST_DIG] = "6stack-dig", |
| 12051 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 12052 | [ALC861_TOSHIBA] = "toshiba", |
| 12053 | [ALC861_ASUS] = "asus", |
| 12054 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 12055 | [ALC861_AUTO] = "auto", |
| 12056 | }; |
| 12057 | |
| 12058 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 12059 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12060 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12061 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 12062 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12063 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 12064 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 12065 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 12066 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 12067 | * Any other models that need this preset? |
| 12068 | */ |
| 12069 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 12070 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 12071 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12072 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 12073 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 12074 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 12075 | /* FIXME: the below seems conflict */ |
| 12076 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 12077 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 12078 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12079 | {} |
| 12080 | }; |
| 12081 | |
| 12082 | static struct alc_config_preset alc861_presets[] = { |
| 12083 | [ALC861_3ST] = { |
| 12084 | .mixers = { alc861_3ST_mixer }, |
| 12085 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12086 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12087 | .dac_nids = alc861_dac_nids, |
| 12088 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12089 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12090 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12091 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12092 | .adc_nids = alc861_adc_nids, |
| 12093 | .input_mux = &alc861_capture_source, |
| 12094 | }, |
| 12095 | [ALC861_3ST_DIG] = { |
| 12096 | .mixers = { alc861_base_mixer }, |
| 12097 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12098 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12099 | .dac_nids = alc861_dac_nids, |
| 12100 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12101 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12102 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12103 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12104 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12105 | .adc_nids = alc861_adc_nids, |
| 12106 | .input_mux = &alc861_capture_source, |
| 12107 | }, |
| 12108 | [ALC861_6ST_DIG] = { |
| 12109 | .mixers = { alc861_base_mixer }, |
| 12110 | .init_verbs = { alc861_base_init_verbs }, |
| 12111 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12112 | .dac_nids = alc861_dac_nids, |
| 12113 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12114 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 12115 | .channel_mode = alc861_8ch_modes, |
| 12116 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12117 | .adc_nids = alc861_adc_nids, |
| 12118 | .input_mux = &alc861_capture_source, |
| 12119 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12120 | [ALC660_3ST] = { |
| 12121 | .mixers = { alc861_3ST_mixer }, |
| 12122 | .init_verbs = { alc861_threestack_init_verbs }, |
| 12123 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 12124 | .dac_nids = alc660_dac_nids, |
| 12125 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 12126 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 12127 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12128 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12129 | .adc_nids = alc861_adc_nids, |
| 12130 | .input_mux = &alc861_capture_source, |
| 12131 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 12132 | [ALC861_UNIWILL_M31] = { |
| 12133 | .mixers = { alc861_uniwill_m31_mixer }, |
| 12134 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 12135 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12136 | .dac_nids = alc861_dac_nids, |
| 12137 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12138 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 12139 | .channel_mode = alc861_uniwill_m31_modes, |
| 12140 | .need_dac_fix = 1, |
| 12141 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12142 | .adc_nids = alc861_adc_nids, |
| 12143 | .input_mux = &alc861_capture_source, |
| 12144 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12145 | [ALC861_TOSHIBA] = { |
| 12146 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12147 | .init_verbs = { alc861_base_init_verbs, |
| 12148 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 12149 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12150 | .dac_nids = alc861_dac_nids, |
| 12151 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12152 | .channel_mode = alc883_3ST_2ch_modes, |
| 12153 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12154 | .adc_nids = alc861_adc_nids, |
| 12155 | .input_mux = &alc861_capture_source, |
| 12156 | .unsol_event = alc861_toshiba_unsol_event, |
| 12157 | .init_hook = alc861_toshiba_automute, |
| 12158 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 12159 | [ALC861_ASUS] = { |
| 12160 | .mixers = { alc861_asus_mixer }, |
| 12161 | .init_verbs = { alc861_asus_init_verbs }, |
| 12162 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12163 | .dac_nids = alc861_dac_nids, |
| 12164 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12165 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 12166 | .channel_mode = alc861_asus_modes, |
| 12167 | .need_dac_fix = 1, |
| 12168 | .hp_nid = 0x06, |
| 12169 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12170 | .adc_nids = alc861_adc_nids, |
| 12171 | .input_mux = &alc861_capture_source, |
| 12172 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 12173 | [ALC861_ASUS_LAPTOP] = { |
| 12174 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 12175 | .init_verbs = { alc861_asus_init_verbs, |
| 12176 | alc861_asus_laptop_init_verbs }, |
| 12177 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 12178 | .dac_nids = alc861_dac_nids, |
| 12179 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 12180 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 12181 | .channel_mode = alc883_3ST_2ch_modes, |
| 12182 | .need_dac_fix = 1, |
| 12183 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 12184 | .adc_nids = alc861_adc_nids, |
| 12185 | .input_mux = &alc861_capture_source, |
| 12186 | }, |
| 12187 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12188 | |
| 12189 | |
| 12190 | static int patch_alc861(struct hda_codec *codec) |
| 12191 | { |
| 12192 | struct alc_spec *spec; |
| 12193 | int board_config; |
| 12194 | int err; |
| 12195 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 12196 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12197 | if (spec == NULL) |
| 12198 | return -ENOMEM; |
| 12199 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12200 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12201 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12202 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 12203 | alc861_models, |
| 12204 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12205 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 12206 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12207 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 12208 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12209 | board_config = ALC861_AUTO; |
| 12210 | } |
| 12211 | |
| 12212 | if (board_config == ALC861_AUTO) { |
| 12213 | /* automatic parse from the BIOS config */ |
| 12214 | err = alc861_parse_auto_config(codec); |
| 12215 | if (err < 0) { |
| 12216 | alc_free(codec); |
| 12217 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12218 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 12219 | printk(KERN_INFO |
| 12220 | "hda_codec: Cannot set up configuration " |
| 12221 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12222 | board_config = ALC861_3ST_DIG; |
| 12223 | } |
| 12224 | } |
| 12225 | |
| 12226 | if (board_config != ALC861_AUTO) |
| 12227 | setup_preset(spec, &alc861_presets[board_config]); |
| 12228 | |
| 12229 | spec->stream_name_analog = "ALC861 Analog"; |
| 12230 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 12231 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 12232 | |
| 12233 | spec->stream_name_digital = "ALC861 Digital"; |
| 12234 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 12235 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 12236 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12237 | spec->vmaster_nid = 0x03; |
| 12238 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12239 | codec->patch_ops = alc_patch_ops; |
| 12240 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 12241 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12242 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12243 | if (!spec->loopback.amplist) |
| 12244 | spec->loopback.amplist = alc861_loopbacks; |
| 12245 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 12246 | |
| 12247 | return 0; |
| 12248 | } |
| 12249 | |
| 12250 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12251 | * ALC861-VD support |
| 12252 | * |
| 12253 | * Based on ALC882 |
| 12254 | * |
| 12255 | * In addition, an independent DAC |
| 12256 | */ |
| 12257 | #define ALC861VD_DIGOUT_NID 0x06 |
| 12258 | |
| 12259 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 12260 | /* front, surr, clfe, side surr */ |
| 12261 | 0x02, 0x03, 0x04, 0x05 |
| 12262 | }; |
| 12263 | |
| 12264 | /* dac_nids for ALC660vd are in a different order - according to |
| 12265 | * Realtek's driver. |
| 12266 | * This should probably tesult in a different mixer for 6stack models |
| 12267 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 12268 | * - and it is the same as in 861vd. |
| 12269 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 12270 | */ |
| 12271 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 12272 | /* front, rear, clfe, rear_surr */ |
| 12273 | 0x02, 0x04, 0x03 |
| 12274 | }; |
| 12275 | |
| 12276 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 12277 | /* ADC0 */ |
| 12278 | 0x09, |
| 12279 | }; |
| 12280 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12281 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 12282 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12283 | /* input MUX */ |
| 12284 | /* FIXME: should be a matrix-type input source selection */ |
| 12285 | static struct hda_input_mux alc861vd_capture_source = { |
| 12286 | .num_items = 4, |
| 12287 | .items = { |
| 12288 | { "Mic", 0x0 }, |
| 12289 | { "Front Mic", 0x1 }, |
| 12290 | { "Line", 0x2 }, |
| 12291 | { "CD", 0x4 }, |
| 12292 | }, |
| 12293 | }; |
| 12294 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12295 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12296 | .num_items = 2, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12297 | .items = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12298 | { "Ext Mic", 0x0 }, |
| 12299 | { "Int Mic", 0x1 }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12300 | }, |
| 12301 | }; |
| 12302 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12303 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 12304 | .num_items = 2, |
| 12305 | .items = { |
| 12306 | { "Front Mic", 0x0 }, |
| 12307 | { "ATAPI Mic", 0x1 }, |
| 12308 | }, |
| 12309 | }; |
| 12310 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12311 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 12312 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12313 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 12314 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12315 | |
| 12316 | /* |
| 12317 | * 2ch mode |
| 12318 | */ |
| 12319 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 12320 | { 2, NULL } |
| 12321 | }; |
| 12322 | |
| 12323 | /* |
| 12324 | * 6ch mode |
| 12325 | */ |
| 12326 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 12327 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12328 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12329 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12330 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12331 | { } /* end */ |
| 12332 | }; |
| 12333 | |
| 12334 | /* |
| 12335 | * 8ch mode |
| 12336 | */ |
| 12337 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 12338 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12339 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12340 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12341 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12342 | { } /* end */ |
| 12343 | }; |
| 12344 | |
| 12345 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 12346 | { 6, alc861vd_6stack_ch6_init }, |
| 12347 | { 8, alc861vd_6stack_ch8_init }, |
| 12348 | }; |
| 12349 | |
| 12350 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 12351 | { |
| 12352 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12353 | .name = "Channel Mode", |
| 12354 | .info = alc_ch_mode_info, |
| 12355 | .get = alc_ch_mode_get, |
| 12356 | .put = alc_ch_mode_put, |
| 12357 | }, |
| 12358 | { } /* end */ |
| 12359 | }; |
| 12360 | |
| 12361 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 12362 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12363 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12364 | |
| 12365 | { |
| 12366 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12367 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12368 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12369 | */ |
| 12370 | /* .name = "Capture Source", */ |
| 12371 | .name = "Input Source", |
| 12372 | .count = 1, |
| 12373 | .info = alc861vd_mux_enum_info, |
| 12374 | .get = alc861vd_mux_enum_get, |
| 12375 | .put = alc861vd_mux_enum_put, |
| 12376 | }, |
| 12377 | { } /* end */ |
| 12378 | }; |
| 12379 | |
| 12380 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12381 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12382 | */ |
| 12383 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 12384 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12385 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12386 | |
| 12387 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12388 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12389 | |
| 12390 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 12391 | HDA_OUTPUT), |
| 12392 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 12393 | HDA_OUTPUT), |
| 12394 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 12395 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 12396 | |
| 12397 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 12398 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 12399 | |
| 12400 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12401 | |
| 12402 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12403 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12404 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12405 | |
| 12406 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12407 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12408 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12409 | |
| 12410 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12411 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12412 | |
| 12413 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12414 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12415 | |
| 12416 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12417 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12418 | |
| 12419 | { } /* end */ |
| 12420 | }; |
| 12421 | |
| 12422 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 12423 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12424 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12425 | |
| 12426 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12427 | |
| 12428 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12431 | |
| 12432 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12434 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12435 | |
| 12436 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12437 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12438 | |
| 12439 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12440 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12441 | |
| 12442 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12443 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12444 | |
| 12445 | { } /* end */ |
| 12446 | }; |
| 12447 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12448 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12449 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12450 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12451 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12452 | |
| 12453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12454 | |
| 12455 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12456 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12457 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12458 | |
| 12459 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12460 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12461 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12462 | |
| 12463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12465 | |
| 12466 | { } /* end */ |
| 12467 | }; |
| 12468 | |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12469 | /* Pin assignment: Speaker=0x14, HP = 0x15, |
| 12470 | * Ext Mic=0x18, Int Mic = 0x19, CD = 0x1c, PC Beep = 0x1d |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12471 | */ |
| 12472 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12473 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12474 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12475 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12476 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12477 | HDA_CODEC_VOLUME("Ext Mic Boost", 0x18, 0, HDA_INPUT), |
| 12478 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12479 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12480 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 12481 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12482 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12483 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), |
| 12484 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12485 | { } /* end */ |
| 12486 | }; |
| 12487 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12488 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12489 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12490 | */ |
| 12491 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12492 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12493 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12494 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12495 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12496 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12497 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12498 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12499 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12500 | |
| 12501 | { } /* end */ |
| 12502 | }; |
| 12503 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12504 | /* |
| 12505 | * generic initialization of ADC, input mixers and output mixers |
| 12506 | */ |
| 12507 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12508 | /* |
| 12509 | * Unmute ADC0 and set the default input to mic-in |
| 12510 | */ |
| 12511 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12512 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12513 | |
| 12514 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12515 | * the analog-loopback mixer widget |
| 12516 | */ |
| 12517 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12518 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12519 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12520 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12521 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12522 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12523 | |
| 12524 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12525 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12526 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12529 | |
| 12530 | /* |
| 12531 | * Set up output mixers (0x02 - 0x05) |
| 12532 | */ |
| 12533 | /* set vol=0 to output mixers */ |
| 12534 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12535 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12536 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12537 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12538 | |
| 12539 | /* set up input amps for analog loopback */ |
| 12540 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12541 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12542 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12543 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12544 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12545 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12546 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12547 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12548 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12549 | |
| 12550 | { } |
| 12551 | }; |
| 12552 | |
| 12553 | /* |
| 12554 | * 3-stack pin configuration: |
| 12555 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12556 | */ |
| 12557 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12558 | /* |
| 12559 | * Set pin mode and muting |
| 12560 | */ |
| 12561 | /* set front pin widgets 0x14 for output */ |
| 12562 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12564 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12565 | |
| 12566 | /* Mic (rear) pin: input vref at 80% */ |
| 12567 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12568 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12569 | /* Front Mic pin: input vref at 80% */ |
| 12570 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12571 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12572 | /* Line In pin: input */ |
| 12573 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12574 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12575 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12576 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12577 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12578 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12579 | /* CD pin widget for input */ |
| 12580 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12581 | |
| 12582 | { } |
| 12583 | }; |
| 12584 | |
| 12585 | /* |
| 12586 | * 6-stack pin configuration: |
| 12587 | */ |
| 12588 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12589 | /* |
| 12590 | * Set pin mode and muting |
| 12591 | */ |
| 12592 | /* set front pin widgets 0x14 for output */ |
| 12593 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12594 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12595 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12596 | |
| 12597 | /* Rear Pin: output 1 (0x0d) */ |
| 12598 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12599 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12600 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12601 | /* CLFE Pin: output 2 (0x0e) */ |
| 12602 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12603 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12604 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12605 | /* Side Pin: output 3 (0x0f) */ |
| 12606 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12607 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12608 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12609 | |
| 12610 | /* Mic (rear) pin: input vref at 80% */ |
| 12611 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12612 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12613 | /* Front Mic pin: input vref at 80% */ |
| 12614 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12615 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12616 | /* Line In pin: input */ |
| 12617 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12618 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12619 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12621 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12622 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12623 | /* CD pin widget for input */ |
| 12624 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12625 | |
| 12626 | { } |
| 12627 | }; |
| 12628 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12629 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12630 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12631 | { } |
| 12632 | }; |
| 12633 | |
| 12634 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12635 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12636 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12637 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12638 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12639 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12640 | {} |
| 12641 | }; |
| 12642 | |
| 12643 | /* toggle speaker-output according to the hp-jack state */ |
| 12644 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12645 | { |
| 12646 | unsigned int present; |
| 12647 | unsigned char bits; |
| 12648 | |
| 12649 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12650 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12651 | bits = present ? HDA_AMP_MUTE : 0; |
| 12652 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12653 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12654 | } |
| 12655 | |
| 12656 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12657 | { |
| 12658 | unsigned int present; |
| 12659 | unsigned char bits; |
| 12660 | |
| 12661 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12662 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12663 | bits = present ? HDA_AMP_MUTE : 0; |
| 12664 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12665 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12666 | } |
| 12667 | |
| 12668 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12669 | { |
| 12670 | alc861vd_lenovo_hp_automute(codec); |
| 12671 | alc861vd_lenovo_mic_automute(codec); |
| 12672 | } |
| 12673 | |
| 12674 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12675 | unsigned int res) |
| 12676 | { |
| 12677 | switch (res >> 26) { |
| 12678 | case ALC880_HP_EVENT: |
| 12679 | alc861vd_lenovo_hp_automute(codec); |
| 12680 | break; |
| 12681 | case ALC880_MIC_EVENT: |
| 12682 | alc861vd_lenovo_mic_automute(codec); |
| 12683 | break; |
| 12684 | } |
| 12685 | } |
| 12686 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12687 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12688 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12689 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12690 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12691 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12692 | |
| 12693 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12694 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12695 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12696 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12697 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12698 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12699 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12700 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12701 | |
| 12702 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12703 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12704 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12705 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12706 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12707 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12708 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12709 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12710 | |
| 12711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12712 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12713 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12714 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12715 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12716 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12717 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12718 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12719 | |
| 12720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12721 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12722 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12723 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12724 | |
| 12725 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12726 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12727 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12728 | |
| 12729 | { } /* end */ |
| 12730 | }; |
| 12731 | |
| 12732 | /* toggle speaker-output according to the hp-jack state */ |
| 12733 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12734 | { |
| 12735 | unsigned int present; |
| 12736 | |
| 12737 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12738 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12739 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12740 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12741 | } |
| 12742 | |
| 12743 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12744 | { |
| 12745 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12746 | alc861vd_dallas_automute(codec); |
| 12747 | } |
| 12748 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12749 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12750 | #define alc861vd_loopbacks alc880_loopbacks |
| 12751 | #endif |
| 12752 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12753 | /* pcm configuration: identiacal with ALC880 */ |
| 12754 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12755 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12756 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12757 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12758 | |
| 12759 | /* |
| 12760 | * configuration and preset |
| 12761 | */ |
| 12762 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12763 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12764 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12765 | [ALC861VD_3ST] = "3stack", |
| 12766 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12767 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12768 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12769 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12770 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12771 | [ALC861VD_AUTO] = "auto", |
| 12772 | }; |
| 12773 | |
| 12774 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12775 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12776 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12777 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12778 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12779 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12780 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12781 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12782 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12783 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12784 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Tobin Davis | b419f34 | 2008-03-07 11:57:51 +0100 | [diff] [blame] | 12785 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12786 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12787 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12788 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12789 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12790 | {} |
| 12791 | }; |
| 12792 | |
| 12793 | static struct alc_config_preset alc861vd_presets[] = { |
| 12794 | [ALC660VD_3ST] = { |
| 12795 | .mixers = { alc861vd_3st_mixer }, |
| 12796 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12797 | alc861vd_3stack_init_verbs }, |
| 12798 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12799 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12800 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12801 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12802 | .input_mux = &alc861vd_capture_source, |
| 12803 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12804 | [ALC660VD_3ST_DIG] = { |
| 12805 | .mixers = { alc861vd_3st_mixer }, |
| 12806 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12807 | alc861vd_3stack_init_verbs }, |
| 12808 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12809 | .dac_nids = alc660vd_dac_nids, |
| 12810 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12811 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12812 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12813 | .input_mux = &alc861vd_capture_source, |
| 12814 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12815 | [ALC861VD_3ST] = { |
| 12816 | .mixers = { alc861vd_3st_mixer }, |
| 12817 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12818 | alc861vd_3stack_init_verbs }, |
| 12819 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12820 | .dac_nids = alc861vd_dac_nids, |
| 12821 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12822 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12823 | .input_mux = &alc861vd_capture_source, |
| 12824 | }, |
| 12825 | [ALC861VD_3ST_DIG] = { |
| 12826 | .mixers = { alc861vd_3st_mixer }, |
| 12827 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12828 | alc861vd_3stack_init_verbs }, |
| 12829 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12830 | .dac_nids = alc861vd_dac_nids, |
| 12831 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12832 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12833 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12834 | .input_mux = &alc861vd_capture_source, |
| 12835 | }, |
| 12836 | [ALC861VD_6ST_DIG] = { |
| 12837 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12838 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12839 | alc861vd_6stack_init_verbs }, |
| 12840 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12841 | .dac_nids = alc861vd_dac_nids, |
| 12842 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12843 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12844 | .channel_mode = alc861vd_6stack_modes, |
| 12845 | .input_mux = &alc861vd_capture_source, |
| 12846 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12847 | [ALC861VD_LENOVO] = { |
| 12848 | .mixers = { alc861vd_lenovo_mixer }, |
| 12849 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12850 | alc861vd_3stack_init_verbs, |
| 12851 | alc861vd_eapd_verbs, |
| 12852 | alc861vd_lenovo_unsol_verbs }, |
| 12853 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12854 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12855 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12856 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12857 | .input_mux = &alc861vd_capture_source, |
| 12858 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12859 | .init_hook = alc861vd_lenovo_automute, |
| 12860 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12861 | [ALC861VD_DALLAS] = { |
| 12862 | .mixers = { alc861vd_dallas_mixer }, |
| 12863 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12864 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12865 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12866 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12867 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12868 | .input_mux = &alc861vd_dallas_capture_source, |
| 12869 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12870 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12871 | }, |
| 12872 | [ALC861VD_HP] = { |
| 12873 | .mixers = { alc861vd_hp_mixer }, |
| 12874 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12875 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12876 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12877 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12878 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12879 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12880 | .input_mux = &alc861vd_hp_capture_source, |
| 12881 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12882 | .init_hook = alc861vd_dallas_automute, |
| 12883 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12884 | }; |
| 12885 | |
| 12886 | /* |
| 12887 | * BIOS auto configuration |
| 12888 | */ |
| 12889 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12890 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12891 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12892 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12893 | } |
| 12894 | |
| 12895 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12896 | { |
| 12897 | struct alc_spec *spec = codec->spec; |
| 12898 | int i; |
| 12899 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12900 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12901 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12902 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12903 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12904 | if (nid) |
| 12905 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12906 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12907 | } |
| 12908 | } |
| 12909 | |
| 12910 | |
| 12911 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12912 | { |
| 12913 | struct alc_spec *spec = codec->spec; |
| 12914 | hda_nid_t pin; |
| 12915 | |
| 12916 | pin = spec->autocfg.hp_pins[0]; |
| 12917 | if (pin) /* connect to front and use dac 0 */ |
| 12918 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12919 | pin = spec->autocfg.speaker_pins[0]; |
| 12920 | if (pin) |
| 12921 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12922 | } |
| 12923 | |
| 12924 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12925 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12926 | |
| 12927 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12928 | { |
| 12929 | struct alc_spec *spec = codec->spec; |
| 12930 | int i; |
| 12931 | |
| 12932 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12933 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12934 | if (alc861vd_is_input_pin(nid)) { |
| 12935 | snd_hda_codec_write(codec, nid, 0, |
| 12936 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12937 | i <= AUTO_PIN_FRONT_MIC ? |
| 12938 | PIN_VREF80 : PIN_IN); |
| 12939 | if (nid != ALC861VD_PIN_CD_NID) |
| 12940 | snd_hda_codec_write(codec, nid, 0, |
| 12941 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12942 | AMP_OUT_MUTE); |
| 12943 | } |
| 12944 | } |
| 12945 | } |
| 12946 | |
| 12947 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12948 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12949 | |
| 12950 | /* add playback controls from the parsed DAC table */ |
| 12951 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12952 | * different NIDs for mute/unmute switch and volume control */ |
| 12953 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12954 | const struct auto_pin_cfg *cfg) |
| 12955 | { |
| 12956 | char name[32]; |
| 12957 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12958 | hda_nid_t nid_v, nid_s; |
| 12959 | int i, err; |
| 12960 | |
| 12961 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12962 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12963 | continue; |
| 12964 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12965 | alc880_dac_to_idx( |
| 12966 | spec->multiout.dac_nids[i])); |
| 12967 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12968 | alc880_dac_to_idx( |
| 12969 | spec->multiout.dac_nids[i])); |
| 12970 | |
| 12971 | if (i == 2) { |
| 12972 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12973 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12974 | "Center Playback Volume", |
| 12975 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12976 | HDA_OUTPUT)); |
| 12977 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12978 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12979 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12980 | "LFE Playback Volume", |
| 12981 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12982 | HDA_OUTPUT)); |
| 12983 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12984 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12985 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12986 | "Center Playback Switch", |
| 12987 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12988 | HDA_INPUT)); |
| 12989 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12990 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12991 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12992 | "LFE Playback Switch", |
| 12993 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12994 | HDA_INPUT)); |
| 12995 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12996 | return err; |
| 12997 | } else { |
| 12998 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12999 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13000 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 13001 | HDA_OUTPUT)); |
| 13002 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13003 | return err; |
| 13004 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13005 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 13006 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13007 | HDA_INPUT)); |
| 13008 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13009 | return err; |
| 13010 | } |
| 13011 | } |
| 13012 | return 0; |
| 13013 | } |
| 13014 | |
| 13015 | /* add playback controls for speaker and HP outputs */ |
| 13016 | /* Based on ALC880 version. But ALC861VD has separate, |
| 13017 | * different NIDs for mute/unmute switch and volume control */ |
| 13018 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 13019 | hda_nid_t pin, const char *pfx) |
| 13020 | { |
| 13021 | hda_nid_t nid_v, nid_s; |
| 13022 | int err; |
| 13023 | char name[32]; |
| 13024 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13025 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13026 | return 0; |
| 13027 | |
| 13028 | if (alc880_is_fixed_pin(pin)) { |
| 13029 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13030 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13031 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13032 | spec->multiout.hp_nid = nid_v; |
| 13033 | else |
| 13034 | spec->multiout.extra_out_nid[0] = nid_v; |
| 13035 | /* control HP volume/switch on the output mixer amp */ |
| 13036 | nid_v = alc861vd_idx_to_mixer_vol( |
| 13037 | alc880_fixed_pin_idx(pin)); |
| 13038 | nid_s = alc861vd_idx_to_mixer_switch( |
| 13039 | alc880_fixed_pin_idx(pin)); |
| 13040 | |
| 13041 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13042 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13043 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 13044 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13045 | return err; |
| 13046 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13047 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13048 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 13049 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13050 | return err; |
| 13051 | } else if (alc880_is_multi_pin(pin)) { |
| 13052 | /* set manual connection */ |
| 13053 | /* we have only a switch on HP-out PIN */ |
| 13054 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13055 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13056 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13057 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13058 | return err; |
| 13059 | } |
| 13060 | return 0; |
| 13061 | } |
| 13062 | |
| 13063 | /* parse the BIOS configuration and set up the alc_spec |
| 13064 | * return 1 if successful, 0 if the proper config is not found, |
| 13065 | * or a negative error code |
| 13066 | * Based on ALC880 version - had to change it to override |
| 13067 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 13068 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 13069 | { |
| 13070 | struct alc_spec *spec = codec->spec; |
| 13071 | int err; |
| 13072 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 13073 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13074 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13075 | alc861vd_ignore); |
| 13076 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13077 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13078 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13079 | return 0; /* can't find valid BIOS pin config */ |
| 13080 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13081 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13082 | if (err < 0) |
| 13083 | return err; |
| 13084 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13085 | if (err < 0) |
| 13086 | return err; |
| 13087 | err = alc861vd_auto_create_extra_out(spec, |
| 13088 | spec->autocfg.speaker_pins[0], |
| 13089 | "Speaker"); |
| 13090 | if (err < 0) |
| 13091 | return err; |
| 13092 | err = alc861vd_auto_create_extra_out(spec, |
| 13093 | spec->autocfg.hp_pins[0], |
| 13094 | "Headphone"); |
| 13095 | if (err < 0) |
| 13096 | return err; |
| 13097 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13098 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13099 | return err; |
| 13100 | |
| 13101 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13102 | |
| 13103 | if (spec->autocfg.dig_out_pin) |
| 13104 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 13105 | |
| 13106 | if (spec->kctl_alloc) |
| 13107 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13108 | |
| 13109 | spec->init_verbs[spec->num_init_verbs++] |
| 13110 | = alc861vd_volume_init_verbs; |
| 13111 | |
| 13112 | spec->num_mux_defs = 1; |
| 13113 | spec->input_mux = &spec->private_imux; |
| 13114 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 13115 | err = alc_auto_add_mic_boost(codec); |
| 13116 | if (err < 0) |
| 13117 | return err; |
| 13118 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13119 | return 1; |
| 13120 | } |
| 13121 | |
| 13122 | /* additional initialization for auto-configuration model */ |
| 13123 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 13124 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13125 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13126 | alc861vd_auto_init_multi_out(codec); |
| 13127 | alc861vd_auto_init_hp_out(codec); |
| 13128 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13129 | if (spec->unsol_event) |
| 13130 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13131 | } |
| 13132 | |
| 13133 | static int patch_alc861vd(struct hda_codec *codec) |
| 13134 | { |
| 13135 | struct alc_spec *spec; |
| 13136 | int err, board_config; |
| 13137 | |
| 13138 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13139 | if (spec == NULL) |
| 13140 | return -ENOMEM; |
| 13141 | |
| 13142 | codec->spec = spec; |
| 13143 | |
| 13144 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 13145 | alc861vd_models, |
| 13146 | alc861vd_cfg_tbl); |
| 13147 | |
| 13148 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 13149 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 13150 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 13151 | board_config = ALC861VD_AUTO; |
| 13152 | } |
| 13153 | |
| 13154 | if (board_config == ALC861VD_AUTO) { |
| 13155 | /* automatic parse from the BIOS config */ |
| 13156 | err = alc861vd_parse_auto_config(codec); |
| 13157 | if (err < 0) { |
| 13158 | alc_free(codec); |
| 13159 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13160 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13161 | printk(KERN_INFO |
| 13162 | "hda_codec: Cannot set up configuration " |
| 13163 | "from BIOS. Using base mode...\n"); |
| 13164 | board_config = ALC861VD_3ST; |
| 13165 | } |
| 13166 | } |
| 13167 | |
| 13168 | if (board_config != ALC861VD_AUTO) |
| 13169 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 13170 | |
| 13171 | spec->stream_name_analog = "ALC861VD Analog"; |
| 13172 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 13173 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 13174 | |
| 13175 | spec->stream_name_digital = "ALC861VD Digital"; |
| 13176 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 13177 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 13178 | |
| 13179 | spec->adc_nids = alc861vd_adc_nids; |
| 13180 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13181 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13182 | |
| 13183 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 13184 | spec->num_mixers++; |
| 13185 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13186 | spec->vmaster_nid = 0x02; |
| 13187 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13188 | codec->patch_ops = alc_patch_ops; |
| 13189 | |
| 13190 | if (board_config == ALC861VD_AUTO) |
| 13191 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13192 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13193 | if (!spec->loopback.amplist) |
| 13194 | spec->loopback.amplist = alc861vd_loopbacks; |
| 13195 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13196 | |
| 13197 | return 0; |
| 13198 | } |
| 13199 | |
| 13200 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13201 | * ALC662 support |
| 13202 | * |
| 13203 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 13204 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 13205 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 13206 | * 6-channel independent captures. |
| 13207 | * |
| 13208 | * In addition, an independent DAC for the multi-playback (not used in this |
| 13209 | * driver yet). |
| 13210 | */ |
| 13211 | #define ALC662_DIGOUT_NID 0x06 |
| 13212 | #define ALC662_DIGIN_NID 0x0a |
| 13213 | |
| 13214 | static hda_nid_t alc662_dac_nids[4] = { |
| 13215 | /* front, rear, clfe, rear_surr */ |
| 13216 | 0x02, 0x03, 0x04 |
| 13217 | }; |
| 13218 | |
| 13219 | static hda_nid_t alc662_adc_nids[1] = { |
| 13220 | /* ADC1-2 */ |
| 13221 | 0x09, |
| 13222 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13223 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 13224 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13225 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13226 | /* input MUX */ |
| 13227 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13228 | static struct hda_input_mux alc662_capture_source = { |
| 13229 | .num_items = 4, |
| 13230 | .items = { |
| 13231 | { "Mic", 0x0 }, |
| 13232 | { "Front Mic", 0x1 }, |
| 13233 | { "Line", 0x2 }, |
| 13234 | { "CD", 0x4 }, |
| 13235 | }, |
| 13236 | }; |
| 13237 | |
| 13238 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 13239 | .num_items = 2, |
| 13240 | .items = { |
| 13241 | { "Mic", 0x1 }, |
| 13242 | { "Line", 0x2 }, |
| 13243 | }, |
| 13244 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13245 | |
| 13246 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 13247 | .num_items = 2, |
| 13248 | .items = { |
| 13249 | { "i-Mic", 0x1 }, |
| 13250 | { "e-Mic", 0x0 }, |
| 13251 | }, |
| 13252 | }; |
| 13253 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13254 | #define alc662_mux_enum_info alc_mux_enum_info |
| 13255 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13256 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13257 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13258 | /* |
| 13259 | * 2ch mode |
| 13260 | */ |
| 13261 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 13262 | { 2, NULL } |
| 13263 | }; |
| 13264 | |
| 13265 | /* |
| 13266 | * 2ch mode |
| 13267 | */ |
| 13268 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 13269 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 13270 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13271 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 13272 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 13273 | { } /* end */ |
| 13274 | }; |
| 13275 | |
| 13276 | /* |
| 13277 | * 6ch mode |
| 13278 | */ |
| 13279 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 13280 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13281 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13282 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 13283 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13284 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 13285 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 13286 | { } /* end */ |
| 13287 | }; |
| 13288 | |
| 13289 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 13290 | { 2, alc662_3ST_ch2_init }, |
| 13291 | { 6, alc662_3ST_ch6_init }, |
| 13292 | }; |
| 13293 | |
| 13294 | /* |
| 13295 | * 2ch mode |
| 13296 | */ |
| 13297 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 13298 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13299 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 13300 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13301 | { } /* end */ |
| 13302 | }; |
| 13303 | |
| 13304 | /* |
| 13305 | * 6ch mode |
| 13306 | */ |
| 13307 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 13308 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13309 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13310 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 13311 | { } /* end */ |
| 13312 | }; |
| 13313 | |
| 13314 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 13315 | { 2, alc662_sixstack_ch6_init }, |
| 13316 | { 6, alc662_sixstack_ch8_init }, |
| 13317 | }; |
| 13318 | |
| 13319 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 13320 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 13321 | */ |
| 13322 | |
| 13323 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 13324 | /* output mixer control */ |
| 13325 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13326 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13327 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13328 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13329 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13330 | 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] | 13331 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13332 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13333 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13334 | |
| 13335 | /*Input mixer control */ |
| 13336 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 13337 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 13338 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 13339 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 13340 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 13341 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 13342 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 13343 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13344 | { } /* end */ |
| 13345 | }; |
| 13346 | |
| 13347 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 13348 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13349 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13350 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13357 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13358 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13359 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13360 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13361 | { } /* end */ |
| 13362 | }; |
| 13363 | |
| 13364 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 13365 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13366 | HDA_CODEC_MUTE("Front Playback Switch", 0x0c, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13367 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
Herton Ronaldo Krzesinski | 7055ad8 | 2008-03-14 12:52:20 +0100 | [diff] [blame] | 13368 | HDA_CODEC_MUTE("Surround Playback Switch", 0x0d, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13369 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13370 | 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] | 13371 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x0e, 1, 0x0, HDA_INPUT), |
| 13372 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 0x0, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13373 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13374 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 13375 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 13376 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13377 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13378 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13379 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13380 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13381 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13382 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 13383 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13384 | { } /* end */ |
| 13385 | }; |
| 13386 | |
| 13387 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 13388 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13389 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13390 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13391 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13392 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 13393 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13394 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13395 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13396 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13397 | { } /* end */ |
| 13398 | }; |
| 13399 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13400 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13401 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13402 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 13403 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13404 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13405 | |
| 13406 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 13407 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13408 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13409 | |
| 13410 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 13411 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 13412 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 13413 | { } /* end */ |
| 13414 | }; |
| 13415 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13416 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 13417 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 13418 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13419 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 13420 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 13421 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 13422 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 13423 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 13424 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 13425 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13426 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 13427 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 13428 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 13429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 13430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 13431 | { } /* end */ |
| 13432 | }; |
| 13433 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13434 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13435 | { |
| 13436 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13437 | .name = "Channel Mode", |
| 13438 | .info = alc_ch_mode_info, |
| 13439 | .get = alc_ch_mode_get, |
| 13440 | .put = alc_ch_mode_put, |
| 13441 | }, |
| 13442 | { } /* end */ |
| 13443 | }; |
| 13444 | |
| 13445 | static struct hda_verb alc662_init_verbs[] = { |
| 13446 | /* ADC: mute amp left and right */ |
| 13447 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13448 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13449 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13450 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13451 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13452 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13453 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13454 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13455 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13456 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13457 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13458 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13459 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13460 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13461 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13462 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13463 | |
| 13464 | /* Front Pin: output 0 (0x0c) */ |
| 13465 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13466 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13467 | |
| 13468 | /* Rear Pin: output 1 (0x0d) */ |
| 13469 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13470 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13471 | |
| 13472 | /* CLFE Pin: output 2 (0x0e) */ |
| 13473 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13474 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13475 | |
| 13476 | /* Mic (rear) pin: input vref at 80% */ |
| 13477 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13478 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13479 | /* Front Mic pin: input vref at 80% */ |
| 13480 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13481 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13482 | /* Line In pin: input */ |
| 13483 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13484 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13485 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13486 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13487 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13488 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13489 | /* CD pin widget for input */ |
| 13490 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13491 | |
| 13492 | /* FIXME: use matrix-type input source selection */ |
| 13493 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13494 | /* Input mixer */ |
| 13495 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13496 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13497 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13498 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13499 | |
| 13500 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13501 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13502 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13503 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13504 | { } |
| 13505 | }; |
| 13506 | |
| 13507 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13508 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13509 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13510 | {} |
| 13511 | }; |
| 13512 | |
| 13513 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13514 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13515 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13516 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13517 | }; |
| 13518 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13519 | /* Set Unsolicited Event*/ |
| 13520 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13521 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13522 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13523 | {} |
| 13524 | }; |
| 13525 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13526 | /* |
| 13527 | * generic initialization of ADC, input mixers and output mixers |
| 13528 | */ |
| 13529 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13530 | /* |
| 13531 | * Unmute ADC and set the default input to mic-in |
| 13532 | */ |
| 13533 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13534 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13535 | |
| 13536 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13537 | * mixer widget |
| 13538 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13539 | * panel mic (mic 2) |
| 13540 | */ |
| 13541 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13542 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13543 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13544 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13545 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13546 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13547 | |
| 13548 | /* |
| 13549 | * Set up output mixers (0x0c - 0x0f) |
| 13550 | */ |
| 13551 | /* set vol=0 to output mixers */ |
| 13552 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13553 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13554 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13555 | |
| 13556 | /* set up input amps for analog loopback */ |
| 13557 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13558 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13559 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13560 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13561 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13562 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13563 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13564 | |
| 13565 | |
| 13566 | /* FIXME: use matrix-type input source selection */ |
| 13567 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13568 | /* Input mixer */ |
| 13569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13570 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13571 | { } |
| 13572 | }; |
| 13573 | |
| 13574 | /* capture mixer elements */ |
| 13575 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13576 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13577 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13578 | { |
| 13579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13580 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13581 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13582 | */ |
| 13583 | /* .name = "Capture Source", */ |
| 13584 | .name = "Input Source", |
| 13585 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13586 | .info = alc662_mux_enum_info, |
| 13587 | .get = alc662_mux_enum_get, |
| 13588 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13589 | }, |
| 13590 | { } /* end */ |
| 13591 | }; |
| 13592 | |
| 13593 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13594 | { |
| 13595 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13596 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13597 | |
| 13598 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13599 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13600 | bits = present ? HDA_AMP_MUTE : 0; |
| 13601 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13602 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13603 | } |
| 13604 | |
| 13605 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13606 | { |
| 13607 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13608 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13609 | |
| 13610 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13611 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13612 | bits = present ? HDA_AMP_MUTE : 0; |
| 13613 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13614 | HDA_AMP_MUTE, bits); |
| 13615 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13616 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13617 | } |
| 13618 | |
| 13619 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13620 | unsigned int res) |
| 13621 | { |
| 13622 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13623 | alc662_lenovo_101e_all_automute(codec); |
| 13624 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13625 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13626 | } |
| 13627 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13628 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13629 | { |
| 13630 | unsigned int present; |
| 13631 | |
| 13632 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13633 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13634 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13635 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13636 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13637 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13638 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13639 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13640 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13641 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13642 | } |
| 13643 | |
| 13644 | /* unsolicited event for HP jack sensing */ |
| 13645 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13646 | unsigned int res) |
| 13647 | { |
| 13648 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13649 | alc262_hippo1_automute( codec ); |
| 13650 | |
| 13651 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13652 | alc662_eeepc_mic_automute(codec); |
| 13653 | } |
| 13654 | |
| 13655 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13656 | { |
| 13657 | alc262_hippo1_automute( codec ); |
| 13658 | alc662_eeepc_mic_automute(codec); |
| 13659 | } |
| 13660 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13661 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13662 | { |
| 13663 | unsigned int mute; |
| 13664 | unsigned int present; |
| 13665 | |
| 13666 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13667 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13668 | AC_VERB_GET_PIN_SENSE, 0); |
| 13669 | present = (present & 0x80000000) != 0; |
| 13670 | if (present) { |
| 13671 | /* mute internal speaker */ |
| 13672 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13673 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13674 | } else { |
| 13675 | /* unmute internal speaker if necessary */ |
| 13676 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13677 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13678 | HDA_AMP_MUTE, mute); |
| 13679 | } |
| 13680 | } |
| 13681 | |
| 13682 | /* unsolicited event for HP jack sensing */ |
| 13683 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13684 | unsigned int res) |
| 13685 | { |
| 13686 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13687 | alc662_eeepc_ep20_automute(codec); |
| 13688 | } |
| 13689 | |
| 13690 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13691 | { |
| 13692 | alc662_eeepc_ep20_automute(codec); |
| 13693 | } |
| 13694 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13695 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13696 | #define alc662_loopbacks alc880_loopbacks |
| 13697 | #endif |
| 13698 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13699 | |
| 13700 | /* pcm configuration: identiacal with ALC880 */ |
| 13701 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13702 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13703 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13704 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13705 | |
| 13706 | /* |
| 13707 | * configuration and preset |
| 13708 | */ |
| 13709 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13710 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13711 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13712 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13713 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13714 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13715 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13716 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13717 | [ALC662_AUTO] = "auto", |
| 13718 | }; |
| 13719 | |
| 13720 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Herton Ronaldo Krzesinski | 3da23ca | 2008-03-14 12:52:59 +0100 | [diff] [blame] | 13721 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13722 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13723 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13724 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13725 | {} |
| 13726 | }; |
| 13727 | |
| 13728 | static struct alc_config_preset alc662_presets[] = { |
| 13729 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13730 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13731 | .init_verbs = { alc662_init_verbs }, |
| 13732 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13733 | .dac_nids = alc662_dac_nids, |
| 13734 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13735 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13736 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13737 | .channel_mode = alc662_3ST_2ch_modes, |
| 13738 | .input_mux = &alc662_capture_source, |
| 13739 | }, |
| 13740 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13741 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13742 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13743 | .init_verbs = { alc662_init_verbs }, |
| 13744 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13745 | .dac_nids = alc662_dac_nids, |
| 13746 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13747 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13748 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13749 | .channel_mode = alc662_3ST_6ch_modes, |
| 13750 | .need_dac_fix = 1, |
| 13751 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13752 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13753 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13754 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13755 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13756 | .init_verbs = { alc662_init_verbs }, |
| 13757 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13758 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13759 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13760 | .channel_mode = alc662_3ST_6ch_modes, |
| 13761 | .need_dac_fix = 1, |
| 13762 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13763 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13764 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13765 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13766 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13767 | .init_verbs = { alc662_init_verbs }, |
| 13768 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13769 | .dac_nids = alc662_dac_nids, |
| 13770 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13771 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13772 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13773 | .channel_mode = alc662_5stack_modes, |
| 13774 | .input_mux = &alc662_capture_source, |
| 13775 | }, |
| 13776 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13777 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13778 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13779 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13780 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13781 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13782 | .channel_mode = alc662_3ST_2ch_modes, |
| 13783 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13784 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13785 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13786 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13787 | [ALC662_ASUS_EEEPC_P701] = { |
| 13788 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13789 | .init_verbs = { alc662_init_verbs, |
| 13790 | alc662_eeepc_sue_init_verbs }, |
| 13791 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13792 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13793 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13794 | .channel_mode = alc662_3ST_2ch_modes, |
| 13795 | .input_mux = &alc662_eeepc_capture_source, |
| 13796 | .unsol_event = alc662_eeepc_unsol_event, |
| 13797 | .init_hook = alc662_eeepc_inithook, |
| 13798 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13799 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13800 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13801 | alc662_chmode_mixer }, |
| 13802 | .init_verbs = { alc662_init_verbs, |
| 13803 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13804 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13805 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13806 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13807 | .channel_mode = alc662_3ST_6ch_modes, |
| 13808 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13809 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13810 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13811 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13812 | |
| 13813 | }; |
| 13814 | |
| 13815 | |
| 13816 | /* |
| 13817 | * BIOS auto configuration |
| 13818 | */ |
| 13819 | |
| 13820 | /* add playback controls from the parsed DAC table */ |
| 13821 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13822 | const struct auto_pin_cfg *cfg) |
| 13823 | { |
| 13824 | char name[32]; |
| 13825 | static const char *chname[4] = { |
| 13826 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13827 | }; |
| 13828 | hda_nid_t nid; |
| 13829 | int i, err; |
| 13830 | |
| 13831 | for (i = 0; i < cfg->line_outs; i++) { |
| 13832 | if (!spec->multiout.dac_nids[i]) |
| 13833 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13834 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13835 | if (i == 2) { |
| 13836 | /* Center/LFE */ |
| 13837 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13838 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13839 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13840 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13841 | if (err < 0) |
| 13842 | return err; |
| 13843 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13844 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13845 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13846 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13847 | if (err < 0) |
| 13848 | return err; |
| 13849 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13850 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13851 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13852 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13853 | if (err < 0) |
| 13854 | return err; |
| 13855 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13856 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13857 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13858 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13859 | if (err < 0) |
| 13860 | return err; |
| 13861 | } else { |
| 13862 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13863 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13864 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13865 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13866 | if (err < 0) |
| 13867 | return err; |
| 13868 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13869 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13870 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13871 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13872 | if (err < 0) |
| 13873 | return err; |
| 13874 | } |
| 13875 | } |
| 13876 | return 0; |
| 13877 | } |
| 13878 | |
| 13879 | /* add playback controls for speaker and HP outputs */ |
| 13880 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13881 | const char *pfx) |
| 13882 | { |
| 13883 | hda_nid_t nid; |
| 13884 | int err; |
| 13885 | char name[32]; |
| 13886 | |
| 13887 | if (!pin) |
| 13888 | return 0; |
| 13889 | |
| 13890 | if (alc880_is_fixed_pin(pin)) { |
| 13891 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13892 | /* printk("DAC nid=%x\n",nid); */ |
| 13893 | /* specify the DAC as the extra output */ |
| 13894 | if (!spec->multiout.hp_nid) |
| 13895 | spec->multiout.hp_nid = nid; |
| 13896 | else |
| 13897 | spec->multiout.extra_out_nid[0] = nid; |
| 13898 | /* control HP volume/switch on the output mixer amp */ |
| 13899 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13900 | sprintf(name, "%s Playback Volume", pfx); |
| 13901 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13902 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13903 | if (err < 0) |
| 13904 | return err; |
| 13905 | sprintf(name, "%s Playback Switch", pfx); |
| 13906 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13907 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13908 | if (err < 0) |
| 13909 | return err; |
| 13910 | } else if (alc880_is_multi_pin(pin)) { |
| 13911 | /* set manual connection */ |
| 13912 | /* we have only a switch on HP-out PIN */ |
| 13913 | sprintf(name, "%s Playback Switch", pfx); |
| 13914 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13915 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13916 | if (err < 0) |
| 13917 | return err; |
| 13918 | } |
| 13919 | return 0; |
| 13920 | } |
| 13921 | |
| 13922 | /* create playback/capture controls for input pins */ |
| 13923 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13924 | const struct auto_pin_cfg *cfg) |
| 13925 | { |
| 13926 | struct hda_input_mux *imux = &spec->private_imux; |
| 13927 | int i, err, idx; |
| 13928 | |
| 13929 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13930 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13931 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13932 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13933 | auto_pin_cfg_labels[i], |
| 13934 | idx, 0x0b); |
| 13935 | if (err < 0) |
| 13936 | return err; |
| 13937 | imux->items[imux->num_items].label = |
| 13938 | auto_pin_cfg_labels[i]; |
| 13939 | imux->items[imux->num_items].index = |
| 13940 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13941 | imux->num_items++; |
| 13942 | } |
| 13943 | } |
| 13944 | return 0; |
| 13945 | } |
| 13946 | |
| 13947 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13948 | hda_nid_t nid, int pin_type, |
| 13949 | int dac_idx) |
| 13950 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13951 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13952 | /* need the manual connection? */ |
| 13953 | if (alc880_is_multi_pin(nid)) { |
| 13954 | struct alc_spec *spec = codec->spec; |
| 13955 | int idx = alc880_multi_pin_idx(nid); |
| 13956 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13957 | AC_VERB_SET_CONNECT_SEL, |
| 13958 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13959 | } |
| 13960 | } |
| 13961 | |
| 13962 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13963 | { |
| 13964 | struct alc_spec *spec = codec->spec; |
| 13965 | int i; |
| 13966 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13967 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13968 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13969 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13970 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13971 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13972 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13973 | i); |
| 13974 | } |
| 13975 | } |
| 13976 | |
| 13977 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13978 | { |
| 13979 | struct alc_spec *spec = codec->spec; |
| 13980 | hda_nid_t pin; |
| 13981 | |
| 13982 | pin = spec->autocfg.hp_pins[0]; |
| 13983 | if (pin) /* connect to front */ |
| 13984 | /* use dac 0 */ |
| 13985 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13986 | pin = spec->autocfg.speaker_pins[0]; |
| 13987 | if (pin) |
| 13988 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13989 | } |
| 13990 | |
| 13991 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13992 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13993 | |
| 13994 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13995 | { |
| 13996 | struct alc_spec *spec = codec->spec; |
| 13997 | int i; |
| 13998 | |
| 13999 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 14000 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 14001 | if (alc662_is_input_pin(nid)) { |
| 14002 | snd_hda_codec_write(codec, nid, 0, |
| 14003 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 14004 | (i <= AUTO_PIN_FRONT_MIC ? |
| 14005 | PIN_VREF80 : PIN_IN)); |
| 14006 | if (nid != ALC662_PIN_CD_NID) |
| 14007 | snd_hda_codec_write(codec, nid, 0, |
| 14008 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 14009 | AMP_OUT_MUTE); |
| 14010 | } |
| 14011 | } |
| 14012 | } |
| 14013 | |
| 14014 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 14015 | { |
| 14016 | struct alc_spec *spec = codec->spec; |
| 14017 | int err; |
| 14018 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 14019 | |
| 14020 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 14021 | alc662_ignore); |
| 14022 | if (err < 0) |
| 14023 | return err; |
| 14024 | if (!spec->autocfg.line_outs) |
| 14025 | return 0; /* can't find valid BIOS pin config */ |
| 14026 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 14027 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 14028 | if (err < 0) |
| 14029 | return err; |
| 14030 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 14031 | if (err < 0) |
| 14032 | return err; |
| 14033 | err = alc662_auto_create_extra_out(spec, |
| 14034 | spec->autocfg.speaker_pins[0], |
| 14035 | "Speaker"); |
| 14036 | if (err < 0) |
| 14037 | return err; |
| 14038 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 14039 | "Headphone"); |
| 14040 | if (err < 0) |
| 14041 | return err; |
| 14042 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 14043 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14044 | return err; |
| 14045 | |
| 14046 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 14047 | |
| 14048 | if (spec->autocfg.dig_out_pin) |
| 14049 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 14050 | |
| 14051 | if (spec->kctl_alloc) |
| 14052 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 14053 | |
| 14054 | spec->num_mux_defs = 1; |
| 14055 | spec->input_mux = &spec->private_imux; |
| 14056 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14057 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14058 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 14059 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14060 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14061 | } |
| 14062 | |
| 14063 | /* additional initialization for auto-configuration model */ |
| 14064 | static void alc662_auto_init(struct hda_codec *codec) |
| 14065 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14066 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14067 | alc662_auto_init_multi_out(codec); |
| 14068 | alc662_auto_init_hp_out(codec); |
| 14069 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 14070 | if (spec->unsol_event) |
| 14071 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14072 | } |
| 14073 | |
| 14074 | static int patch_alc662(struct hda_codec *codec) |
| 14075 | { |
| 14076 | struct alc_spec *spec; |
| 14077 | int err, board_config; |
| 14078 | |
| 14079 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 14080 | if (!spec) |
| 14081 | return -ENOMEM; |
| 14082 | |
| 14083 | codec->spec = spec; |
| 14084 | |
| 14085 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 14086 | alc662_models, |
| 14087 | alc662_cfg_tbl); |
| 14088 | if (board_config < 0) { |
| 14089 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 14090 | "trying auto-probe from BIOS...\n"); |
| 14091 | board_config = ALC662_AUTO; |
| 14092 | } |
| 14093 | |
| 14094 | if (board_config == ALC662_AUTO) { |
| 14095 | /* automatic parse from the BIOS config */ |
| 14096 | err = alc662_parse_auto_config(codec); |
| 14097 | if (err < 0) { |
| 14098 | alc_free(codec); |
| 14099 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 14100 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14101 | printk(KERN_INFO |
| 14102 | "hda_codec: Cannot set up configuration " |
| 14103 | "from BIOS. Using base mode...\n"); |
| 14104 | board_config = ALC662_3ST_2ch_DIG; |
| 14105 | } |
| 14106 | } |
| 14107 | |
| 14108 | if (board_config != ALC662_AUTO) |
| 14109 | setup_preset(spec, &alc662_presets[board_config]); |
| 14110 | |
| 14111 | spec->stream_name_analog = "ALC662 Analog"; |
| 14112 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 14113 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 14114 | |
| 14115 | spec->stream_name_digital = "ALC662 Digital"; |
| 14116 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 14117 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 14118 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 14119 | spec->adc_nids = alc662_adc_nids; |
| 14120 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 14121 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14122 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 14123 | spec->vmaster_nid = 0x02; |
| 14124 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14125 | codec->patch_ops = alc_patch_ops; |
| 14126 | if (board_config == ALC662_AUTO) |
| 14127 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 14128 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 14129 | if (!spec->loopback.amplist) |
| 14130 | spec->loopback.amplist = alc662_loopbacks; |
| 14131 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14132 | |
| 14133 | return 0; |
| 14134 | } |
| 14135 | |
| 14136 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14137 | * patch entries |
| 14138 | */ |
| 14139 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 14140 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14141 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14142 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 14143 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14144 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14145 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14146 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14147 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 14148 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 14149 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 14150 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 14151 | .patch = patch_alc883 }, |
| 14152 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 14153 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 14154 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14155 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14156 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 14157 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 7943a8a | 2008-04-16 17:29:09 +0200 | [diff] [blame] | 14158 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 14159 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 14160 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 14161 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14162 | {} /* terminator */ |
| 14163 | }; |