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" |
| 33 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 34 | #define ALC880_FRONT_EVENT 0x01 |
| 35 | #define ALC880_DCVOL_EVENT 0x02 |
| 36 | #define ALC880_HP_EVENT 0x04 |
| 37 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* ALC880 board config type */ |
| 40 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | ALC880_3ST, |
| 42 | ALC880_3ST_DIG, |
| 43 | ALC880_5ST, |
| 44 | ALC880_5ST_DIG, |
| 45 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 46 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 47 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 48 | ALC880_6ST_DIG, |
| 49 | ALC880_F1734, |
| 50 | ALC880_ASUS, |
| 51 | ALC880_ASUS_DIG, |
| 52 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 53 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 54 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 62 | #ifdef CONFIG_SND_DEBUG |
| 63 | ALC880_TEST, |
| 64 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 65 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 66 | ALC880_MODEL_LAST /* last tag */ |
| 67 | }; |
| 68 | |
| 69 | /* ALC260 models */ |
| 70 | enum { |
| 71 | ALC260_BASIC, |
| 72 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 73 | ALC260_HP_3013, |
| 74 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 75 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 76 | ALC260_WILL, |
| 77 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_SND_DEBUG |
| 79 | ALC260_TEST, |
| 80 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 81 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 82 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | /* ALC262 models */ |
| 86 | enum { |
| 87 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 88 | ALC262_HIPPO, |
| 89 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 90 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 91 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 92 | ALC262_HP_BPC_D7000_WL, |
| 93 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 94 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 95 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 96 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 97 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 98 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 99 | ALC262_ULTRA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 100 | ALC262_AUTO, |
| 101 | ALC262_MODEL_LAST /* last tag */ |
| 102 | }; |
| 103 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 104 | /* ALC268 models */ |
| 105 | enum { |
| 106 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 107 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 108 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 109 | ALC268_DELL, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 110 | ALC268_ZEPTO, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 111 | #ifdef CONFIG_SND_DEBUG |
| 112 | ALC268_TEST, |
| 113 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 114 | ALC268_AUTO, |
| 115 | ALC268_MODEL_LAST /* last tag */ |
| 116 | }; |
| 117 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 118 | /* ALC269 models */ |
| 119 | enum { |
| 120 | ALC269_BASIC, |
| 121 | ALC269_AUTO, |
| 122 | ALC269_MODEL_LAST /* last tag */ |
| 123 | }; |
| 124 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 125 | /* ALC861 models */ |
| 126 | enum { |
| 127 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 128 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 129 | ALC861_3ST_DIG, |
| 130 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 131 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 132 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 133 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 134 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 135 | ALC861_AUTO, |
| 136 | ALC861_MODEL_LAST, |
| 137 | }; |
| 138 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 139 | /* ALC861-VD models */ |
| 140 | enum { |
| 141 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 142 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 143 | ALC861VD_3ST, |
| 144 | ALC861VD_3ST_DIG, |
| 145 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 146 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 147 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 148 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 149 | ALC861VD_AUTO, |
| 150 | ALC861VD_MODEL_LAST, |
| 151 | }; |
| 152 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 153 | /* ALC662 models */ |
| 154 | enum { |
| 155 | ALC662_3ST_2ch_DIG, |
| 156 | ALC662_3ST_6ch_DIG, |
| 157 | ALC662_3ST_6ch, |
| 158 | ALC662_5ST_DIG, |
| 159 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 160 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 161 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 162 | ALC662_AUTO, |
| 163 | ALC662_MODEL_LAST, |
| 164 | }; |
| 165 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 166 | /* ALC882 models */ |
| 167 | enum { |
| 168 | ALC882_3ST_DIG, |
| 169 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 170 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 171 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 172 | ALC882_TARGA, |
| 173 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 174 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 175 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 176 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 177 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 178 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 179 | ALC882_MODEL_LAST, |
| 180 | }; |
| 181 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 182 | /* ALC883 models */ |
| 183 | enum { |
| 184 | ALC883_3ST_2ch_DIG, |
| 185 | ALC883_3ST_6ch_DIG, |
| 186 | ALC883_3ST_6ch, |
| 187 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 188 | ALC883_TARGA_DIG, |
| 189 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 190 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 191 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 192 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 193 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 194 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 195 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 196 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 197 | ALC888_LENOVO_MS7195_DIG, |
| 198 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 199 | ALC888_6ST_HP, |
| 200 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 201 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 202 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 203 | ALC883_AUTO, |
| 204 | ALC883_MODEL_LAST, |
| 205 | }; |
| 206 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 207 | /* for GPIO Poll */ |
| 208 | #define GPIO_MASK 0x03 |
| 209 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | struct alc_spec { |
| 211 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 212 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 213 | unsigned int num_mixers; |
| 214 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 215 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 216 | * don't forget NULL |
| 217 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 218 | */ |
| 219 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 220 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 221 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | struct hda_pcm_stream *stream_analog_playback; |
| 223 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 224 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 225 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 226 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 227 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | struct hda_pcm_stream *stream_digital_playback; |
| 229 | struct hda_pcm_stream *stream_digital_capture; |
| 230 | |
| 231 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 232 | struct hda_multi_out multiout; /* playback set-up |
| 233 | * max_channels, dacs must be set |
| 234 | * dig_out_nid and hp_nid are optional |
| 235 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 236 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
| 238 | /* capture */ |
| 239 | unsigned int num_adc_nids; |
| 240 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 241 | hda_nid_t *capsrc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 242 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | |
| 244 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 245 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 246 | const struct hda_input_mux *input_mux; |
| 247 | unsigned int cur_mux[3]; |
| 248 | |
| 249 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 250 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 252 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 253 | |
| 254 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 255 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 256 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 257 | /* dynamic controls, init_verbs and input_mux */ |
| 258 | struct auto_pin_cfg autocfg; |
| 259 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 260 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 261 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 262 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 263 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 264 | /* hooks */ |
| 265 | void (*init_hook)(struct hda_codec *codec); |
| 266 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 267 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 268 | /* for pin sensing */ |
| 269 | unsigned int sense_updated: 1; |
| 270 | unsigned int jack_present: 1; |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 271 | unsigned int master_sw: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 272 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 273 | /* for virtual master */ |
| 274 | hda_nid_t vmaster_nid; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 275 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 276 | struct hda_loopback_check loopback; |
| 277 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 278 | }; |
| 279 | |
| 280 | /* |
| 281 | * configuration template - to be copied to the spec instance |
| 282 | */ |
| 283 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 284 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 285 | * with spec |
| 286 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 287 | const struct hda_verb *init_verbs[5]; |
| 288 | unsigned int num_dacs; |
| 289 | hda_nid_t *dac_nids; |
| 290 | hda_nid_t dig_out_nid; /* optional */ |
| 291 | hda_nid_t hp_nid; /* optional */ |
| 292 | unsigned int num_adc_nids; |
| 293 | hda_nid_t *adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 294 | hda_nid_t *capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 295 | hda_nid_t dig_in_nid; |
| 296 | unsigned int num_channel_mode; |
| 297 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 298 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 299 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 300 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 301 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 302 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 304 | struct hda_amp_list *loopbacks; |
| 305 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | }; |
| 307 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 308 | |
| 309 | /* |
| 310 | * input MUX handling |
| 311 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 312 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 313 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 314 | { |
| 315 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 316 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 317 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 318 | if (mux_idx >= spec->num_mux_defs) |
| 319 | mux_idx = 0; |
| 320 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | } |
| 322 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 323 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 324 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 325 | { |
| 326 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 327 | struct alc_spec *spec = codec->spec; |
| 328 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 329 | |
| 330 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 331 | return 0; |
| 332 | } |
| 333 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 334 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 335 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | { |
| 337 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 338 | struct alc_spec *spec = codec->spec; |
| 339 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 340 | 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] | 341 | hda_nid_t nid = spec->capsrc_nids ? |
| 342 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 343 | 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] | 344 | nid, &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 345 | } |
| 346 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 347 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | /* |
| 349 | * channel mode setting |
| 350 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 351 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 352 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | { |
| 354 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 355 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 356 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 357 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | } |
| 359 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 360 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 361 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | { |
| 363 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 364 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 365 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 366 | spec->num_channel_mode, |
| 367 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | } |
| 369 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 370 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 371 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 372 | { |
| 373 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 374 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 375 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 376 | spec->num_channel_mode, |
| 377 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 378 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 379 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 380 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 381 | } |
| 382 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 384 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 385 | * instead of "%" to avoid consequences of accidently treating the % as |
| 386 | * being part of a format specifier. Maximum allowed length of a value is |
| 387 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 388 | * |
| 389 | * Note: some retasking pin complexes seem to ignore requests for input |
| 390 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 391 | * are requested. Therefore order this list so that this behaviour will not |
| 392 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 393 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 394 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 395 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 396 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 397 | "Mic 50pc bias", "Mic 80pc bias", |
| 398 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 399 | }; |
| 400 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 401 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 402 | }; |
| 403 | /* 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] | 404 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 405 | * addition, "input" pins may or may not process the mic bias option |
| 406 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 407 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 408 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 409 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 410 | #define ALC_PIN_DIR_IN 0x00 |
| 411 | #define ALC_PIN_DIR_OUT 0x01 |
| 412 | #define ALC_PIN_DIR_INOUT 0x02 |
| 413 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 414 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 415 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 416 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 417 | * For each direction the minimum and maximum values are given. |
| 418 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 420 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 421 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 422 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 423 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 424 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 425 | }; |
| 426 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 427 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 428 | #define alc_pin_mode_n_items(_dir) \ |
| 429 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 430 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 431 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 432 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 433 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 434 | unsigned int item_num = uinfo->value.enumerated.item; |
| 435 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 436 | |
| 437 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 438 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 439 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 440 | |
| 441 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 442 | item_num = alc_pin_mode_min(dir); |
| 443 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 444 | return 0; |
| 445 | } |
| 446 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 447 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 448 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 449 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 450 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 451 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 452 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 453 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 454 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 455 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 456 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 457 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 458 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 459 | /* Find enumerated value for current pinctl setting */ |
| 460 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 461 | 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] | 462 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 463 | *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] | 464 | return 0; |
| 465 | } |
| 466 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 467 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 468 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 469 | { |
| 470 | signed int change; |
| 471 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 472 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 473 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 474 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 475 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 476 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 477 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 478 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 479 | 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] | 480 | val = alc_pin_mode_min(dir); |
| 481 | |
| 482 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 483 | if (change) { |
| 484 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 485 | snd_hda_codec_write_cache(codec, nid, 0, |
| 486 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 487 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 488 | |
| 489 | /* Also enable the retasking pin's input/output as required |
| 490 | * for the requested pin mode. Enum values of 2 or less are |
| 491 | * input modes. |
| 492 | * |
| 493 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 494 | * reduces noise slightly (particularly on input) so we'll |
| 495 | * do it. However, having both input and output buffers |
| 496 | * enabled simultaneously doesn't seem to be problematic if |
| 497 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 498 | */ |
| 499 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 500 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 501 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 502 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 503 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 504 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 505 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 506 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 507 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 508 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 509 | } |
| 510 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 511 | return change; |
| 512 | } |
| 513 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 514 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 515 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 516 | .info = alc_pin_mode_info, \ |
| 517 | .get = alc_pin_mode_get, \ |
| 518 | .put = alc_pin_mode_put, \ |
| 519 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 520 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 521 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 522 | * together using a mask with more than one bit set. This control is |
| 523 | * currently used only by the ALC260 test model. At this stage they are not |
| 524 | * needed for any "production" models. |
| 525 | */ |
| 526 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 527 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 528 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 529 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 530 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 531 | { |
| 532 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 533 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 534 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 535 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 536 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 537 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 538 | |
| 539 | *valp = (val & mask) != 0; |
| 540 | return 0; |
| 541 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 542 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 543 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 544 | { |
| 545 | signed int change; |
| 546 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 547 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 548 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 549 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 550 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 551 | AC_VERB_GET_GPIO_DATA, |
| 552 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 553 | |
| 554 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 555 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 556 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 557 | gpio_data &= ~mask; |
| 558 | else |
| 559 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 560 | snd_hda_codec_write_cache(codec, nid, 0, |
| 561 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 562 | |
| 563 | return change; |
| 564 | } |
| 565 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 566 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 567 | .info = alc_gpio_data_info, \ |
| 568 | .get = alc_gpio_data_get, \ |
| 569 | .put = alc_gpio_data_put, \ |
| 570 | .private_value = nid | (mask<<16) } |
| 571 | #endif /* CONFIG_SND_DEBUG */ |
| 572 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 573 | /* A switch control to allow the enabling of the digital IO pins on the |
| 574 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 575 | * to provide something in the test model allowing digital outputs to be |
| 576 | * identified if present. If models are found which can utilise these |
| 577 | * outputs a more complete mixer control can be devised for those models if |
| 578 | * necessary. |
| 579 | */ |
| 580 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 581 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 582 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 583 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 584 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 585 | { |
| 586 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 587 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 588 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 589 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 590 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 591 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 592 | |
| 593 | *valp = (val & mask) != 0; |
| 594 | return 0; |
| 595 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 596 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 597 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 598 | { |
| 599 | signed int change; |
| 600 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 601 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 602 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 603 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 604 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 605 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 606 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 607 | |
| 608 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 609 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 610 | if (val==0) |
| 611 | ctrl_data &= ~mask; |
| 612 | else |
| 613 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 614 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 615 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 616 | |
| 617 | return change; |
| 618 | } |
| 619 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 620 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 621 | .info = alc_spdif_ctrl_info, \ |
| 622 | .get = alc_spdif_ctrl_get, \ |
| 623 | .put = alc_spdif_ctrl_put, \ |
| 624 | .private_value = nid | (mask<<16) } |
| 625 | #endif /* CONFIG_SND_DEBUG */ |
| 626 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 627 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 628 | * Again, this is only used in the ALC26x test models to help identify when |
| 629 | * the EAPD line must be asserted for features to work. |
| 630 | */ |
| 631 | #ifdef CONFIG_SND_DEBUG |
| 632 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 633 | |
| 634 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 635 | struct snd_ctl_elem_value *ucontrol) |
| 636 | { |
| 637 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 638 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 639 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 640 | long *valp = ucontrol->value.integer.value; |
| 641 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 642 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 643 | |
| 644 | *valp = (val & mask) != 0; |
| 645 | return 0; |
| 646 | } |
| 647 | |
| 648 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 649 | struct snd_ctl_elem_value *ucontrol) |
| 650 | { |
| 651 | int change; |
| 652 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 653 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 654 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 655 | long val = *ucontrol->value.integer.value; |
| 656 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 657 | AC_VERB_GET_EAPD_BTLENABLE, |
| 658 | 0x00); |
| 659 | |
| 660 | /* Set/unset the masked control bit(s) as needed */ |
| 661 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 662 | if (!val) |
| 663 | ctrl_data &= ~mask; |
| 664 | else |
| 665 | ctrl_data |= mask; |
| 666 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 667 | ctrl_data); |
| 668 | |
| 669 | return change; |
| 670 | } |
| 671 | |
| 672 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 673 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 674 | .info = alc_eapd_ctrl_info, \ |
| 675 | .get = alc_eapd_ctrl_get, \ |
| 676 | .put = alc_eapd_ctrl_put, \ |
| 677 | .private_value = nid | (mask<<16) } |
| 678 | #endif /* CONFIG_SND_DEBUG */ |
| 679 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 680 | /* |
| 681 | * set up from the preset table |
| 682 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 683 | static void setup_preset(struct alc_spec *spec, |
| 684 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 685 | { |
| 686 | int i; |
| 687 | |
| 688 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 689 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 690 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 691 | i++) |
| 692 | spec->init_verbs[spec->num_init_verbs++] = |
| 693 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 694 | |
| 695 | spec->channel_mode = preset->channel_mode; |
| 696 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 697 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 698 | |
| 699 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 700 | |
| 701 | spec->multiout.num_dacs = preset->num_dacs; |
| 702 | spec->multiout.dac_nids = preset->dac_nids; |
| 703 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 704 | spec->multiout.hp_nid = preset->hp_nid; |
| 705 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 706 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 707 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 708 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 709 | spec->input_mux = preset->input_mux; |
| 710 | |
| 711 | spec->num_adc_nids = preset->num_adc_nids; |
| 712 | spec->adc_nids = preset->adc_nids; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 713 | spec->capsrc_nids = preset->capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 714 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 715 | |
| 716 | spec->unsol_event = preset->unsol_event; |
| 717 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 718 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 719 | spec->loopback.amplist = preset->loopbacks; |
| 720 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 721 | } |
| 722 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 723 | /* Enable GPIO mask and set output */ |
| 724 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 725 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 726 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 727 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 728 | { } |
| 729 | }; |
| 730 | |
| 731 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 732 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 733 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 734 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 735 | { } |
| 736 | }; |
| 737 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 738 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 739 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 740 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 741 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 742 | { } |
| 743 | }; |
| 744 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 745 | static void alc_sku_automute(struct hda_codec *codec) |
| 746 | { |
| 747 | struct alc_spec *spec = codec->spec; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 748 | unsigned int present; |
| 749 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 750 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 751 | |
| 752 | /* need to execute and sync at first */ |
| 753 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 754 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 755 | AC_VERB_GET_PIN_SENSE, 0); |
| 756 | spec->jack_present = (present & 0x80000000) != 0; |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 757 | snd_hda_codec_write(codec, sp_nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 758 | spec->jack_present ? 0 : PIN_OUT); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 759 | } |
| 760 | |
| 761 | /* unsolicited event for HP jack sensing */ |
| 762 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 763 | { |
| 764 | if (codec->vendor_id == 0x10ec0880) |
| 765 | res >>= 28; |
| 766 | else |
| 767 | res >>= 26; |
| 768 | if (res != ALC880_HP_EVENT) |
| 769 | return; |
| 770 | |
| 771 | alc_sku_automute(codec); |
| 772 | } |
| 773 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 774 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 775 | * 31 ~ 16 : Manufacture ID |
| 776 | * 15 ~ 8 : SKU ID |
| 777 | * 7 ~ 0 : Assembly ID |
| 778 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 779 | */ |
| 780 | static void alc_subsystem_id(struct hda_codec *codec, |
| 781 | unsigned int porta, unsigned int porte, |
| 782 | unsigned int portd) |
| 783 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 784 | unsigned int ass, tmp, i; |
| 785 | unsigned nid; |
| 786 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 787 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 788 | ass = codec->subsystem_id & 0xffff; |
| 789 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 790 | goto do_sku; |
| 791 | |
| 792 | /* |
| 793 | * 31~30 : port conetcivity |
| 794 | * 29~21 : reserve |
| 795 | * 20 : PCBEEP input |
| 796 | * 19~16 : Check sum (15:1) |
| 797 | * 15~1 : Custom |
| 798 | * 0 : override |
| 799 | */ |
| 800 | nid = 0x1d; |
| 801 | if (codec->vendor_id == 0x10ec0260) |
| 802 | nid = 0x17; |
| 803 | ass = snd_hda_codec_read(codec, nid, 0, |
| 804 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 805 | if (!(ass & 1) && !(ass & 0x100000)) |
| 806 | return; |
| 807 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 808 | return; |
| 809 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 810 | /* check sum */ |
| 811 | tmp = 0; |
| 812 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 813 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 814 | tmp++; |
| 815 | } |
| 816 | if (((ass >> 16) & 0xf) != tmp) |
| 817 | return; |
| 818 | do_sku: |
| 819 | /* |
| 820 | * 0 : override |
| 821 | * 1 : Swap Jack |
| 822 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 823 | * 3~5 : External Amplifier control |
| 824 | * 7~6 : Reserved |
| 825 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 826 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 827 | switch (tmp) { |
| 828 | case 1: |
| 829 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 830 | break; |
| 831 | case 3: |
| 832 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 833 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 834 | case 7: |
| 835 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 836 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 837 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 838 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 839 | case 0x10ec0260: |
| 840 | snd_hda_codec_write(codec, 0x0f, 0, |
| 841 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 842 | snd_hda_codec_write(codec, 0x10, 0, |
| 843 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 844 | break; |
| 845 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 846 | case 0x10ec0267: |
| 847 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 848 | case 0x10ec0269: |
| 849 | case 0x10ec0862: |
| 850 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 851 | snd_hda_codec_write(codec, 0x14, 0, |
| 852 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 853 | snd_hda_codec_write(codec, 0x15, 0, |
| 854 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 855 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 856 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 857 | switch (codec->vendor_id) { |
| 858 | case 0x10ec0260: |
| 859 | snd_hda_codec_write(codec, 0x1a, 0, |
| 860 | AC_VERB_SET_COEF_INDEX, 7); |
| 861 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 862 | AC_VERB_GET_PROC_COEF, 0); |
| 863 | snd_hda_codec_write(codec, 0x1a, 0, |
| 864 | AC_VERB_SET_COEF_INDEX, 7); |
| 865 | snd_hda_codec_write(codec, 0x1a, 0, |
| 866 | AC_VERB_SET_PROC_COEF, |
| 867 | tmp | 0x2010); |
| 868 | break; |
| 869 | case 0x10ec0262: |
| 870 | case 0x10ec0880: |
| 871 | case 0x10ec0882: |
| 872 | case 0x10ec0883: |
| 873 | case 0x10ec0885: |
| 874 | case 0x10ec0888: |
| 875 | snd_hda_codec_write(codec, 0x20, 0, |
| 876 | AC_VERB_SET_COEF_INDEX, 7); |
| 877 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 878 | AC_VERB_GET_PROC_COEF, 0); |
| 879 | snd_hda_codec_write(codec, 0x20, 0, |
| 880 | AC_VERB_SET_COEF_INDEX, 7); |
| 881 | snd_hda_codec_write(codec, 0x20, 0, |
| 882 | AC_VERB_SET_PROC_COEF, |
| 883 | tmp | 0x2010); |
| 884 | break; |
| 885 | case 0x10ec0267: |
| 886 | case 0x10ec0268: |
| 887 | snd_hda_codec_write(codec, 0x20, 0, |
| 888 | AC_VERB_SET_COEF_INDEX, 7); |
| 889 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 890 | AC_VERB_GET_PROC_COEF, 0); |
| 891 | snd_hda_codec_write(codec, 0x20, 0, |
| 892 | AC_VERB_SET_COEF_INDEX, 7); |
| 893 | snd_hda_codec_write(codec, 0x20, 0, |
| 894 | AC_VERB_SET_PROC_COEF, |
| 895 | tmp | 0x3000); |
| 896 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 897 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 898 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 899 | break; |
| 900 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 901 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 902 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 903 | * when the external headphone out jack is plugged" |
| 904 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 905 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 906 | return; |
| 907 | /* |
| 908 | * 10~8 : Jack location |
| 909 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 910 | * 14~13: Resvered |
| 911 | * 15 : 1 --> enable the function "Mute internal speaker |
| 912 | * when the external headphone out jack is plugged" |
| 913 | */ |
| 914 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 915 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 916 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 917 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 918 | else |
| 919 | return; |
| 920 | } |
| 921 | |
| 922 | if (!spec->autocfg.hp_pins[0]) { |
| 923 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 924 | if (tmp == 0) |
| 925 | spec->autocfg.hp_pins[0] = porta; |
| 926 | else if (tmp == 1) |
| 927 | spec->autocfg.hp_pins[0] = porte; |
| 928 | else if (tmp == 2) |
| 929 | spec->autocfg.hp_pins[0] = portd; |
| 930 | else |
| 931 | return; |
| 932 | } |
| 933 | |
| 934 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 935 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 936 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 937 | spec->unsol_event = alc_sku_unsol_event; |
| 938 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 939 | } |
| 940 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 941 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 942 | * Fix-up pin default configurations |
| 943 | */ |
| 944 | |
| 945 | struct alc_pincfg { |
| 946 | hda_nid_t nid; |
| 947 | u32 val; |
| 948 | }; |
| 949 | |
| 950 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 951 | const struct snd_pci_quirk *quirk, |
| 952 | const struct alc_pincfg **pinfix) |
| 953 | { |
| 954 | const struct alc_pincfg *cfg; |
| 955 | |
| 956 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 957 | if (!quirk) |
| 958 | return; |
| 959 | |
| 960 | cfg = pinfix[quirk->value]; |
| 961 | for (; cfg->nid; cfg++) { |
| 962 | int i; |
| 963 | u32 val = cfg->val; |
| 964 | for (i = 0; i < 4; i++) { |
| 965 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 966 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 967 | val & 0xff); |
| 968 | val >>= 8; |
| 969 | } |
| 970 | } |
| 971 | } |
| 972 | |
| 973 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 974 | * ALC880 3-stack model |
| 975 | * |
| 976 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 977 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 978 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 979 | */ |
| 980 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 981 | static hda_nid_t alc880_dac_nids[4] = { |
| 982 | /* front, rear, clfe, rear_surr */ |
| 983 | 0x02, 0x05, 0x04, 0x03 |
| 984 | }; |
| 985 | |
| 986 | static hda_nid_t alc880_adc_nids[3] = { |
| 987 | /* ADC0-2 */ |
| 988 | 0x07, 0x08, 0x09, |
| 989 | }; |
| 990 | |
| 991 | /* The datasheet says the node 0x07 is connected from inputs, |
| 992 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 993 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 994 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 995 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 996 | /* ADC1-2 */ |
| 997 | 0x08, 0x09, |
| 998 | }; |
| 999 | |
| 1000 | #define ALC880_DIGOUT_NID 0x06 |
| 1001 | #define ALC880_DIGIN_NID 0x0a |
| 1002 | |
| 1003 | static struct hda_input_mux alc880_capture_source = { |
| 1004 | .num_items = 4, |
| 1005 | .items = { |
| 1006 | { "Mic", 0x0 }, |
| 1007 | { "Front Mic", 0x3 }, |
| 1008 | { "Line", 0x2 }, |
| 1009 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1010 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1011 | }; |
| 1012 | |
| 1013 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1014 | /* 2ch mode */ |
| 1015 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1016 | /* set line-in to input, mute it */ |
| 1017 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1018 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1019 | /* set mic-in to input vref 80%, mute it */ |
| 1020 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1021 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1022 | { } /* end */ |
| 1023 | }; |
| 1024 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1025 | /* 6ch mode */ |
| 1026 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1027 | /* set line-in to output, unmute it */ |
| 1028 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1029 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1030 | /* set mic-in to output, unmute it */ |
| 1031 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1032 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1033 | { } /* end */ |
| 1034 | }; |
| 1035 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1036 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1037 | { 2, alc880_threestack_ch2_init }, |
| 1038 | { 6, alc880_threestack_ch6_init }, |
| 1039 | }; |
| 1040 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1041 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1042 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1043 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1044 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1045 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1046 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1047 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1048 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1049 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1051 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1052 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1053 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1054 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1055 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1056 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1058 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1059 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1060 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1061 | { |
| 1062 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1063 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1064 | .info = alc_ch_mode_info, |
| 1065 | .get = alc_ch_mode_get, |
| 1066 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1067 | }, |
| 1068 | { } /* end */ |
| 1069 | }; |
| 1070 | |
| 1071 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1072 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1073 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1074 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1075 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1076 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1077 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1078 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1079 | { |
| 1080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1081 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1082 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1083 | */ |
| 1084 | /* .name = "Capture Source", */ |
| 1085 | .name = "Input Source", |
| 1086 | .count = 3, |
| 1087 | .info = alc_mux_enum_info, |
| 1088 | .get = alc_mux_enum_get, |
| 1089 | .put = alc_mux_enum_put, |
| 1090 | }, |
| 1091 | { } /* end */ |
| 1092 | }; |
| 1093 | |
| 1094 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1095 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1096 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1097 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1098 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1099 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1100 | { |
| 1101 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1102 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1103 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1104 | */ |
| 1105 | /* .name = "Capture Source", */ |
| 1106 | .name = "Input Source", |
| 1107 | .count = 2, |
| 1108 | .info = alc_mux_enum_info, |
| 1109 | .get = alc_mux_enum_get, |
| 1110 | .put = alc_mux_enum_put, |
| 1111 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1112 | { } /* end */ |
| 1113 | }; |
| 1114 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1115 | |
| 1116 | |
| 1117 | /* |
| 1118 | * ALC880 5-stack model |
| 1119 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1120 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1121 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1122 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1123 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1124 | */ |
| 1125 | |
| 1126 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1127 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1128 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1129 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1130 | { } /* end */ |
| 1131 | }; |
| 1132 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1133 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1134 | /* 6ch mode */ |
| 1135 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1136 | /* set line-in to input, mute it */ |
| 1137 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1138 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1139 | { } /* end */ |
| 1140 | }; |
| 1141 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1142 | /* 8ch mode */ |
| 1143 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1144 | /* set line-in to output, unmute it */ |
| 1145 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1146 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1147 | { } /* end */ |
| 1148 | }; |
| 1149 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1150 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1151 | { 6, alc880_fivestack_ch6_init }, |
| 1152 | { 8, alc880_fivestack_ch8_init }, |
| 1153 | }; |
| 1154 | |
| 1155 | |
| 1156 | /* |
| 1157 | * ALC880 6-stack model |
| 1158 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1159 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1160 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1161 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1162 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1163 | */ |
| 1164 | |
| 1165 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1166 | /* front, rear, clfe, rear_surr */ |
| 1167 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1168 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1169 | |
| 1170 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1171 | .num_items = 4, |
| 1172 | .items = { |
| 1173 | { "Mic", 0x0 }, |
| 1174 | { "Front Mic", 0x1 }, |
| 1175 | { "Line", 0x2 }, |
| 1176 | { "CD", 0x4 }, |
| 1177 | }, |
| 1178 | }; |
| 1179 | |
| 1180 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1181 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1182 | { 8, NULL }, |
| 1183 | }; |
| 1184 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1185 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1188 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1189 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1190 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1191 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1192 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1193 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1195 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1196 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1197 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1198 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1199 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1200 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1206 | { |
| 1207 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1208 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1209 | .info = alc_ch_mode_info, |
| 1210 | .get = alc_ch_mode_get, |
| 1211 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1212 | }, |
| 1213 | { } /* end */ |
| 1214 | }; |
| 1215 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1216 | |
| 1217 | /* |
| 1218 | * ALC880 W810 model |
| 1219 | * |
| 1220 | * W810 has rear IO for: |
| 1221 | * Front (DAC 02) |
| 1222 | * Surround (DAC 03) |
| 1223 | * Center/LFE (DAC 04) |
| 1224 | * Digital out (06) |
| 1225 | * |
| 1226 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1227 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1228 | * |
| 1229 | * There is a variable resistor to control the speaker or headphone |
| 1230 | * volume. This is a hardware-only device without a software API. |
| 1231 | * |
| 1232 | * Plugging headphones in will disable the internal speakers. This is |
| 1233 | * implemented in hardware, not via the driver using jack sense. In |
| 1234 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1235 | * disable both the speakers and headphones. |
| 1236 | * |
| 1237 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1238 | * These may not do anything useful with this driver yet, because I |
| 1239 | * haven't setup any initialization verbs for these yet... |
| 1240 | */ |
| 1241 | |
| 1242 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1243 | /* front, rear/surround, clfe */ |
| 1244 | 0x02, 0x03, 0x04 |
| 1245 | }; |
| 1246 | |
| 1247 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1248 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1249 | { 6, NULL } |
| 1250 | }; |
| 1251 | |
| 1252 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1253 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1254 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1255 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1256 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1257 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1259 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1260 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1261 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1263 | { } /* end */ |
| 1264 | }; |
| 1265 | |
| 1266 | |
| 1267 | /* |
| 1268 | * Z710V model |
| 1269 | * |
| 1270 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1271 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1272 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1273 | */ |
| 1274 | |
| 1275 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1276 | 0x02 |
| 1277 | }; |
| 1278 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1279 | |
| 1280 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1281 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1282 | { 2, NULL } |
| 1283 | }; |
| 1284 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1285 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1287 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1288 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1289 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1290 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1291 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1292 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1293 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1294 | { } /* end */ |
| 1295 | }; |
| 1296 | |
| 1297 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1298 | /* |
| 1299 | * ALC880 F1734 model |
| 1300 | * |
| 1301 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1302 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1303 | */ |
| 1304 | |
| 1305 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1306 | 0x03 |
| 1307 | }; |
| 1308 | #define ALC880_F1734_HP_DAC 0x02 |
| 1309 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1310 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1311 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1312 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1313 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1314 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1315 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1316 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1318 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1319 | { } /* end */ |
| 1320 | }; |
| 1321 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1322 | static struct hda_input_mux alc880_f1734_capture_source = { |
| 1323 | .num_items = 2, |
| 1324 | .items = { |
| 1325 | { "Mic", 0x1 }, |
| 1326 | { "CD", 0x4 }, |
| 1327 | }, |
| 1328 | }; |
| 1329 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1330 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1331 | /* |
| 1332 | * ALC880 ASUS model |
| 1333 | * |
| 1334 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1335 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1336 | * Mic = 0x18, Line = 0x1a |
| 1337 | */ |
| 1338 | |
| 1339 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1340 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1341 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1342 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1343 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1344 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1345 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1346 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1347 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1348 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1349 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1350 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1351 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1352 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1353 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1354 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1355 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1356 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1357 | { |
| 1358 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1359 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1360 | .info = alc_ch_mode_info, |
| 1361 | .get = alc_ch_mode_get, |
| 1362 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1363 | }, |
| 1364 | { } /* end */ |
| 1365 | }; |
| 1366 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1367 | /* |
| 1368 | * ALC880 ASUS W1V model |
| 1369 | * |
| 1370 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1371 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1372 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1373 | */ |
| 1374 | |
| 1375 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1376 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1377 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1378 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1379 | { } /* end */ |
| 1380 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1381 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1382 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1383 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1384 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1385 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1386 | { } /* end */ |
| 1387 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1388 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1389 | /* TCL S700 */ |
| 1390 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1391 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1392 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1393 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1394 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1397 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1398 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1399 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1400 | { |
| 1401 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1402 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1403 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1404 | */ |
| 1405 | /* .name = "Capture Source", */ |
| 1406 | .name = "Input Source", |
| 1407 | .count = 1, |
| 1408 | .info = alc_mux_enum_info, |
| 1409 | .get = alc_mux_enum_get, |
| 1410 | .put = alc_mux_enum_put, |
| 1411 | }, |
| 1412 | { } /* end */ |
| 1413 | }; |
| 1414 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1415 | /* Uniwill */ |
| 1416 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1417 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1418 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1419 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1420 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1421 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1422 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1423 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1424 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1426 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1427 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1428 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1429 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1430 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1431 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1432 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1433 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1434 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1435 | { |
| 1436 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1437 | .name = "Channel Mode", |
| 1438 | .info = alc_ch_mode_info, |
| 1439 | .get = alc_ch_mode_get, |
| 1440 | .put = alc_ch_mode_put, |
| 1441 | }, |
| 1442 | { } /* end */ |
| 1443 | }; |
| 1444 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1445 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1446 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1447 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1448 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1449 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1450 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1451 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1452 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1453 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1454 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1455 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1456 | { } /* end */ |
| 1457 | }; |
| 1458 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1459 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1460 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1461 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1462 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1463 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1464 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1465 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1466 | { } /* end */ |
| 1467 | }; |
| 1468 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1469 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1470 | * virtual master controls |
| 1471 | */ |
| 1472 | |
| 1473 | /* |
| 1474 | * slave controls for virtual master |
| 1475 | */ |
| 1476 | static const char *alc_slave_vols[] = { |
| 1477 | "Front Playback Volume", |
| 1478 | "Surround Playback Volume", |
| 1479 | "Center Playback Volume", |
| 1480 | "LFE Playback Volume", |
| 1481 | "Side Playback Volume", |
| 1482 | "Headphone Playback Volume", |
| 1483 | "Speaker Playback Volume", |
| 1484 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1485 | "Line-Out Playback Volume", |
| 1486 | NULL, |
| 1487 | }; |
| 1488 | |
| 1489 | static const char *alc_slave_sws[] = { |
| 1490 | "Front Playback Switch", |
| 1491 | "Surround Playback Switch", |
| 1492 | "Center Playback Switch", |
| 1493 | "LFE Playback Switch", |
| 1494 | "Side Playback Switch", |
| 1495 | "Headphone Playback Switch", |
| 1496 | "Speaker Playback Switch", |
| 1497 | "Mono Playback Switch", |
Takashi Iwai | edb54a5 | 2008-01-29 12:47:02 +0100 | [diff] [blame] | 1498 | "IEC958 Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1499 | NULL, |
| 1500 | }; |
| 1501 | |
| 1502 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1503 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1504 | */ |
| 1505 | static int alc_build_controls(struct hda_codec *codec) |
| 1506 | { |
| 1507 | struct alc_spec *spec = codec->spec; |
| 1508 | int err; |
| 1509 | int i; |
| 1510 | |
| 1511 | for (i = 0; i < spec->num_mixers; i++) { |
| 1512 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1513 | if (err < 0) |
| 1514 | return err; |
| 1515 | } |
| 1516 | |
| 1517 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1518 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1519 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1520 | if (err < 0) |
| 1521 | return err; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 1522 | err = snd_hda_create_spdif_share_sw(codec, |
| 1523 | &spec->multiout); |
| 1524 | if (err < 0) |
| 1525 | return err; |
| 1526 | spec->multiout.share_spdif = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1527 | } |
| 1528 | if (spec->dig_in_nid) { |
| 1529 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1530 | if (err < 0) |
| 1531 | return err; |
| 1532 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1533 | |
| 1534 | /* if we have no master control, let's create it */ |
| 1535 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame^] | 1536 | unsigned int vmaster_tlv[4]; |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1537 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame^] | 1538 | HDA_OUTPUT, vmaster_tlv); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1539 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
Takashi Iwai | 1c82ed1 | 2008-02-18 13:05:50 +0100 | [diff] [blame^] | 1540 | vmaster_tlv, alc_slave_vols); |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1541 | if (err < 0) |
| 1542 | return err; |
| 1543 | } |
| 1544 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1545 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1546 | NULL, alc_slave_sws); |
| 1547 | if (err < 0) |
| 1548 | return err; |
| 1549 | } |
| 1550 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1551 | return 0; |
| 1552 | } |
| 1553 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1554 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1555 | /* |
| 1556 | * initialize the codec volumes, etc |
| 1557 | */ |
| 1558 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1559 | /* |
| 1560 | * generic initialization of ADC, input mixers and output mixers |
| 1561 | */ |
| 1562 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1563 | /* |
| 1564 | * Unmute ADC0-2 and set the default input to mic-in |
| 1565 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1566 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1567 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1568 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1569 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1570 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1571 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1572 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1573 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1574 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1575 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1576 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1577 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1578 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1579 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1580 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1581 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1582 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1583 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1584 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1585 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1586 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1587 | /* |
| 1588 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1589 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1590 | /* set vol=0 to output mixers */ |
| 1591 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1592 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1593 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1594 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1595 | /* set up input amps for analog loopback */ |
| 1596 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1597 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1598 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1599 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1600 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1601 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1602 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1603 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1604 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1605 | |
| 1606 | { } |
| 1607 | }; |
| 1608 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1609 | /* |
| 1610 | * 3-stack pin configuration: |
| 1611 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1612 | */ |
| 1613 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1614 | /* |
| 1615 | * preset connection lists of input pins |
| 1616 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1617 | */ |
| 1618 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1619 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1620 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1621 | |
| 1622 | /* |
| 1623 | * Set pin mode and muting |
| 1624 | */ |
| 1625 | /* set front pin widgets 0x14 for output */ |
| 1626 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1627 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1628 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1629 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1630 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1631 | /* Mic2 (as headphone out) for HP output */ |
| 1632 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1633 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1634 | /* Line In pin widget for input */ |
| 1635 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1636 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1637 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1638 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1639 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1640 | /* CD pin widget for input */ |
| 1641 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1642 | |
| 1643 | { } |
| 1644 | }; |
| 1645 | |
| 1646 | /* |
| 1647 | * 5-stack pin configuration: |
| 1648 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1649 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1650 | */ |
| 1651 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1652 | /* |
| 1653 | * preset connection lists of input pins |
| 1654 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1655 | */ |
| 1656 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1657 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1658 | |
| 1659 | /* |
| 1660 | * Set pin mode and muting |
| 1661 | */ |
| 1662 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1663 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1664 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1665 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1666 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1667 | /* unmute pins for output (no gain on this amp) */ |
| 1668 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1669 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1670 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1671 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1672 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1673 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1674 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1675 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1676 | /* Mic2 (as headphone out) for HP output */ |
| 1677 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1678 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1679 | /* Line In pin widget for input */ |
| 1680 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1681 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1682 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1683 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1684 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1685 | /* CD pin widget for input */ |
| 1686 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1687 | |
| 1688 | { } |
| 1689 | }; |
| 1690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1691 | /* |
| 1692 | * W810 pin configuration: |
| 1693 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1694 | */ |
| 1695 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1696 | /* hphone/speaker input selector: front DAC */ |
| 1697 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1698 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1699 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1700 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1701 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1702 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1703 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1704 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1705 | |
| 1706 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1707 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1708 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1709 | { } |
| 1710 | }; |
| 1711 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1712 | /* |
| 1713 | * Z71V pin configuration: |
| 1714 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1715 | */ |
| 1716 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1717 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1718 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1719 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1720 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1721 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1722 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1723 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1724 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1725 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1726 | |
| 1727 | { } |
| 1728 | }; |
| 1729 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1730 | /* |
| 1731 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1732 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1733 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | */ |
| 1735 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1736 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1737 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1738 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1740 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1742 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1743 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1745 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1746 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1747 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1748 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1750 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1751 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1752 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1753 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1754 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1755 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1756 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1757 | { } |
| 1758 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1759 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1760 | /* |
| 1761 | * Uniwill pin configuration: |
| 1762 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1763 | * line = 0x1a |
| 1764 | */ |
| 1765 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1766 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1767 | |
| 1768 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1769 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1770 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1771 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1772 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1773 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1774 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1775 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1776 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1777 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1778 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1779 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1780 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1781 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1782 | |
| 1783 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1784 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1785 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1786 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1787 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1788 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1789 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1790 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1791 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1792 | |
| 1793 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1794 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1795 | |
| 1796 | { } |
| 1797 | }; |
| 1798 | |
| 1799 | /* |
| 1800 | * Uniwill P53 |
| 1801 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1802 | */ |
| 1803 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1804 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1805 | |
| 1806 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1808 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1810 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1811 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1812 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1815 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1816 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1817 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1818 | |
| 1819 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1820 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1821 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1822 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1823 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1824 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1825 | |
| 1826 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1827 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1828 | |
| 1829 | { } |
| 1830 | }; |
| 1831 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1832 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1833 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1834 | { } |
| 1835 | }; |
| 1836 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1837 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1838 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1839 | { |
| 1840 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1841 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1842 | |
| 1843 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1844 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1845 | bits = present ? HDA_AMP_MUTE : 0; |
| 1846 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1847 | HDA_AMP_MUTE, bits); |
| 1848 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1849 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1850 | } |
| 1851 | |
| 1852 | /* auto-toggle front mic */ |
| 1853 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1854 | { |
| 1855 | unsigned int present; |
| 1856 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1857 | |
| 1858 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1859 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1860 | bits = present ? HDA_AMP_MUTE : 0; |
| 1861 | 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] | 1862 | } |
| 1863 | |
| 1864 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1865 | { |
| 1866 | alc880_uniwill_hp_automute(codec); |
| 1867 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1868 | } |
| 1869 | |
| 1870 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1871 | unsigned int res) |
| 1872 | { |
| 1873 | /* Looks like the unsol event is incompatible with the standard |
| 1874 | * definition. 4bit tag is placed at 28 bit! |
| 1875 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1876 | switch (res >> 28) { |
| 1877 | case ALC880_HP_EVENT: |
| 1878 | alc880_uniwill_hp_automute(codec); |
| 1879 | break; |
| 1880 | case ALC880_MIC_EVENT: |
| 1881 | alc880_uniwill_mic_automute(codec); |
| 1882 | break; |
| 1883 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1884 | } |
| 1885 | |
| 1886 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1887 | { |
| 1888 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1889 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1890 | |
| 1891 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1892 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1893 | bits = present ? HDA_AMP_MUTE : 0; |
| 1894 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1895 | } |
| 1896 | |
| 1897 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1898 | { |
| 1899 | unsigned int present; |
| 1900 | |
| 1901 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1902 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1903 | present &= HDA_AMP_VOLMASK; |
| 1904 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1905 | HDA_AMP_VOLMASK, present); |
| 1906 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1907 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1908 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1909 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1910 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1911 | unsigned int res) |
| 1912 | { |
| 1913 | /* Looks like the unsol event is incompatible with the standard |
| 1914 | * definition. 4bit tag is placed at 28 bit! |
| 1915 | */ |
| 1916 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1917 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1918 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1919 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1920 | } |
| 1921 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1922 | /* |
| 1923 | * F1734 pin configuration: |
| 1924 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1925 | */ |
| 1926 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1927 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1928 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1929 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1930 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1931 | |
| 1932 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1933 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1934 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1936 | |
| 1937 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1938 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1939 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1940 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1941 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1942 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1943 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1944 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1945 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1946 | |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 1947 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
| 1948 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_DCVOL_EVENT}, |
| 1949 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1950 | { } |
| 1951 | }; |
| 1952 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1953 | /* |
| 1954 | * ASUS pin configuration: |
| 1955 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1956 | */ |
| 1957 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1958 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1959 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1960 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1961 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1962 | |
| 1963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1966 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1967 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1968 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1969 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1970 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1971 | |
| 1972 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1973 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1974 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1975 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1976 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1977 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1978 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1979 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1980 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1981 | |
| 1982 | { } |
| 1983 | }; |
| 1984 | |
| 1985 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1986 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1987 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1988 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1989 | /* Clevo m520g init */ |
| 1990 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1991 | /* headphone output */ |
| 1992 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1993 | /* line-out */ |
| 1994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1995 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1996 | /* Line-in */ |
| 1997 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1998 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1999 | /* CD */ |
| 2000 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2001 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2002 | /* Mic1 (rear panel) */ |
| 2003 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2004 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2005 | /* Mic2 (front panel) */ |
| 2006 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2007 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2008 | /* headphone */ |
| 2009 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2010 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2011 | /* change to EAPD mode */ |
| 2012 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2013 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2014 | |
| 2015 | { } |
| 2016 | }; |
| 2017 | |
| 2018 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2019 | /* change to EAPD mode */ |
| 2020 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2021 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2022 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2023 | /* Headphone output */ |
| 2024 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2025 | /* Front output*/ |
| 2026 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2027 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2028 | |
| 2029 | /* Line In pin widget for input */ |
| 2030 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2031 | /* CD pin widget for input */ |
| 2032 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2033 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2034 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2035 | |
| 2036 | /* change to EAPD mode */ |
| 2037 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2038 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2039 | |
| 2040 | { } |
| 2041 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2042 | |
| 2043 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2044 | * LG m1 express dual |
| 2045 | * |
| 2046 | * Pin assignment: |
| 2047 | * Rear Line-In/Out (blue): 0x14 |
| 2048 | * Build-in Mic-In: 0x15 |
| 2049 | * Speaker-out: 0x17 |
| 2050 | * HP-Out (green): 0x1b |
| 2051 | * Mic-In/Out (red): 0x19 |
| 2052 | * SPDIF-Out: 0x1e |
| 2053 | */ |
| 2054 | |
| 2055 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2056 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2057 | 0x05, 0x02, 0x03 |
| 2058 | }; |
| 2059 | |
| 2060 | /* seems analog CD is not working */ |
| 2061 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2062 | .num_items = 3, |
| 2063 | .items = { |
| 2064 | { "Mic", 0x1 }, |
| 2065 | { "Line", 0x5 }, |
| 2066 | { "Internal Mic", 0x6 }, |
| 2067 | }, |
| 2068 | }; |
| 2069 | |
| 2070 | /* 2,4,6 channel modes */ |
| 2071 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2072 | /* set line-in and mic-in to input */ |
| 2073 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2074 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2075 | { } |
| 2076 | }; |
| 2077 | |
| 2078 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2079 | /* set line-in to out and mic-in to input */ |
| 2080 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2081 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2082 | { } |
| 2083 | }; |
| 2084 | |
| 2085 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2086 | /* set line-in and mic-in to output */ |
| 2087 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2088 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2089 | { } |
| 2090 | }; |
| 2091 | |
| 2092 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2093 | { 2, alc880_lg_ch2_init }, |
| 2094 | { 4, alc880_lg_ch4_init }, |
| 2095 | { 6, alc880_lg_ch6_init }, |
| 2096 | }; |
| 2097 | |
| 2098 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2099 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2100 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2101 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2102 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2103 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2104 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2105 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2106 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2107 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2108 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2109 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2110 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2111 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2112 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2113 | { |
| 2114 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2115 | .name = "Channel Mode", |
| 2116 | .info = alc_ch_mode_info, |
| 2117 | .get = alc_ch_mode_get, |
| 2118 | .put = alc_ch_mode_put, |
| 2119 | }, |
| 2120 | { } /* end */ |
| 2121 | }; |
| 2122 | |
| 2123 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2124 | /* set capture source to mic-in */ |
| 2125 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2126 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2128 | /* mute all amp mixer inputs */ |
| 2129 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2130 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2131 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2132 | /* line-in to input */ |
| 2133 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2134 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2135 | /* built-in mic */ |
| 2136 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2137 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2138 | /* speaker-out */ |
| 2139 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2140 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2141 | /* mic-in to input */ |
| 2142 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2143 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2144 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2145 | /* HP-out */ |
| 2146 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2147 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2148 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2149 | /* jack sense */ |
| 2150 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2151 | { } |
| 2152 | }; |
| 2153 | |
| 2154 | /* toggle speaker-output according to the hp-jack state */ |
| 2155 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2156 | { |
| 2157 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2158 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2159 | |
| 2160 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2161 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2162 | bits = present ? HDA_AMP_MUTE : 0; |
| 2163 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2164 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2165 | } |
| 2166 | |
| 2167 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2168 | { |
| 2169 | /* Looks like the unsol event is incompatible with the standard |
| 2170 | * definition. 4bit tag is placed at 28 bit! |
| 2171 | */ |
| 2172 | if ((res >> 28) == 0x01) |
| 2173 | alc880_lg_automute(codec); |
| 2174 | } |
| 2175 | |
| 2176 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2177 | * LG LW20 |
| 2178 | * |
| 2179 | * Pin assignment: |
| 2180 | * Speaker-out: 0x14 |
| 2181 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2182 | * Built-in Mic-In: 0x19 |
| 2183 | * Line-In: 0x1b |
| 2184 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2185 | * SPDIF-Out: 0x1e |
| 2186 | */ |
| 2187 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2188 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2189 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2190 | .items = { |
| 2191 | { "Mic", 0x0 }, |
| 2192 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2193 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2194 | }, |
| 2195 | }; |
| 2196 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2197 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2198 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2199 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2200 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2201 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2202 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2203 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2204 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2205 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2206 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2207 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2208 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2209 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2210 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2211 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2212 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2213 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2214 | { |
| 2215 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2216 | .name = "Channel Mode", |
| 2217 | .info = alc_ch_mode_info, |
| 2218 | .get = alc_ch_mode_get, |
| 2219 | .put = alc_ch_mode_put, |
| 2220 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2221 | { } /* end */ |
| 2222 | }; |
| 2223 | |
| 2224 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2225 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2226 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2227 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2228 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2229 | /* set capture source to mic-in */ |
| 2230 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2231 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2232 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2233 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2234 | /* speaker-out */ |
| 2235 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2236 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2237 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2238 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2239 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2240 | /* mic-in to input */ |
| 2241 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2242 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2243 | /* built-in mic */ |
| 2244 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2245 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2246 | /* jack sense */ |
| 2247 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2248 | { } |
| 2249 | }; |
| 2250 | |
| 2251 | /* toggle speaker-output according to the hp-jack state */ |
| 2252 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2253 | { |
| 2254 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2255 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2256 | |
| 2257 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2258 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2259 | bits = present ? HDA_AMP_MUTE : 0; |
| 2260 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2261 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2262 | } |
| 2263 | |
| 2264 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2265 | { |
| 2266 | /* Looks like the unsol event is incompatible with the standard |
| 2267 | * definition. 4bit tag is placed at 28 bit! |
| 2268 | */ |
| 2269 | if ((res >> 28) == 0x01) |
| 2270 | alc880_lg_lw_automute(codec); |
| 2271 | } |
| 2272 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2273 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2274 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2275 | { 0x0b, HDA_INPUT, 0 }, |
| 2276 | { 0x0b, HDA_INPUT, 1 }, |
| 2277 | { 0x0b, HDA_INPUT, 2 }, |
| 2278 | { 0x0b, HDA_INPUT, 3 }, |
| 2279 | { 0x0b, HDA_INPUT, 4 }, |
| 2280 | { } /* end */ |
| 2281 | }; |
| 2282 | |
| 2283 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2284 | { 0x0b, HDA_INPUT, 1 }, |
| 2285 | { 0x0b, HDA_INPUT, 6 }, |
| 2286 | { 0x0b, HDA_INPUT, 7 }, |
| 2287 | { } /* end */ |
| 2288 | }; |
| 2289 | #endif |
| 2290 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2291 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2292 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2293 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2294 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2295 | static int alc_init(struct hda_codec *codec) |
| 2296 | { |
| 2297 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2298 | unsigned int i; |
| 2299 | |
| 2300 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2301 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2302 | |
| 2303 | if (spec->init_hook) |
| 2304 | spec->init_hook(codec); |
| 2305 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2306 | return 0; |
| 2307 | } |
| 2308 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2309 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2310 | { |
| 2311 | struct alc_spec *spec = codec->spec; |
| 2312 | |
| 2313 | if (spec->unsol_event) |
| 2314 | spec->unsol_event(codec, res); |
| 2315 | } |
| 2316 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2317 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2318 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2319 | { |
| 2320 | struct alc_spec *spec = codec->spec; |
| 2321 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2322 | } |
| 2323 | #endif |
| 2324 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2325 | /* |
| 2326 | * Analog playback callbacks |
| 2327 | */ |
| 2328 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2329 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2330 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2331 | { |
| 2332 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9a08160 | 2008-02-12 18:37:26 +0100 | [diff] [blame] | 2333 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2334 | hinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2335 | } |
| 2336 | |
| 2337 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2338 | struct hda_codec *codec, |
| 2339 | unsigned int stream_tag, |
| 2340 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2341 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2342 | { |
| 2343 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2344 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2345 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2346 | } |
| 2347 | |
| 2348 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2349 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2350 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2351 | { |
| 2352 | struct alc_spec *spec = codec->spec; |
| 2353 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2354 | } |
| 2355 | |
| 2356 | /* |
| 2357 | * Digital out |
| 2358 | */ |
| 2359 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2360 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2361 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2362 | { |
| 2363 | struct alc_spec *spec = codec->spec; |
| 2364 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2365 | } |
| 2366 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2367 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2368 | struct hda_codec *codec, |
| 2369 | unsigned int stream_tag, |
| 2370 | unsigned int format, |
| 2371 | struct snd_pcm_substream *substream) |
| 2372 | { |
| 2373 | struct alc_spec *spec = codec->spec; |
| 2374 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2375 | stream_tag, format, substream); |
| 2376 | } |
| 2377 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2378 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2379 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2380 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2381 | { |
| 2382 | struct alc_spec *spec = codec->spec; |
| 2383 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2384 | } |
| 2385 | |
| 2386 | /* |
| 2387 | * Analog capture |
| 2388 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2389 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | struct hda_codec *codec, |
| 2391 | unsigned int stream_tag, |
| 2392 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2393 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2394 | { |
| 2395 | struct alc_spec *spec = codec->spec; |
| 2396 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2397 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2398 | stream_tag, 0, format); |
| 2399 | return 0; |
| 2400 | } |
| 2401 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2402 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2403 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2404 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2405 | { |
| 2406 | struct alc_spec *spec = codec->spec; |
| 2407 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2408 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2409 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2410 | return 0; |
| 2411 | } |
| 2412 | |
| 2413 | |
| 2414 | /* |
| 2415 | */ |
| 2416 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2417 | .substreams = 1, |
| 2418 | .channels_min = 2, |
| 2419 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2420 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2421 | .ops = { |
| 2422 | .open = alc880_playback_pcm_open, |
| 2423 | .prepare = alc880_playback_pcm_prepare, |
| 2424 | .cleanup = alc880_playback_pcm_cleanup |
| 2425 | }, |
| 2426 | }; |
| 2427 | |
| 2428 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2429 | .substreams = 1, |
| 2430 | .channels_min = 2, |
| 2431 | .channels_max = 2, |
| 2432 | /* NID is set in alc_build_pcms */ |
| 2433 | }; |
| 2434 | |
| 2435 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2436 | .substreams = 1, |
| 2437 | .channels_min = 2, |
| 2438 | .channels_max = 2, |
| 2439 | /* NID is set in alc_build_pcms */ |
| 2440 | }; |
| 2441 | |
| 2442 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2443 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2444 | .channels_min = 2, |
| 2445 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2446 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2447 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2448 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2449 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2450 | }, |
| 2451 | }; |
| 2452 | |
| 2453 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2454 | .substreams = 1, |
| 2455 | .channels_min = 2, |
| 2456 | .channels_max = 2, |
| 2457 | /* NID is set in alc_build_pcms */ |
| 2458 | .ops = { |
| 2459 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2460 | .close = alc880_dig_playback_pcm_close, |
| 2461 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2462 | }, |
| 2463 | }; |
| 2464 | |
| 2465 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2466 | .substreams = 1, |
| 2467 | .channels_min = 2, |
| 2468 | .channels_max = 2, |
| 2469 | /* NID is set in alc_build_pcms */ |
| 2470 | }; |
| 2471 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2472 | /* 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] | 2473 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2474 | .substreams = 0, |
| 2475 | .channels_min = 0, |
| 2476 | .channels_max = 0, |
| 2477 | }; |
| 2478 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2479 | static int alc_build_pcms(struct hda_codec *codec) |
| 2480 | { |
| 2481 | struct alc_spec *spec = codec->spec; |
| 2482 | struct hda_pcm *info = spec->pcm_rec; |
| 2483 | int i; |
| 2484 | |
| 2485 | codec->num_pcms = 1; |
| 2486 | codec->pcm_info = info; |
| 2487 | |
| 2488 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2489 | if (spec->stream_analog_playback) { |
| 2490 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2491 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2492 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2493 | } |
| 2494 | if (spec->stream_analog_capture) { |
| 2495 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2496 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2497 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2498 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2499 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2500 | if (spec->channel_mode) { |
| 2501 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2502 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2503 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2504 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2505 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2506 | } |
| 2507 | } |
| 2508 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2509 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2510 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2511 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2512 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2513 | info->name = spec->stream_name_digital; |
Takashi Iwai | 7ba72ba | 2008-02-06 14:03:20 +0100 | [diff] [blame] | 2514 | info->pcm_type = HDA_PCM_TYPE_SPDIF; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2515 | if (spec->multiout.dig_out_nid && |
| 2516 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2517 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2518 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2519 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2520 | if (spec->dig_in_nid && |
| 2521 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2522 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2523 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2524 | } |
| 2525 | } |
| 2526 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2527 | /* If the use of more than one ADC is requested for the current |
| 2528 | * model, configure a second analog capture-only PCM. |
| 2529 | */ |
| 2530 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2531 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2532 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2533 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2534 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2535 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2536 | if (spec->alt_dac_nid) { |
| 2537 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2538 | *spec->stream_analog_alt_playback; |
| 2539 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2540 | spec->alt_dac_nid; |
| 2541 | } else { |
| 2542 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2543 | alc_pcm_null_stream; |
| 2544 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2545 | } |
| 2546 | if (spec->num_adc_nids > 1) { |
| 2547 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2548 | *spec->stream_analog_alt_capture; |
| 2549 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2550 | spec->adc_nids[1]; |
| 2551 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2552 | spec->num_adc_nids - 1; |
| 2553 | } else { |
| 2554 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2555 | alc_pcm_null_stream; |
| 2556 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2557 | } |
| 2558 | } |
| 2559 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2560 | return 0; |
| 2561 | } |
| 2562 | |
| 2563 | static void alc_free(struct hda_codec *codec) |
| 2564 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2565 | struct alc_spec *spec = codec->spec; |
| 2566 | unsigned int i; |
| 2567 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2568 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2569 | return; |
| 2570 | |
| 2571 | if (spec->kctl_alloc) { |
| 2572 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2573 | kfree(spec->kctl_alloc[i].name); |
| 2574 | kfree(spec->kctl_alloc); |
| 2575 | } |
| 2576 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2577 | } |
| 2578 | |
| 2579 | /* |
| 2580 | */ |
| 2581 | static struct hda_codec_ops alc_patch_ops = { |
| 2582 | .build_controls = alc_build_controls, |
| 2583 | .build_pcms = alc_build_pcms, |
| 2584 | .init = alc_init, |
| 2585 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2586 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2587 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2588 | .check_power_status = alc_check_power_status, |
| 2589 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2590 | }; |
| 2591 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2592 | |
| 2593 | /* |
| 2594 | * Test configuration for debugging |
| 2595 | * |
| 2596 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2597 | * enum controls. |
| 2598 | */ |
| 2599 | #ifdef CONFIG_SND_DEBUG |
| 2600 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2601 | 0x02, 0x03, 0x04, 0x05 |
| 2602 | }; |
| 2603 | |
| 2604 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2605 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2606 | .items = { |
| 2607 | { "In-1", 0x0 }, |
| 2608 | { "In-2", 0x1 }, |
| 2609 | { "In-3", 0x2 }, |
| 2610 | { "In-4", 0x3 }, |
| 2611 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2612 | { "Front", 0x5 }, |
| 2613 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2614 | }, |
| 2615 | }; |
| 2616 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2617 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2618 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2619 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2620 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2621 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2622 | }; |
| 2623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2624 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2625 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2626 | { |
| 2627 | static char *texts[] = { |
| 2628 | "N/A", "Line Out", "HP Out", |
| 2629 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2630 | }; |
| 2631 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2632 | uinfo->count = 1; |
| 2633 | uinfo->value.enumerated.items = 8; |
| 2634 | if (uinfo->value.enumerated.item >= 8) |
| 2635 | uinfo->value.enumerated.item = 7; |
| 2636 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2637 | return 0; |
| 2638 | } |
| 2639 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2640 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2641 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2642 | { |
| 2643 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2644 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2645 | unsigned int pin_ctl, item = 0; |
| 2646 | |
| 2647 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2648 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2649 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2650 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2651 | item = 2; |
| 2652 | else |
| 2653 | item = 1; |
| 2654 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2655 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2656 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2657 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2658 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2659 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2660 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2661 | } |
| 2662 | } |
| 2663 | ucontrol->value.enumerated.item[0] = item; |
| 2664 | return 0; |
| 2665 | } |
| 2666 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2667 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2668 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2669 | { |
| 2670 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2671 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2672 | static unsigned int ctls[] = { |
| 2673 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2674 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2675 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2676 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2677 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2678 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2679 | }; |
| 2680 | unsigned int old_ctl, new_ctl; |
| 2681 | |
| 2682 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2683 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2684 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2685 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2686 | int val; |
| 2687 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2688 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2689 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2690 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2691 | HDA_AMP_MUTE : 0; |
| 2692 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2693 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2694 | return 1; |
| 2695 | } |
| 2696 | return 0; |
| 2697 | } |
| 2698 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2699 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2700 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2701 | { |
| 2702 | static char *texts[] = { |
| 2703 | "Front", "Surround", "CLFE", "Side" |
| 2704 | }; |
| 2705 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2706 | uinfo->count = 1; |
| 2707 | uinfo->value.enumerated.items = 4; |
| 2708 | if (uinfo->value.enumerated.item >= 4) |
| 2709 | uinfo->value.enumerated.item = 3; |
| 2710 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2711 | return 0; |
| 2712 | } |
| 2713 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2714 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2715 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2716 | { |
| 2717 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2718 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2719 | unsigned int sel; |
| 2720 | |
| 2721 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2722 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2723 | return 0; |
| 2724 | } |
| 2725 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2726 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2727 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2728 | { |
| 2729 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2730 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2731 | unsigned int sel; |
| 2732 | |
| 2733 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2734 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2735 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2736 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2737 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2738 | return 1; |
| 2739 | } |
| 2740 | return 0; |
| 2741 | } |
| 2742 | |
| 2743 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2744 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2745 | .name = xname, \ |
| 2746 | .info = alc_test_pin_ctl_info, \ |
| 2747 | .get = alc_test_pin_ctl_get, \ |
| 2748 | .put = alc_test_pin_ctl_put, \ |
| 2749 | .private_value = nid \ |
| 2750 | } |
| 2751 | |
| 2752 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2753 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2754 | .name = xname, \ |
| 2755 | .info = alc_test_pin_src_info, \ |
| 2756 | .get = alc_test_pin_src_get, \ |
| 2757 | .put = alc_test_pin_src_put, \ |
| 2758 | .private_value = nid \ |
| 2759 | } |
| 2760 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2761 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2762 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2763 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2764 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2765 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2766 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2767 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2768 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2769 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2770 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2771 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2772 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2773 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2774 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2775 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2776 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2777 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2778 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2779 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2780 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2781 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2782 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2783 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2784 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2785 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2786 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2787 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2788 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2789 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2790 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2791 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2792 | { |
| 2793 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2794 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2795 | .info = alc_ch_mode_info, |
| 2796 | .get = alc_ch_mode_get, |
| 2797 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2798 | }, |
| 2799 | { } /* end */ |
| 2800 | }; |
| 2801 | |
| 2802 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2803 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2804 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2805 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2806 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2807 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2808 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2809 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2810 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2811 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2812 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2813 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2814 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2815 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2816 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2817 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2818 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2819 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2820 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2821 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2822 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2823 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2824 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2825 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2826 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2827 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2828 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2829 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2830 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2831 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2832 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2833 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2835 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2836 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2837 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2838 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2839 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2840 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2841 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2842 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2843 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2844 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2845 | /* Analog input/passthru */ |
| 2846 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2847 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2851 | { } |
| 2852 | }; |
| 2853 | #endif |
| 2854 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2855 | /* |
| 2856 | */ |
| 2857 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2858 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2859 | [ALC880_3ST] = "3stack", |
| 2860 | [ALC880_TCL_S700] = "tcl", |
| 2861 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2862 | [ALC880_CLEVO] = "clevo", |
| 2863 | [ALC880_5ST] = "5stack", |
| 2864 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2865 | [ALC880_W810] = "w810", |
| 2866 | [ALC880_Z71V] = "z71v", |
| 2867 | [ALC880_6ST] = "6stack", |
| 2868 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2869 | [ALC880_ASUS] = "asus", |
| 2870 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2871 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2872 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2873 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2874 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2875 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2876 | [ALC880_F1734] = "F1734", |
| 2877 | [ALC880_LG] = "lg", |
| 2878 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2879 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2880 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2881 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2882 | [ALC880_AUTO] = "auto", |
| 2883 | }; |
| 2884 | |
| 2885 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2886 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2887 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2888 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2889 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2890 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2891 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2892 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2893 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2894 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2895 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2896 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2897 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2898 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2899 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2900 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2901 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2902 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2903 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2904 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2905 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2906 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2907 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2908 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2909 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2910 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2912 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2913 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2914 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2915 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2916 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2917 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2918 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2919 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2920 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2921 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2922 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2923 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2924 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2925 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2926 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2927 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2928 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2929 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2930 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2932 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2933 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2934 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2935 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2936 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2937 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2938 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2939 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2940 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2941 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2942 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2943 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2944 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2945 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2946 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2947 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2948 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2949 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2950 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2951 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2952 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2953 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2954 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2955 | {} |
| 2956 | }; |
| 2957 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2958 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2959 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2960 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2961 | static struct alc_config_preset alc880_presets[] = { |
| 2962 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2963 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2964 | .init_verbs = { alc880_volume_init_verbs, |
| 2965 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2966 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2967 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2968 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2969 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2970 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2971 | .input_mux = &alc880_capture_source, |
| 2972 | }, |
| 2973 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2974 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2975 | .init_verbs = { alc880_volume_init_verbs, |
| 2976 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2977 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2978 | .dac_nids = alc880_dac_nids, |
| 2979 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2980 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2981 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2982 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2983 | .input_mux = &alc880_capture_source, |
| 2984 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2985 | [ALC880_TCL_S700] = { |
| 2986 | .mixers = { alc880_tcl_s700_mixer }, |
| 2987 | .init_verbs = { alc880_volume_init_verbs, |
| 2988 | alc880_pin_tcl_S700_init_verbs, |
| 2989 | alc880_gpio2_init_verbs }, |
| 2990 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2991 | .dac_nids = alc880_dac_nids, |
| 2992 | .hp_nid = 0x03, |
| 2993 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2994 | .channel_mode = alc880_2_jack_modes, |
| 2995 | .input_mux = &alc880_capture_source, |
| 2996 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2997 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2998 | .mixers = { alc880_three_stack_mixer, |
| 2999 | alc880_five_stack_mixer}, |
| 3000 | .init_verbs = { alc880_volume_init_verbs, |
| 3001 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3002 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3003 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3004 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3005 | .channel_mode = alc880_fivestack_modes, |
| 3006 | .input_mux = &alc880_capture_source, |
| 3007 | }, |
| 3008 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3009 | .mixers = { alc880_three_stack_mixer, |
| 3010 | alc880_five_stack_mixer }, |
| 3011 | .init_verbs = { alc880_volume_init_verbs, |
| 3012 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3013 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3014 | .dac_nids = alc880_dac_nids, |
| 3015 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3016 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3017 | .channel_mode = alc880_fivestack_modes, |
| 3018 | .input_mux = &alc880_capture_source, |
| 3019 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3020 | [ALC880_6ST] = { |
| 3021 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3022 | .init_verbs = { alc880_volume_init_verbs, |
| 3023 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3024 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3025 | .dac_nids = alc880_6st_dac_nids, |
| 3026 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3027 | .channel_mode = alc880_sixstack_modes, |
| 3028 | .input_mux = &alc880_6stack_capture_source, |
| 3029 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3030 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3031 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3032 | .init_verbs = { alc880_volume_init_verbs, |
| 3033 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3034 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3035 | .dac_nids = alc880_6st_dac_nids, |
| 3036 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3037 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3038 | .channel_mode = alc880_sixstack_modes, |
| 3039 | .input_mux = &alc880_6stack_capture_source, |
| 3040 | }, |
| 3041 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3042 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3043 | .init_verbs = { alc880_volume_init_verbs, |
| 3044 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3045 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3046 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3047 | .dac_nids = alc880_w810_dac_nids, |
| 3048 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3049 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3050 | .channel_mode = alc880_w810_modes, |
| 3051 | .input_mux = &alc880_capture_source, |
| 3052 | }, |
| 3053 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3054 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3055 | .init_verbs = { alc880_volume_init_verbs, |
| 3056 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3057 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3058 | .dac_nids = alc880_z71v_dac_nids, |
| 3059 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3060 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3061 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3062 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3063 | .input_mux = &alc880_capture_source, |
| 3064 | }, |
| 3065 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3066 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3067 | .init_verbs = { alc880_volume_init_verbs, |
| 3068 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3069 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3070 | .dac_nids = alc880_f1734_dac_nids, |
| 3071 | .hp_nid = 0x02, |
| 3072 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3073 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 937b416 | 2008-02-11 14:52:36 +0100 | [diff] [blame] | 3074 | .input_mux = &alc880_f1734_capture_source, |
| 3075 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3076 | .init_hook = alc880_uniwill_p53_hp_automute, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3077 | }, |
| 3078 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3079 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3080 | .init_verbs = { alc880_volume_init_verbs, |
| 3081 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3082 | alc880_gpio1_init_verbs }, |
| 3083 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3084 | .dac_nids = alc880_asus_dac_nids, |
| 3085 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3086 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3087 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3088 | .input_mux = &alc880_capture_source, |
| 3089 | }, |
| 3090 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3091 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3092 | .init_verbs = { alc880_volume_init_verbs, |
| 3093 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3094 | alc880_gpio1_init_verbs }, |
| 3095 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3096 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3097 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3098 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3099 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3100 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3101 | .input_mux = &alc880_capture_source, |
| 3102 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3103 | [ALC880_ASUS_DIG2] = { |
| 3104 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3105 | .init_verbs = { alc880_volume_init_verbs, |
| 3106 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3107 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3108 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3109 | .dac_nids = alc880_asus_dac_nids, |
| 3110 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3111 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3112 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3113 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3114 | .input_mux = &alc880_capture_source, |
| 3115 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3116 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3117 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3118 | .init_verbs = { alc880_volume_init_verbs, |
| 3119 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3120 | alc880_gpio1_init_verbs }, |
| 3121 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3122 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3123 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3124 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3125 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3126 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3127 | .input_mux = &alc880_capture_source, |
| 3128 | }, |
| 3129 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3130 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3131 | .init_verbs = { alc880_volume_init_verbs, |
| 3132 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3133 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3134 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3135 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3136 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3137 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3138 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3139 | .input_mux = &alc880_capture_source, |
| 3140 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3141 | [ALC880_UNIWILL] = { |
| 3142 | .mixers = { alc880_uniwill_mixer }, |
| 3143 | .init_verbs = { alc880_volume_init_verbs, |
| 3144 | alc880_uniwill_init_verbs }, |
| 3145 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3146 | .dac_nids = alc880_asus_dac_nids, |
| 3147 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3148 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3149 | .channel_mode = alc880_threestack_modes, |
| 3150 | .need_dac_fix = 1, |
| 3151 | .input_mux = &alc880_capture_source, |
| 3152 | .unsol_event = alc880_uniwill_unsol_event, |
| 3153 | .init_hook = alc880_uniwill_automute, |
| 3154 | }, |
| 3155 | [ALC880_UNIWILL_P53] = { |
| 3156 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3157 | .init_verbs = { alc880_volume_init_verbs, |
| 3158 | alc880_uniwill_p53_init_verbs }, |
| 3159 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3160 | .dac_nids = alc880_asus_dac_nids, |
| 3161 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3162 | .channel_mode = alc880_threestack_modes, |
| 3163 | .input_mux = &alc880_capture_source, |
| 3164 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3165 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3166 | }, |
| 3167 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3168 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3169 | alc880_pcbeep_mixer, }, |
| 3170 | .init_verbs = { alc880_volume_init_verbs, |
| 3171 | alc880_uniwill_p53_init_verbs, |
| 3172 | alc880_beep_init_verbs }, |
| 3173 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3174 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3175 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3176 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3177 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3178 | .input_mux = &alc880_capture_source, |
| 3179 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3180 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3181 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3182 | [ALC880_CLEVO] = { |
| 3183 | .mixers = { alc880_three_stack_mixer }, |
| 3184 | .init_verbs = { alc880_volume_init_verbs, |
| 3185 | alc880_pin_clevo_init_verbs }, |
| 3186 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3187 | .dac_nids = alc880_dac_nids, |
| 3188 | .hp_nid = 0x03, |
| 3189 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3190 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3191 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3192 | .input_mux = &alc880_capture_source, |
| 3193 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3194 | [ALC880_LG] = { |
| 3195 | .mixers = { alc880_lg_mixer }, |
| 3196 | .init_verbs = { alc880_volume_init_verbs, |
| 3197 | alc880_lg_init_verbs }, |
| 3198 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3199 | .dac_nids = alc880_lg_dac_nids, |
| 3200 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3201 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3202 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3203 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3204 | .input_mux = &alc880_lg_capture_source, |
| 3205 | .unsol_event = alc880_lg_unsol_event, |
| 3206 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3207 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3208 | .loopbacks = alc880_lg_loopbacks, |
| 3209 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3210 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3211 | [ALC880_LG_LW] = { |
| 3212 | .mixers = { alc880_lg_lw_mixer }, |
| 3213 | .init_verbs = { alc880_volume_init_verbs, |
| 3214 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3215 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3216 | .dac_nids = alc880_dac_nids, |
| 3217 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3218 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3219 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3220 | .input_mux = &alc880_lg_lw_capture_source, |
| 3221 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3222 | .init_hook = alc880_lg_lw_automute, |
| 3223 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3224 | #ifdef CONFIG_SND_DEBUG |
| 3225 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3226 | .mixers = { alc880_test_mixer }, |
| 3227 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3228 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3229 | .dac_nids = alc880_test_dac_nids, |
| 3230 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3231 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3232 | .channel_mode = alc880_test_modes, |
| 3233 | .input_mux = &alc880_test_capture_source, |
| 3234 | }, |
| 3235 | #endif |
| 3236 | }; |
| 3237 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3238 | /* |
| 3239 | * Automatic parse of I/O pins from the BIOS configuration |
| 3240 | */ |
| 3241 | |
| 3242 | #define NUM_CONTROL_ALLOC 32 |
| 3243 | #define NUM_VERB_ALLOC 32 |
| 3244 | |
| 3245 | enum { |
| 3246 | ALC_CTL_WIDGET_VOL, |
| 3247 | ALC_CTL_WIDGET_MUTE, |
| 3248 | ALC_CTL_BIND_MUTE, |
| 3249 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3250 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3251 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3252 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3253 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3254 | }; |
| 3255 | |
| 3256 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3257 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3258 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3259 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3260 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3261 | |
| 3262 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3263 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3264 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3265 | /* array + terminator */ |
| 3266 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3267 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3268 | return -ENOMEM; |
| 3269 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3270 | memcpy(knew, spec->kctl_alloc, |
| 3271 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3272 | kfree(spec->kctl_alloc); |
| 3273 | } |
| 3274 | spec->kctl_alloc = knew; |
| 3275 | spec->num_kctl_alloc = num; |
| 3276 | } |
| 3277 | |
| 3278 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3279 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3280 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3281 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3282 | return -ENOMEM; |
| 3283 | knew->private_value = val; |
| 3284 | spec->num_kctl_used++; |
| 3285 | return 0; |
| 3286 | } |
| 3287 | |
| 3288 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3289 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3290 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3291 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3292 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3293 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3294 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3295 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3296 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3297 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3298 | #define ALC880_PIN_CD_NID 0x1c |
| 3299 | |
| 3300 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3301 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3302 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3303 | { |
| 3304 | hda_nid_t nid; |
| 3305 | int assigned[4]; |
| 3306 | int i, j; |
| 3307 | |
| 3308 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3309 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3310 | |
| 3311 | /* check the pins hardwired to audio widget */ |
| 3312 | for (i = 0; i < cfg->line_outs; i++) { |
| 3313 | nid = cfg->line_out_pins[i]; |
| 3314 | if (alc880_is_fixed_pin(nid)) { |
| 3315 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3316 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3317 | assigned[idx] = 1; |
| 3318 | } |
| 3319 | } |
| 3320 | /* left pins can be connect to any audio widget */ |
| 3321 | for (i = 0; i < cfg->line_outs; i++) { |
| 3322 | nid = cfg->line_out_pins[i]; |
| 3323 | if (alc880_is_fixed_pin(nid)) |
| 3324 | continue; |
| 3325 | /* search for an empty channel */ |
| 3326 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3327 | if (!assigned[j]) { |
| 3328 | spec->multiout.dac_nids[i] = |
| 3329 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3330 | assigned[j] = 1; |
| 3331 | break; |
| 3332 | } |
| 3333 | } |
| 3334 | } |
| 3335 | spec->multiout.num_dacs = cfg->line_outs; |
| 3336 | return 0; |
| 3337 | } |
| 3338 | |
| 3339 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3340 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3341 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3342 | { |
| 3343 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3344 | static const char *chname[4] = { |
| 3345 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3346 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3347 | hda_nid_t nid; |
| 3348 | int i, err; |
| 3349 | |
| 3350 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3351 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3352 | continue; |
| 3353 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3354 | if (i == 2) { |
| 3355 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3356 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3357 | "Center Playback Volume", |
| 3358 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3359 | HDA_OUTPUT)); |
| 3360 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3361 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3362 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3363 | "LFE Playback Volume", |
| 3364 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3365 | HDA_OUTPUT)); |
| 3366 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3367 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3368 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3369 | "Center Playback Switch", |
| 3370 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3371 | HDA_INPUT)); |
| 3372 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3373 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3374 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3375 | "LFE Playback Switch", |
| 3376 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3377 | HDA_INPUT)); |
| 3378 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3379 | return err; |
| 3380 | } else { |
| 3381 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3382 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3383 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3384 | HDA_OUTPUT)); |
| 3385 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3386 | return err; |
| 3387 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3388 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3389 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3390 | HDA_INPUT)); |
| 3391 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3392 | return err; |
| 3393 | } |
| 3394 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | return 0; |
| 3396 | } |
| 3397 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3398 | /* add playback controls for speaker and HP outputs */ |
| 3399 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3400 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3401 | { |
| 3402 | hda_nid_t nid; |
| 3403 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3404 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3405 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3406 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3407 | return 0; |
| 3408 | |
| 3409 | if (alc880_is_fixed_pin(pin)) { |
| 3410 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3411 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3412 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3413 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3414 | else |
| 3415 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3416 | /* control HP volume/switch on the output mixer amp */ |
| 3417 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3418 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3419 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3420 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3421 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3422 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3423 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3424 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3425 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3426 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3427 | return err; |
| 3428 | } else if (alc880_is_multi_pin(pin)) { |
| 3429 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3430 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3431 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3432 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3433 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3434 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3435 | return err; |
| 3436 | } |
| 3437 | return 0; |
| 3438 | } |
| 3439 | |
| 3440 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3441 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3442 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3443 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3444 | { |
| 3445 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3446 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | |
| 3448 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3449 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3450 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3451 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3452 | return err; |
| 3453 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3454 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3455 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3456 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3457 | return err; |
| 3458 | return 0; |
| 3459 | } |
| 3460 | |
| 3461 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3462 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3463 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3464 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3465 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3466 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3467 | |
| 3468 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3469 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3470 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3471 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3472 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3473 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3474 | if (err < 0) |
| 3475 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3476 | imux->items[imux->num_items].label = |
| 3477 | auto_pin_cfg_labels[i]; |
| 3478 | imux->items[imux->num_items].index = |
| 3479 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3480 | imux->num_items++; |
| 3481 | } |
| 3482 | } |
| 3483 | return 0; |
| 3484 | } |
| 3485 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3486 | static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, |
| 3487 | unsigned int pin_type) |
| 3488 | { |
| 3489 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3490 | pin_type); |
| 3491 | /* unmute pin */ |
Takashi Iwai | d260cdf | 2008-02-13 17:19:35 +0100 | [diff] [blame] | 3492 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3493 | AMP_OUT_UNMUTE); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3494 | } |
| 3495 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3496 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3497 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3498 | int dac_idx) |
| 3499 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3500 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | /* need the manual connection? */ |
| 3502 | if (alc880_is_multi_pin(nid)) { |
| 3503 | struct alc_spec *spec = codec->spec; |
| 3504 | int idx = alc880_multi_pin_idx(nid); |
| 3505 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3506 | AC_VERB_SET_CONNECT_SEL, |
| 3507 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3508 | } |
| 3509 | } |
| 3510 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3511 | static int get_pin_type(int line_out_type) |
| 3512 | { |
| 3513 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3514 | return PIN_HP; |
| 3515 | else |
| 3516 | return PIN_OUT; |
| 3517 | } |
| 3518 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3519 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3520 | { |
| 3521 | struct alc_spec *spec = codec->spec; |
| 3522 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3523 | |
| 3524 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3525 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3526 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3527 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3528 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3529 | } |
| 3530 | } |
| 3531 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3532 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | { |
| 3534 | struct alc_spec *spec = codec->spec; |
| 3535 | hda_nid_t pin; |
| 3536 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3537 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3538 | if (pin) /* connect to front */ |
| 3539 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3540 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3541 | if (pin) /* connect to front */ |
| 3542 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3543 | } |
| 3544 | |
| 3545 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3546 | { |
| 3547 | struct alc_spec *spec = codec->spec; |
| 3548 | int i; |
| 3549 | |
| 3550 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3551 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3552 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3553 | snd_hda_codec_write(codec, nid, 0, |
| 3554 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3555 | i <= AUTO_PIN_FRONT_MIC ? |
| 3556 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3557 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3558 | snd_hda_codec_write(codec, nid, 0, |
| 3559 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3560 | AMP_OUT_MUTE); |
| 3561 | } |
| 3562 | } |
| 3563 | } |
| 3564 | |
| 3565 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3566 | /* return 1 if successful, 0 if the proper config is not found, |
| 3567 | * or a negative error code |
| 3568 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3569 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3570 | { |
| 3571 | struct alc_spec *spec = codec->spec; |
| 3572 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3573 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3574 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3575 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3576 | alc880_ignore); |
| 3577 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3578 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3579 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3580 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3581 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3582 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3583 | if (err < 0) |
| 3584 | return err; |
| 3585 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3586 | if (err < 0) |
| 3587 | return err; |
| 3588 | err = alc880_auto_create_extra_out(spec, |
| 3589 | spec->autocfg.speaker_pins[0], |
| 3590 | "Speaker"); |
| 3591 | if (err < 0) |
| 3592 | return err; |
| 3593 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3594 | "Headphone"); |
| 3595 | if (err < 0) |
| 3596 | return err; |
| 3597 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3598 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3599 | return err; |
| 3600 | |
| 3601 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3602 | |
| 3603 | if (spec->autocfg.dig_out_pin) |
| 3604 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3605 | if (spec->autocfg.dig_in_pin) |
| 3606 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3607 | |
| 3608 | if (spec->kctl_alloc) |
| 3609 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3610 | |
| 3611 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3612 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3613 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3614 | spec->input_mux = &spec->private_imux; |
| 3615 | |
| 3616 | return 1; |
| 3617 | } |
| 3618 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3619 | /* additional initialization for auto-configuration model */ |
| 3620 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3621 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3622 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3623 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3624 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3625 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 3626 | if (spec->unsol_event) |
| 3627 | alc_sku_automute(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | } |
| 3629 | |
| 3630 | /* |
| 3631 | * OK, here we have finally the patch for ALC880 |
| 3632 | */ |
| 3633 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3634 | static int patch_alc880(struct hda_codec *codec) |
| 3635 | { |
| 3636 | struct alc_spec *spec; |
| 3637 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3638 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3639 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3640 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3641 | if (spec == NULL) |
| 3642 | return -ENOMEM; |
| 3643 | |
| 3644 | codec->spec = spec; |
| 3645 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3646 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3647 | alc880_models, |
| 3648 | alc880_cfg_tbl); |
| 3649 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3650 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3651 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3652 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3653 | } |
| 3654 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3655 | if (board_config == ALC880_AUTO) { |
| 3656 | /* automatic parse from the BIOS config */ |
| 3657 | err = alc880_parse_auto_config(codec); |
| 3658 | if (err < 0) { |
| 3659 | alc_free(codec); |
| 3660 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3661 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3662 | printk(KERN_INFO |
| 3663 | "hda_codec: Cannot set up configuration " |
| 3664 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3665 | board_config = ALC880_3ST; |
| 3666 | } |
| 3667 | } |
| 3668 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3669 | if (board_config != ALC880_AUTO) |
| 3670 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3671 | |
| 3672 | spec->stream_name_analog = "ALC880 Analog"; |
| 3673 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3674 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3675 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3676 | |
| 3677 | spec->stream_name_digital = "ALC880 Digital"; |
| 3678 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3679 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3680 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3681 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3682 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3683 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3684 | /* get type */ |
| 3685 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3686 | if (wcap != AC_WID_AUD_IN) { |
| 3687 | spec->adc_nids = alc880_adc_nids_alt; |
| 3688 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3689 | spec->mixers[spec->num_mixers] = |
| 3690 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | spec->num_mixers++; |
| 3692 | } else { |
| 3693 | spec->adc_nids = alc880_adc_nids; |
| 3694 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3695 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3696 | spec->num_mixers++; |
| 3697 | } |
| 3698 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3699 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3700 | spec->vmaster_nid = 0x0c; |
| 3701 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3702 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3703 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3704 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3705 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3706 | if (!spec->loopback.amplist) |
| 3707 | spec->loopback.amplist = alc880_loopbacks; |
| 3708 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3709 | |
| 3710 | return 0; |
| 3711 | } |
| 3712 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3713 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3714 | /* |
| 3715 | * ALC260 support |
| 3716 | */ |
| 3717 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3718 | static hda_nid_t alc260_dac_nids[1] = { |
| 3719 | /* front */ |
| 3720 | 0x02, |
| 3721 | }; |
| 3722 | |
| 3723 | static hda_nid_t alc260_adc_nids[1] = { |
| 3724 | /* ADC0 */ |
| 3725 | 0x04, |
| 3726 | }; |
| 3727 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3728 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3729 | /* ADC1 */ |
| 3730 | 0x05, |
| 3731 | }; |
| 3732 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3733 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3734 | /* ADC1, 0 */ |
| 3735 | 0x05, 0x04 |
| 3736 | }; |
| 3737 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3738 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3739 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3740 | */ |
| 3741 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3742 | /* ADC0, ADC1 */ |
| 3743 | 0x04, 0x05 |
| 3744 | }; |
| 3745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3746 | #define ALC260_DIGOUT_NID 0x03 |
| 3747 | #define ALC260_DIGIN_NID 0x06 |
| 3748 | |
| 3749 | static struct hda_input_mux alc260_capture_source = { |
| 3750 | .num_items = 4, |
| 3751 | .items = { |
| 3752 | { "Mic", 0x0 }, |
| 3753 | { "Front Mic", 0x1 }, |
| 3754 | { "Line", 0x2 }, |
| 3755 | { "CD", 0x4 }, |
| 3756 | }, |
| 3757 | }; |
| 3758 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3759 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3760 | * headphone jack and the internal CD lines since these are the only pins at |
| 3761 | * which audio can appear. For flexibility, also allow the option of |
| 3762 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3763 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3764 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3765 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3766 | { |
| 3767 | .num_items = 3, |
| 3768 | .items = { |
| 3769 | { "Mic/Line", 0x0 }, |
| 3770 | { "CD", 0x4 }, |
| 3771 | { "Headphone", 0x2 }, |
| 3772 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3773 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3774 | { |
| 3775 | .num_items = 4, |
| 3776 | .items = { |
| 3777 | { "Mic/Line", 0x0 }, |
| 3778 | { "CD", 0x4 }, |
| 3779 | { "Headphone", 0x2 }, |
| 3780 | { "Mixer", 0x5 }, |
| 3781 | }, |
| 3782 | }, |
| 3783 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3784 | }; |
| 3785 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3786 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3787 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3788 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3789 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3790 | { |
| 3791 | .num_items = 4, |
| 3792 | .items = { |
| 3793 | { "Mic", 0x0 }, |
| 3794 | { "Line", 0x2 }, |
| 3795 | { "CD", 0x4 }, |
| 3796 | { "Headphone", 0x5 }, |
| 3797 | }, |
| 3798 | }, |
| 3799 | { |
| 3800 | .num_items = 5, |
| 3801 | .items = { |
| 3802 | { "Mic", 0x0 }, |
| 3803 | { "Line", 0x2 }, |
| 3804 | { "CD", 0x4 }, |
| 3805 | { "Headphone", 0x6 }, |
| 3806 | { "Mixer", 0x5 }, |
| 3807 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3808 | }, |
| 3809 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3810 | /* |
| 3811 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3812 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3813 | * element which allows changing the channel mode, so the verb list is |
| 3814 | * never used. |
| 3815 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3816 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3817 | { 2, NULL }, |
| 3818 | }; |
| 3819 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3820 | |
| 3821 | /* Mixer combinations |
| 3822 | * |
| 3823 | * basic: base_output + input + pc_beep + capture |
| 3824 | * HP: base_output + input + capture_alt |
| 3825 | * HP_3013: hp_3013 + input + capture |
| 3826 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3827 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3828 | */ |
| 3829 | |
| 3830 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3832 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3833 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3834 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3835 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3836 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3837 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3838 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3839 | |
| 3840 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3841 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3842 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3843 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3844 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3845 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3846 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3847 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3848 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3849 | { } /* end */ |
| 3850 | }; |
| 3851 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3852 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3853 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3854 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3855 | { } /* end */ |
| 3856 | }; |
| 3857 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3858 | /* update HP, line and mono out pins according to the master switch */ |
| 3859 | static void alc260_hp_master_update(struct hda_codec *codec, |
| 3860 | hda_nid_t hp, hda_nid_t line, |
| 3861 | hda_nid_t mono) |
| 3862 | { |
| 3863 | struct alc_spec *spec = codec->spec; |
| 3864 | unsigned int val = spec->master_sw ? PIN_HP : 0; |
| 3865 | /* change HP and line-out pins */ |
| 3866 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3867 | val); |
| 3868 | snd_hda_codec_write(codec, 0x10, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3869 | val); |
| 3870 | /* mono (speaker) depending on the HP jack sense */ |
| 3871 | val = (val && !spec->jack_present) ? PIN_OUT : 0; |
| 3872 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3873 | val); |
| 3874 | } |
| 3875 | |
| 3876 | static int alc260_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 3877 | struct snd_ctl_elem_value *ucontrol) |
| 3878 | { |
| 3879 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3880 | struct alc_spec *spec = codec->spec; |
| 3881 | *ucontrol->value.integer.value = spec->master_sw; |
| 3882 | return 0; |
| 3883 | } |
| 3884 | |
| 3885 | static int alc260_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 3886 | struct snd_ctl_elem_value *ucontrol) |
| 3887 | { |
| 3888 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 3889 | struct alc_spec *spec = codec->spec; |
| 3890 | int val = !!*ucontrol->value.integer.value; |
| 3891 | hda_nid_t hp, line, mono; |
| 3892 | |
| 3893 | if (val == spec->master_sw) |
| 3894 | return 0; |
| 3895 | spec->master_sw = val; |
| 3896 | hp = (kcontrol->private_value >> 16) & 0xff; |
| 3897 | line = (kcontrol->private_value >> 8) & 0xff; |
| 3898 | mono = kcontrol->private_value & 0xff; |
| 3899 | alc260_hp_master_update(codec, hp, line, mono); |
| 3900 | return 1; |
| 3901 | } |
| 3902 | |
| 3903 | static struct snd_kcontrol_new alc260_hp_output_mixer[] = { |
| 3904 | { |
| 3905 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3906 | .name = "Master Playback Switch", |
| 3907 | .info = snd_ctl_boolean_mono_info, |
| 3908 | .get = alc260_hp_master_sw_get, |
| 3909 | .put = alc260_hp_master_sw_put, |
| 3910 | .private_value = (0x0f << 16) | (0x10 << 8) | 0x11 |
| 3911 | }, |
| 3912 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3913 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
| 3914 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3915 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3916 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3917 | HDA_OUTPUT), |
| 3918 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3919 | { } /* end */ |
| 3920 | }; |
| 3921 | |
| 3922 | static struct hda_verb alc260_hp_unsol_verbs[] = { |
| 3923 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3924 | {}, |
| 3925 | }; |
| 3926 | |
| 3927 | static void alc260_hp_automute(struct hda_codec *codec) |
| 3928 | { |
| 3929 | struct alc_spec *spec = codec->spec; |
| 3930 | unsigned int present; |
| 3931 | |
| 3932 | present = snd_hda_codec_read(codec, 0x10, 0, |
| 3933 | AC_VERB_GET_PIN_SENSE, 0); |
| 3934 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3935 | alc260_hp_master_update(codec, 0x0f, 0x10, 0x11); |
| 3936 | } |
| 3937 | |
| 3938 | static void alc260_hp_unsol_event(struct hda_codec *codec, unsigned int res) |
| 3939 | { |
| 3940 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3941 | alc260_hp_automute(codec); |
| 3942 | } |
| 3943 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3944 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3945 | { |
| 3946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3947 | .name = "Master Playback Switch", |
| 3948 | .info = snd_ctl_boolean_mono_info, |
| 3949 | .get = alc260_hp_master_sw_get, |
| 3950 | .put = alc260_hp_master_sw_put, |
| 3951 | .private_value = (0x10 << 16) | (0x15 << 8) | 0x11 |
| 3952 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3953 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3954 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3955 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3956 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3957 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3958 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3959 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3960 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3961 | { } /* end */ |
| 3962 | }; |
| 3963 | |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 3964 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
| 3965 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 3966 | {}, |
| 3967 | }; |
| 3968 | |
| 3969 | static void alc260_hp_3013_automute(struct hda_codec *codec) |
| 3970 | { |
| 3971 | struct alc_spec *spec = codec->spec; |
| 3972 | unsigned int present; |
| 3973 | |
| 3974 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 3975 | AC_VERB_GET_PIN_SENSE, 0); |
| 3976 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
| 3977 | alc260_hp_master_update(codec, 0x10, 0x15, 0x11); |
| 3978 | } |
| 3979 | |
| 3980 | static void alc260_hp_3013_unsol_event(struct hda_codec *codec, |
| 3981 | unsigned int res) |
| 3982 | { |
| 3983 | if ((res >> 26) == ALC880_HP_EVENT) |
| 3984 | alc260_hp_3013_automute(codec); |
| 3985 | } |
| 3986 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3987 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3988 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3989 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3990 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3991 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3992 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3993 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3994 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3995 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3996 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3997 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3998 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3999 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4000 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4001 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4002 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4003 | { } /* end */ |
| 4004 | }; |
| 4005 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4006 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 4007 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 4008 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 4009 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 4010 | * whether this behaviour is intentional or is a hardware bug in chip |
| 4011 | * revisions available in early 2006. Therefore for now allow the |
| 4012 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 4013 | * that the lack of mic bias for this NID is intentional we could change the |
| 4014 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4015 | * |
| 4016 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 4017 | * don't appear to make the mic bias available from the "line" jack, even |
| 4018 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 4019 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 4020 | * and the output jack. If this turns out to be the case for all such |
| 4021 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 4022 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4023 | * |
| 4024 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 4025 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 4026 | * controls for such models. On models without a "mono speaker" the control |
| 4027 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4028 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4029 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 4030 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4031 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4032 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4033 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4034 | HDA_OUTPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 4035 | HDA_BIND_MUTE_MONO("Speaker Playback Switch", 0x0a, 1, 2, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4036 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4037 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4038 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4039 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4040 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4041 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4042 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4043 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4044 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4045 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4046 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4047 | { } /* end */ |
| 4048 | }; |
| 4049 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4050 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 4051 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 4052 | */ |
| 4053 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 4054 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4055 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4056 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4057 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4058 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4059 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4060 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4061 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4062 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4063 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4064 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4065 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4066 | { } /* end */ |
| 4067 | }; |
| 4068 | |
| 4069 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 4070 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 4071 | */ |
| 4072 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 4073 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4074 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 4075 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 4076 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 4077 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 4078 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 4079 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 4080 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4081 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4082 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4083 | { } /* end */ |
| 4084 | }; |
| 4085 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4086 | /* capture mixer elements */ |
| 4087 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4088 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 4089 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4090 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 4091 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4092 | { |
| 4093 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4094 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4095 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4096 | */ |
| 4097 | /* .name = "Capture Source", */ |
| 4098 | .name = "Input Source", |
| 4099 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4100 | .info = alc_mux_enum_info, |
| 4101 | .get = alc_mux_enum_get, |
| 4102 | .put = alc_mux_enum_put, |
| 4103 | }, |
| 4104 | { } /* end */ |
| 4105 | }; |
| 4106 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4107 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 4108 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 4109 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 4110 | { |
| 4111 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 4112 | /* The multiple "Capture Source" controls confuse alsamixer |
| 4113 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4114 | */ |
| 4115 | /* .name = "Capture Source", */ |
| 4116 | .name = "Input Source", |
| 4117 | .count = 1, |
| 4118 | .info = alc_mux_enum_info, |
| 4119 | .get = alc_mux_enum_get, |
| 4120 | .put = alc_mux_enum_put, |
| 4121 | }, |
| 4122 | { } /* end */ |
| 4123 | }; |
| 4124 | |
| 4125 | /* |
| 4126 | * initialization verbs |
| 4127 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4128 | static struct hda_verb alc260_init_verbs[] = { |
| 4129 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4130 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4131 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4132 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4133 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4134 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4135 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4136 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4137 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4138 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4139 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 4140 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4141 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4142 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4143 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4144 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4145 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4146 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4147 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4148 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4149 | /* set connection select to line in (default select for this ADC) */ |
| 4150 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4151 | /* mute capture amp left and right */ |
| 4152 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4153 | /* set connection select to line in (default select for this ADC) */ |
| 4154 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4155 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4156 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4157 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4158 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4159 | /* set vol=0 HP mixer amp left and right */ |
| 4160 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4161 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4162 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4163 | /* set vol=0 Mono mixer amp left and right */ |
| 4164 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4165 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4166 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4167 | /* unmute LINE-2 out pin */ |
| 4168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4169 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4170 | * Line In 2 = 0x03 |
| 4171 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4172 | /* mute analog inputs */ |
| 4173 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4174 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4175 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4176 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4177 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4178 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4179 | /* mute Front out path */ |
| 4180 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4181 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4182 | /* mute Headphone out path */ |
| 4183 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4184 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4185 | /* mute Mono out path */ |
| 4186 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4187 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4188 | { } |
| 4189 | }; |
| 4190 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4191 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4192 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4193 | /* Headphone and output */ |
| 4194 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4195 | /* mono output */ |
| 4196 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4197 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4198 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4199 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4200 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4201 | /* Line In pin widget for input */ |
| 4202 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4203 | /* Line-2 pin widget for output */ |
| 4204 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4205 | /* CD pin widget for input */ |
| 4206 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4207 | /* unmute amp left and right */ |
| 4208 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4209 | /* set connection select to line in (default select for this ADC) */ |
| 4210 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4211 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4212 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4213 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4214 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4215 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4216 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4217 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4218 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4219 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4220 | * Line In 2 = 0x03 |
| 4221 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4222 | /* mute analog inputs */ |
| 4223 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4224 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4225 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4226 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4227 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4228 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4229 | /* Unmute Front out path */ |
| 4230 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4231 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4232 | /* Unmute Headphone out path */ |
| 4233 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4234 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4235 | /* Unmute Mono out path */ |
| 4236 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4237 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4238 | { } |
| 4239 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4240 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4241 | |
| 4242 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4243 | /* Line out and output */ |
| 4244 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4245 | /* mono output */ |
| 4246 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4247 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4248 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4249 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4250 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4251 | /* Line In pin widget for input */ |
| 4252 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4253 | /* Headphone pin widget for output */ |
| 4254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4255 | /* CD pin widget for input */ |
| 4256 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4257 | /* unmute amp left and right */ |
| 4258 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4259 | /* set connection select to line in (default select for this ADC) */ |
| 4260 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4261 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4262 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4263 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4264 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4265 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4266 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4267 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4268 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4269 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4270 | * Line In 2 = 0x03 |
| 4271 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4272 | /* mute analog inputs */ |
| 4273 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4274 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4275 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4277 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4278 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4279 | /* Unmute Front out path */ |
| 4280 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4281 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4282 | /* Unmute Headphone out path */ |
| 4283 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4284 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4285 | /* Unmute Mono out path */ |
| 4286 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4287 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4288 | { } |
| 4289 | }; |
| 4290 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4291 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4292 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4293 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4294 | */ |
| 4295 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4296 | /* Disable all GPIOs */ |
| 4297 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4298 | /* Internal speaker is connected to headphone pin */ |
| 4299 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4300 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4301 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4302 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4303 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4304 | /* Ensure all other unused pins are disabled and muted. */ |
| 4305 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4306 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4307 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4308 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4309 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4310 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4311 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4312 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4313 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4314 | /* Disable digital (SPDIF) pins */ |
| 4315 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4316 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4317 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4318 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4319 | * when acting as an output. |
| 4320 | */ |
| 4321 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4322 | |
| 4323 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 4324 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4325 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4326 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4327 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4328 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4329 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4330 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4331 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4332 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4333 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4334 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4335 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4336 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4337 | * If the pin mode is changed by the user the pin mode control will |
| 4338 | * take care of enabling the pin's input/output buffers as needed. |
| 4339 | * Therefore there's no need to enable the input buffer at this |
| 4340 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4341 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4342 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4343 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4344 | * mixer ctrl) |
| 4345 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4346 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4347 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4348 | /* Mute capture amp left and right */ |
| 4349 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4350 | /* Set ADC connection select to match default mixer setting - line |
| 4351 | * in (on mic1 pin) |
| 4352 | */ |
| 4353 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4354 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4355 | /* Do the same for the second ADC: mute capture input amp and |
| 4356 | * set ADC connection to line in (on mic1 pin) |
| 4357 | */ |
| 4358 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4359 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4360 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4361 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4362 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4363 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4364 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4365 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4366 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4367 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4368 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4369 | {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] | 4370 | |
| 4371 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4372 | }; |
| 4373 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4374 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4375 | * similar laptops (adapted from Fujitsu init verbs). |
| 4376 | */ |
| 4377 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4378 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4379 | * the headphone jack. Turn this on and rely on the standard mute |
| 4380 | * methods whenever the user wants to turn these outputs off. |
| 4381 | */ |
| 4382 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4383 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4384 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4385 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4386 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4387 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4388 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4389 | /* Line In jack is connected to Line1 pin */ |
| 4390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4391 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4392 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4393 | /* Ensure all other unused pins are disabled and muted. */ |
| 4394 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4395 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4396 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4397 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4398 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4399 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4400 | /* Disable digital (SPDIF) pins */ |
| 4401 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4402 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4403 | |
| 4404 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4405 | * bus when acting as outputs. |
| 4406 | */ |
| 4407 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4408 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4409 | |
| 4410 | /* Start with output sum widgets muted and their output gains at min */ |
| 4411 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4412 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4413 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4414 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4415 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4416 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4417 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4418 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4419 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4421 | /* Unmute Line-out pin widget amp left and right |
| 4422 | * (no equiv mixer ctrl) |
| 4423 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4424 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4425 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4426 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4427 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4428 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4429 | * will take care of enabling the pin's input/output buffers as needed. |
| 4430 | * Therefore there's no need to enable the input buffer at this |
| 4431 | * stage. |
| 4432 | */ |
| 4433 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4434 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4435 | |
| 4436 | /* Mute capture amp left and right */ |
| 4437 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4438 | /* Set ADC connection select to match default mixer setting - mic |
| 4439 | * (on mic1 pin) |
| 4440 | */ |
| 4441 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4442 | |
| 4443 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4444 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4445 | */ |
| 4446 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4447 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4448 | |
| 4449 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4450 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4451 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4452 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4453 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4454 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4455 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4456 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4457 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4458 | |
| 4459 | { } |
| 4460 | }; |
| 4461 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4462 | static struct hda_verb alc260_will_verbs[] = { |
| 4463 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4464 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4465 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4466 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4467 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4468 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4469 | {} |
| 4470 | }; |
| 4471 | |
| 4472 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4473 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4474 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4475 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4476 | |
| 4477 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4478 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4479 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4480 | |
| 4481 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4482 | {} |
| 4483 | }; |
| 4484 | |
| 4485 | /* toggle speaker-output according to the hp-jack state */ |
| 4486 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4487 | { |
| 4488 | unsigned int present; |
| 4489 | |
| 4490 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4491 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4492 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4493 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4494 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4495 | AC_VERB_SET_GPIO_DATA, 1); |
| 4496 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4497 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4498 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4499 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4500 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4501 | AC_VERB_SET_GPIO_DATA, 0); |
| 4502 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4503 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4504 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4505 | } |
| 4506 | } |
| 4507 | |
| 4508 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4509 | unsigned int res) |
| 4510 | { |
| 4511 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4512 | alc260_replacer_672v_automute(codec); |
| 4513 | } |
| 4514 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4515 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4516 | * configuration. |
| 4517 | */ |
| 4518 | #ifdef CONFIG_SND_DEBUG |
| 4519 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4520 | 0x02, |
| 4521 | }; |
| 4522 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4523 | 0x04, 0x05, |
| 4524 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4525 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4526 | * the signal assignments are different. This assumes that the first ADC |
| 4527 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4528 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4529 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4530 | { |
| 4531 | .num_items = 7, |
| 4532 | .items = { |
| 4533 | { "MIC1 pin", 0x0 }, |
| 4534 | { "MIC2 pin", 0x1 }, |
| 4535 | { "LINE1 pin", 0x2 }, |
| 4536 | { "LINE2 pin", 0x3 }, |
| 4537 | { "CD pin", 0x4 }, |
| 4538 | { "LINE-OUT pin", 0x5 }, |
| 4539 | { "HP-OUT pin", 0x6 }, |
| 4540 | }, |
| 4541 | }, |
| 4542 | { |
| 4543 | .num_items = 8, |
| 4544 | .items = { |
| 4545 | { "MIC1 pin", 0x0 }, |
| 4546 | { "MIC2 pin", 0x1 }, |
| 4547 | { "LINE1 pin", 0x2 }, |
| 4548 | { "LINE2 pin", 0x3 }, |
| 4549 | { "CD pin", 0x4 }, |
| 4550 | { "Mixer", 0x5 }, |
| 4551 | { "LINE-OUT pin", 0x6 }, |
| 4552 | { "HP-OUT pin", 0x7 }, |
| 4553 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4554 | }, |
| 4555 | }; |
| 4556 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4557 | /* Output driver widgets */ |
| 4558 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4559 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4560 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4561 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4562 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4563 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4564 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4565 | /* Modes for retasking pin widgets |
| 4566 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4567 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4568 | * mention this restriction. At this stage it's not clear whether |
| 4569 | * this behaviour is intentional or is a hardware bug in chip |
| 4570 | * revisions available at least up until early 2006. Therefore for |
| 4571 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4572 | * choices, but if it turns out that the lack of mic bias for these |
| 4573 | * NIDs is intentional we could change their modes from |
| 4574 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4575 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4576 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4577 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4578 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4579 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4580 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4581 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4582 | |
| 4583 | /* Loopback mixer controls */ |
| 4584 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4585 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4586 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4587 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4588 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4589 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4590 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4591 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4592 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4593 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4594 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4595 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4596 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4597 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4598 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4599 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4600 | |
| 4601 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4602 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4603 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4604 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4605 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4606 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4607 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4608 | * is ambigious as to which NID is which; testing on laptops which |
| 4609 | * make this output available should provide clarification. |
| 4610 | */ |
| 4611 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4612 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4613 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4614 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4615 | * this output to turn on an external amplifier. |
| 4616 | */ |
| 4617 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4618 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4619 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4620 | { } /* end */ |
| 4621 | }; |
| 4622 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4623 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4624 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4625 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4626 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4627 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4628 | /* Enable retasking pins as output, initially without power amp */ |
| 4629 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4630 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4631 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4632 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4633 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4634 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4635 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4636 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4637 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4638 | * payload also sets the generation to 0, output to be in "consumer" |
| 4639 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4640 | * control. |
| 4641 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4642 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4643 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4644 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4645 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4646 | * OUT1 sum bus when acting as an output. |
| 4647 | */ |
| 4648 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4649 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4650 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4651 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4652 | |
| 4653 | /* Start with output sum widgets muted and their output gains at min */ |
| 4654 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4655 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4656 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4657 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4658 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4659 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4660 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4661 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4662 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4663 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4664 | /* Unmute retasking pin widget output buffers since the default |
| 4665 | * state appears to be output. As the pin mode is changed by the |
| 4666 | * user the pin mode control will take care of enabling the pin's |
| 4667 | * input/output buffers as needed. |
| 4668 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4669 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4670 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4671 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4672 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4673 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4674 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4675 | /* Also unmute the mono-out pin widget */ |
| 4676 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4677 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4678 | /* Mute capture amp left and right */ |
| 4679 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4680 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4681 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4682 | */ |
| 4683 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4684 | |
| 4685 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4686 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4687 | */ |
| 4688 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4689 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4690 | |
| 4691 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4692 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4693 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4694 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4695 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4696 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4697 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4698 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4699 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4700 | |
| 4701 | { } |
| 4702 | }; |
| 4703 | #endif |
| 4704 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4705 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4706 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4707 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4708 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4709 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4710 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4711 | /* |
| 4712 | * for BIOS auto-configuration |
| 4713 | */ |
| 4714 | |
| 4715 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4716 | const char *pfx) |
| 4717 | { |
| 4718 | hda_nid_t nid_vol; |
| 4719 | unsigned long vol_val, sw_val; |
| 4720 | char name[32]; |
| 4721 | int err; |
| 4722 | |
| 4723 | if (nid >= 0x0f && nid < 0x11) { |
| 4724 | nid_vol = nid - 0x7; |
| 4725 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4726 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4727 | } else if (nid == 0x11) { |
| 4728 | nid_vol = nid - 0x7; |
| 4729 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4730 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4731 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4732 | nid_vol = 0x08; |
| 4733 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4734 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4735 | } else |
| 4736 | return 0; /* N/A */ |
| 4737 | |
| 4738 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4739 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4740 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4741 | return err; |
| 4742 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4743 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4744 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4745 | return err; |
| 4746 | return 1; |
| 4747 | } |
| 4748 | |
| 4749 | /* add playback controls from the parsed DAC table */ |
| 4750 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4751 | const struct auto_pin_cfg *cfg) |
| 4752 | { |
| 4753 | hda_nid_t nid; |
| 4754 | int err; |
| 4755 | |
| 4756 | spec->multiout.num_dacs = 1; |
| 4757 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4758 | spec->multiout.dac_nids[0] = 0x02; |
| 4759 | |
| 4760 | nid = cfg->line_out_pins[0]; |
| 4761 | if (nid) { |
| 4762 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4763 | if (err < 0) |
| 4764 | return err; |
| 4765 | } |
| 4766 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4767 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4768 | if (nid) { |
| 4769 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4770 | if (err < 0) |
| 4771 | return err; |
| 4772 | } |
| 4773 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4774 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4775 | if (nid) { |
| 4776 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4777 | if (err < 0) |
| 4778 | return err; |
| 4779 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4780 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4781 | } |
| 4782 | |
| 4783 | /* create playback/capture controls for input pins */ |
| 4784 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4785 | const struct auto_pin_cfg *cfg) |
| 4786 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4787 | struct hda_input_mux *imux = &spec->private_imux; |
| 4788 | int i, err, idx; |
| 4789 | |
| 4790 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4791 | if (cfg->input_pins[i] >= 0x12) { |
| 4792 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4793 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4794 | auto_pin_cfg_labels[i], idx, |
| 4795 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4796 | if (err < 0) |
| 4797 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4798 | imux->items[imux->num_items].label = |
| 4799 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4800 | imux->items[imux->num_items].index = idx; |
| 4801 | imux->num_items++; |
| 4802 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4803 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4804 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4805 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4806 | auto_pin_cfg_labels[i], idx, |
| 4807 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | if (err < 0) |
| 4809 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4810 | imux->items[imux->num_items].label = |
| 4811 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4812 | imux->items[imux->num_items].index = idx; |
| 4813 | imux->num_items++; |
| 4814 | } |
| 4815 | } |
| 4816 | return 0; |
| 4817 | } |
| 4818 | |
| 4819 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4820 | hda_nid_t nid, int pin_type, |
| 4821 | int sel_idx) |
| 4822 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4823 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4824 | /* need the manual connection? */ |
| 4825 | if (nid >= 0x12) { |
| 4826 | int idx = nid - 0x12; |
| 4827 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4828 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4829 | } |
| 4830 | } |
| 4831 | |
| 4832 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4833 | { |
| 4834 | struct alc_spec *spec = codec->spec; |
| 4835 | hda_nid_t nid; |
| 4836 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4837 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4838 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4839 | if (nid) { |
| 4840 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4841 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4842 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4843 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4844 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4845 | if (nid) |
| 4846 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4847 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4848 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4849 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4850 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4851 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4852 | |
| 4853 | #define ALC260_PIN_CD_NID 0x16 |
| 4854 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4855 | { |
| 4856 | struct alc_spec *spec = codec->spec; |
| 4857 | int i; |
| 4858 | |
| 4859 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4860 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4861 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4862 | snd_hda_codec_write(codec, nid, 0, |
| 4863 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4864 | i <= AUTO_PIN_FRONT_MIC ? |
| 4865 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4866 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4867 | snd_hda_codec_write(codec, nid, 0, |
| 4868 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4869 | AMP_OUT_MUTE); |
| 4870 | } |
| 4871 | } |
| 4872 | } |
| 4873 | |
| 4874 | /* |
| 4875 | * generic initialization of ADC, input mixers and output mixers |
| 4876 | */ |
| 4877 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4878 | /* |
| 4879 | * Unmute ADC0-1 and set the default input to mic-in |
| 4880 | */ |
| 4881 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4882 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4883 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4884 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4885 | |
| 4886 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4887 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4888 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4889 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4890 | */ |
| 4891 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4892 | /* mute analog inputs */ |
| 4893 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4894 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4895 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4896 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4897 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4898 | |
| 4899 | /* |
| 4900 | * Set up output mixers (0x08 - 0x0a) |
| 4901 | */ |
| 4902 | /* set vol=0 to output mixers */ |
| 4903 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4904 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4905 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4906 | /* set up input amps for analog loopback */ |
| 4907 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4909 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4910 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4911 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4912 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4913 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4914 | |
| 4915 | { } |
| 4916 | }; |
| 4917 | |
| 4918 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4919 | { |
| 4920 | struct alc_spec *spec = codec->spec; |
| 4921 | unsigned int wcap; |
| 4922 | int err; |
| 4923 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4924 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4925 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4926 | alc260_ignore); |
| 4927 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4928 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4929 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4930 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4931 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4932 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4933 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4934 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4935 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4936 | return err; |
| 4937 | |
| 4938 | spec->multiout.max_channels = 2; |
| 4939 | |
| 4940 | if (spec->autocfg.dig_out_pin) |
| 4941 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4942 | if (spec->kctl_alloc) |
| 4943 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4944 | |
| 4945 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4946 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4947 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4948 | spec->input_mux = &spec->private_imux; |
| 4949 | |
| 4950 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4951 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4952 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4953 | if (wcap != AC_WID_AUD_IN) { |
| 4954 | spec->adc_nids = alc260_adc_nids_alt; |
| 4955 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4956 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4957 | } else { |
| 4958 | spec->adc_nids = alc260_adc_nids; |
| 4959 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4960 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4961 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4962 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4963 | |
| 4964 | return 1; |
| 4965 | } |
| 4966 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4967 | /* additional initialization for auto-configuration model */ |
| 4968 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4969 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4970 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4971 | alc260_auto_init_multi_out(codec); |
| 4972 | alc260_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 4973 | if (spec->unsol_event) |
| 4974 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4975 | } |
| 4976 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4977 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4978 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4979 | { 0x07, HDA_INPUT, 0 }, |
| 4980 | { 0x07, HDA_INPUT, 1 }, |
| 4981 | { 0x07, HDA_INPUT, 2 }, |
| 4982 | { 0x07, HDA_INPUT, 3 }, |
| 4983 | { 0x07, HDA_INPUT, 4 }, |
| 4984 | { } /* end */ |
| 4985 | }; |
| 4986 | #endif |
| 4987 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4988 | /* |
| 4989 | * ALC260 configurations |
| 4990 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4991 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4992 | [ALC260_BASIC] = "basic", |
| 4993 | [ALC260_HP] = "hp", |
| 4994 | [ALC260_HP_3013] = "hp-3013", |
| 4995 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4996 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4997 | [ALC260_WILL] = "will", |
| 4998 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4999 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5000 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5001 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5002 | [ALC260_AUTO] = "auto", |
| 5003 | }; |
| 5004 | |
| 5005 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 5006 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5007 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 5008 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 5009 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5010 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 5011 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 5012 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 5013 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 5014 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 5015 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 5016 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 5017 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 5018 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 5019 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 5020 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 5021 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5022 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5023 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5024 | {} |
| 5025 | }; |
| 5026 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5027 | static struct alc_config_preset alc260_presets[] = { |
| 5028 | [ALC260_BASIC] = { |
| 5029 | .mixers = { alc260_base_output_mixer, |
| 5030 | alc260_input_mixer, |
| 5031 | alc260_pc_beep_mixer, |
| 5032 | alc260_capture_mixer }, |
| 5033 | .init_verbs = { alc260_init_verbs }, |
| 5034 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5035 | .dac_nids = alc260_dac_nids, |
| 5036 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5037 | .adc_nids = alc260_adc_nids, |
| 5038 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5039 | .channel_mode = alc260_modes, |
| 5040 | .input_mux = &alc260_capture_source, |
| 5041 | }, |
| 5042 | [ALC260_HP] = { |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5043 | .mixers = { alc260_hp_output_mixer, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5044 | alc260_input_mixer, |
| 5045 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5046 | .init_verbs = { alc260_init_verbs, |
| 5047 | alc260_hp_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5048 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5049 | .dac_nids = alc260_dac_nids, |
| 5050 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5051 | .adc_nids = alc260_hp_adc_nids, |
| 5052 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5053 | .channel_mode = alc260_modes, |
| 5054 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5055 | .unsol_event = alc260_hp_unsol_event, |
| 5056 | .init_hook = alc260_hp_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5057 | }, |
| 5058 | [ALC260_HP_3013] = { |
| 5059 | .mixers = { alc260_hp_3013_mixer, |
| 5060 | alc260_input_mixer, |
| 5061 | alc260_capture_alt_mixer }, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5062 | .init_verbs = { alc260_hp_3013_init_verbs, |
| 5063 | alc260_hp_3013_unsol_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5064 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5065 | .dac_nids = alc260_dac_nids, |
| 5066 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 5067 | .adc_nids = alc260_hp_adc_nids, |
| 5068 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5069 | .channel_mode = alc260_modes, |
| 5070 | .input_mux = &alc260_capture_source, |
Takashi Iwai | bec15c3 | 2008-01-28 18:16:30 +0100 | [diff] [blame] | 5071 | .unsol_event = alc260_hp_3013_unsol_event, |
| 5072 | .init_hook = alc260_hp_3013_automute, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5073 | }, |
| 5074 | [ALC260_FUJITSU_S702X] = { |
| 5075 | .mixers = { alc260_fujitsu_mixer, |
| 5076 | alc260_capture_mixer }, |
| 5077 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 5078 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5079 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 5080 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5081 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5082 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5083 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5084 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 5085 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5086 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5087 | [ALC260_ACER] = { |
| 5088 | .mixers = { alc260_acer_mixer, |
| 5089 | alc260_capture_mixer }, |
| 5090 | .init_verbs = { alc260_acer_init_verbs }, |
| 5091 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5092 | .dac_nids = alc260_dac_nids, |
| 5093 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 5094 | .adc_nids = alc260_dual_adc_nids, |
| 5095 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5096 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5097 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 5098 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 5099 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 5100 | [ALC260_WILL] = { |
| 5101 | .mixers = { alc260_will_mixer, |
| 5102 | alc260_capture_mixer }, |
| 5103 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 5104 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5105 | .dac_nids = alc260_dac_nids, |
| 5106 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5107 | .adc_nids = alc260_adc_nids, |
| 5108 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5109 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5110 | .channel_mode = alc260_modes, |
| 5111 | .input_mux = &alc260_capture_source, |
| 5112 | }, |
| 5113 | [ALC260_REPLACER_672V] = { |
| 5114 | .mixers = { alc260_replacer_672v_mixer, |
| 5115 | alc260_capture_mixer }, |
| 5116 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 5117 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 5118 | .dac_nids = alc260_dac_nids, |
| 5119 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 5120 | .adc_nids = alc260_adc_nids, |
| 5121 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 5122 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5123 | .channel_mode = alc260_modes, |
| 5124 | .input_mux = &alc260_capture_source, |
| 5125 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 5126 | .init_hook = alc260_replacer_672v_automute, |
| 5127 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5128 | #ifdef CONFIG_SND_DEBUG |
| 5129 | [ALC260_TEST] = { |
| 5130 | .mixers = { alc260_test_mixer, |
| 5131 | alc260_capture_mixer }, |
| 5132 | .init_verbs = { alc260_test_init_verbs }, |
| 5133 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 5134 | .dac_nids = alc260_test_dac_nids, |
| 5135 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 5136 | .adc_nids = alc260_test_adc_nids, |
| 5137 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 5138 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 5139 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 5140 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 5141 | }, |
| 5142 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5143 | }; |
| 5144 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5145 | static int patch_alc260(struct hda_codec *codec) |
| 5146 | { |
| 5147 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5148 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5149 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5150 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5151 | if (spec == NULL) |
| 5152 | return -ENOMEM; |
| 5153 | |
| 5154 | codec->spec = spec; |
| 5155 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5156 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5157 | alc260_models, |
| 5158 | alc260_cfg_tbl); |
| 5159 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5160 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5161 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5162 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5163 | } |
| 5164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5165 | if (board_config == ALC260_AUTO) { |
| 5166 | /* automatic parse from the BIOS config */ |
| 5167 | err = alc260_parse_auto_config(codec); |
| 5168 | if (err < 0) { |
| 5169 | alc_free(codec); |
| 5170 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5171 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5172 | printk(KERN_INFO |
| 5173 | "hda_codec: Cannot set up configuration " |
| 5174 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5175 | board_config = ALC260_BASIC; |
| 5176 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5177 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5178 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5179 | if (board_config != ALC260_AUTO) |
| 5180 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5181 | |
| 5182 | spec->stream_name_analog = "ALC260 Analog"; |
| 5183 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5184 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5185 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5186 | spec->stream_name_digital = "ALC260 Digital"; |
| 5187 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5188 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5189 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5190 | spec->vmaster_nid = 0x08; |
| 5191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5192 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5193 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5194 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5195 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5196 | if (!spec->loopback.amplist) |
| 5197 | spec->loopback.amplist = alc260_loopbacks; |
| 5198 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5199 | |
| 5200 | return 0; |
| 5201 | } |
| 5202 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5203 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5204 | /* |
| 5205 | * ALC882 support |
| 5206 | * |
| 5207 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5208 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5209 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5210 | * 6-channel independent captures. |
| 5211 | * |
| 5212 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5213 | * driver yet). |
| 5214 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5215 | #define ALC882_DIGOUT_NID 0x06 |
| 5216 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5217 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5218 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5219 | { 8, NULL } |
| 5220 | }; |
| 5221 | |
| 5222 | static hda_nid_t alc882_dac_nids[4] = { |
| 5223 | /* front, rear, clfe, rear_surr */ |
| 5224 | 0x02, 0x03, 0x04, 0x05 |
| 5225 | }; |
| 5226 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5227 | /* identical with ALC880 */ |
| 5228 | #define alc882_adc_nids alc880_adc_nids |
| 5229 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5230 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 5231 | static hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 }; |
| 5232 | static hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; |
| 5233 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5234 | /* input MUX */ |
| 5235 | /* FIXME: should be a matrix-type input source selection */ |
| 5236 | |
| 5237 | static struct hda_input_mux alc882_capture_source = { |
| 5238 | .num_items = 4, |
| 5239 | .items = { |
| 5240 | { "Mic", 0x0 }, |
| 5241 | { "Front Mic", 0x1 }, |
| 5242 | { "Line", 0x2 }, |
| 5243 | { "CD", 0x4 }, |
| 5244 | }, |
| 5245 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5246 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5247 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5248 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5249 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5250 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5251 | { |
| 5252 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5253 | struct alc_spec *spec = codec->spec; |
| 5254 | const struct hda_input_mux *imux = spec->input_mux; |
| 5255 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 5256 | hda_nid_t nid = spec->capsrc_nids ? |
| 5257 | spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5258 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5259 | unsigned int i, idx; |
| 5260 | |
| 5261 | idx = ucontrol->value.enumerated.item[0]; |
| 5262 | if (idx >= imux->num_items) |
| 5263 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5264 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5265 | return 0; |
| 5266 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5267 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5268 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5269 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5270 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5271 | } |
| 5272 | *cur_val = idx; |
| 5273 | return 1; |
| 5274 | } |
| 5275 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5276 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5277 | * 2ch mode |
| 5278 | */ |
| 5279 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5280 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5281 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5282 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5283 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5284 | { } /* end */ |
| 5285 | }; |
| 5286 | |
| 5287 | /* |
| 5288 | * 6ch mode |
| 5289 | */ |
| 5290 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5291 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5292 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5293 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5294 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5295 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5296 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5297 | { } /* end */ |
| 5298 | }; |
| 5299 | |
| 5300 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5301 | { 2, alc882_3ST_ch2_init }, |
| 5302 | { 6, alc882_3ST_ch6_init }, |
| 5303 | }; |
| 5304 | |
| 5305 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5306 | * 6ch mode |
| 5307 | */ |
| 5308 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5309 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5310 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5311 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5312 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5313 | { } /* end */ |
| 5314 | }; |
| 5315 | |
| 5316 | /* |
| 5317 | * 8ch mode |
| 5318 | */ |
| 5319 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5320 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5321 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5322 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5323 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5324 | { } /* end */ |
| 5325 | }; |
| 5326 | |
| 5327 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5328 | { 6, alc882_sixstack_ch6_init }, |
| 5329 | { 8, alc882_sixstack_ch8_init }, |
| 5330 | }; |
| 5331 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5332 | /* |
| 5333 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5334 | */ |
| 5335 | |
| 5336 | /* |
| 5337 | * 2ch mode |
| 5338 | */ |
| 5339 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5340 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5341 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5342 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5343 | { } /* end */ |
| 5344 | }; |
| 5345 | |
| 5346 | /* |
| 5347 | * 6ch mode |
| 5348 | */ |
| 5349 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5350 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5351 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5352 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5353 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5354 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5355 | { } /* end */ |
| 5356 | }; |
| 5357 | |
| 5358 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5359 | { 2, alc885_mbp_ch2_init }, |
| 5360 | { 6, alc885_mbp_ch6_init }, |
| 5361 | }; |
| 5362 | |
| 5363 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5364 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5365 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5366 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5367 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5368 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5369 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5370 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5371 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5372 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5373 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5374 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5375 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5376 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5377 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5378 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5380 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5381 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5382 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5383 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5384 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5385 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5386 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5387 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5388 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5389 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5390 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5391 | { } /* end */ |
| 5392 | }; |
| 5393 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5394 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5395 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5396 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5397 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5398 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5399 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5400 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5401 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5402 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5403 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5404 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5405 | { } /* end */ |
| 5406 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5407 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5408 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5409 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5410 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5411 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5412 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5413 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5414 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5415 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5416 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5417 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5418 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5419 | { } /* end */ |
| 5420 | }; |
| 5421 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5422 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5423 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5424 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5425 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5426 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5427 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5428 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5429 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5430 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5431 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5432 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5433 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5434 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5435 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5436 | { } /* end */ |
| 5437 | }; |
| 5438 | |
| 5439 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5440 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5441 | */ |
| 5442 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5444 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5445 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5446 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5447 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5448 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5449 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5450 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5451 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5452 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5453 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5454 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5455 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5456 | { } /* end */ |
| 5457 | }; |
| 5458 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5459 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5460 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5461 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5462 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5463 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5464 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5465 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5466 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5467 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5468 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5470 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5471 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5472 | { } /* end */ |
| 5473 | }; |
| 5474 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5475 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5476 | { |
| 5477 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5478 | .name = "Channel Mode", |
| 5479 | .info = alc_ch_mode_info, |
| 5480 | .get = alc_ch_mode_get, |
| 5481 | .put = alc_ch_mode_put, |
| 5482 | }, |
| 5483 | { } /* end */ |
| 5484 | }; |
| 5485 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5486 | static struct hda_verb alc882_init_verbs[] = { |
| 5487 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5490 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5491 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5494 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5495 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5496 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5497 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5498 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5499 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5500 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5501 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5502 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5503 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5504 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5505 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5506 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5507 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5508 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5509 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5510 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5511 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5512 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5513 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5514 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5515 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5516 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5517 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5518 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5519 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5520 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5521 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5522 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5523 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5524 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5525 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5526 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5527 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5528 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5529 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5530 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5531 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5532 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5533 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5534 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5535 | |
| 5536 | /* FIXME: use matrix-type input source selection */ |
| 5537 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5538 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5539 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5540 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5541 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5542 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5543 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5544 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5545 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5546 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5547 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5548 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5549 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5550 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5551 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5552 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5553 | /* ADC1: mute amp left and right */ |
| 5554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5555 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5556 | /* ADC2: mute amp left and right */ |
| 5557 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5558 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5559 | /* ADC3: mute amp left and right */ |
| 5560 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5561 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5562 | |
| 5563 | { } |
| 5564 | }; |
| 5565 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5566 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5567 | /* change to EAPD mode */ |
| 5568 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5569 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5570 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5571 | }; |
| 5572 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5573 | /* Mac Pro test */ |
| 5574 | static struct snd_kcontrol_new alc882_macpro_mixer[] = { |
| 5575 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5576 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5577 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
| 5578 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5579 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5580 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5581 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5582 | { } /* end */ |
| 5583 | }; |
| 5584 | |
| 5585 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5586 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5588 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5589 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5590 | /* Front Pin: output 0 (0x0c) */ |
| 5591 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5592 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5593 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5594 | /* Front Mic pin: input vref at 80% */ |
| 5595 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5596 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5597 | /* Speaker: output */ |
| 5598 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5599 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5600 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5601 | /* Headphone output (output 0 - 0x0c) */ |
| 5602 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5603 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5604 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5605 | |
| 5606 | /* FIXME: use matrix-type input source selection */ |
| 5607 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5608 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5609 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5610 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5611 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5612 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5613 | /* Input mixer2 */ |
| 5614 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5615 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5616 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5617 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5618 | /* Input mixer3 */ |
| 5619 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5620 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5621 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5622 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5623 | /* ADC1: mute amp left and right */ |
| 5624 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5625 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5626 | /* ADC2: mute amp left and right */ |
| 5627 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5628 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5629 | /* ADC3: mute amp left and right */ |
| 5630 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5631 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5632 | |
| 5633 | { } |
| 5634 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5635 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5636 | /* Macbook Pro rev3 */ |
| 5637 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5638 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5639 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5640 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5641 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5642 | /* Rear mixer */ |
| 5643 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5644 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5645 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5646 | /* Front Pin: output 0 (0x0c) */ |
| 5647 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5648 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5649 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5650 | /* HP Pin: output 0 (0x0d) */ |
| 5651 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5652 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5653 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5654 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5655 | /* Mic (rear) pin: input vref at 80% */ |
| 5656 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5657 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5658 | /* Front Mic pin: input vref at 80% */ |
| 5659 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5660 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5661 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5662 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5663 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5664 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5665 | |
| 5666 | /* FIXME: use matrix-type input source selection */ |
| 5667 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5668 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5669 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5670 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5671 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5672 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5673 | /* Input mixer2 */ |
| 5674 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5675 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5676 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5677 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5678 | /* Input mixer3 */ |
| 5679 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5680 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5681 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5682 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5683 | /* ADC1: mute amp left and right */ |
| 5684 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5685 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5686 | /* ADC2: mute amp left and right */ |
| 5687 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5688 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5689 | /* ADC3: mute amp left and right */ |
| 5690 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5691 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5692 | |
| 5693 | { } |
| 5694 | }; |
| 5695 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5696 | /* iMac 24 mixer. */ |
| 5697 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5698 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5699 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5700 | { } /* end */ |
| 5701 | }; |
| 5702 | |
| 5703 | /* iMac 24 init verbs. */ |
| 5704 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5705 | /* Internal speakers: output 0 (0x0c) */ |
| 5706 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5707 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5708 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5709 | /* Internal speakers: output 0 (0x0c) */ |
| 5710 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5711 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5712 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5713 | /* Headphone: output 0 (0x0c) */ |
| 5714 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5715 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5716 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5717 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5718 | /* Front Mic: input vref at 80% */ |
| 5719 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5720 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5721 | { } |
| 5722 | }; |
| 5723 | |
| 5724 | /* Toggle speaker-output according to the hp-jack state */ |
| 5725 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5726 | { |
| 5727 | unsigned int present; |
| 5728 | |
| 5729 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5730 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5731 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5732 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5733 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5734 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5735 | } |
| 5736 | |
| 5737 | /* Processes unsolicited events. */ |
| 5738 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5739 | unsigned int res) |
| 5740 | { |
| 5741 | /* Headphone insertion or removal. */ |
| 5742 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5743 | alc885_imac24_automute(codec); |
| 5744 | } |
| 5745 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5746 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5747 | { |
| 5748 | unsigned int present; |
| 5749 | |
| 5750 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5751 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5752 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5753 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5754 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5755 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5756 | |
| 5757 | } |
| 5758 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5759 | unsigned int res) |
| 5760 | { |
| 5761 | /* Headphone insertion or removal. */ |
| 5762 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5763 | alc885_mbp3_automute(codec); |
| 5764 | } |
| 5765 | |
| 5766 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5767 | static struct hda_verb alc882_targa_verbs[] = { |
| 5768 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5769 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5770 | |
| 5771 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5772 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5773 | |
| 5774 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5775 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5776 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5777 | |
| 5778 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5779 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5780 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5781 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5782 | { } /* end */ |
| 5783 | }; |
| 5784 | |
| 5785 | /* toggle speaker-output according to the hp-jack state */ |
| 5786 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5787 | { |
| 5788 | unsigned int present; |
| 5789 | |
| 5790 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5791 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5792 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5793 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5794 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5795 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5796 | } |
| 5797 | |
| 5798 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5799 | { |
| 5800 | /* Looks like the unsol event is incompatible with the standard |
| 5801 | * definition. 4bit tag is placed at 26 bit! |
| 5802 | */ |
| 5803 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5804 | alc882_targa_automute(codec); |
| 5805 | } |
| 5806 | } |
| 5807 | |
| 5808 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5809 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5810 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5811 | |
| 5812 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5813 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5814 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5815 | |
| 5816 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5817 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5818 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5819 | |
| 5820 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5821 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5822 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5823 | { } /* end */ |
| 5824 | }; |
| 5825 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5826 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5827 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5828 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5829 | |
| 5830 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5831 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5832 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5833 | |
| 5834 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5835 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5836 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5837 | |
| 5838 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5839 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5840 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5841 | { } /* end */ |
| 5842 | }; |
| 5843 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5844 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5845 | { |
| 5846 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5847 | |
| 5848 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5849 | AC_VERB_GET_GPIO_DATA, 0); |
| 5850 | |
| 5851 | if (!muted) |
| 5852 | gpiostate |= (1 << pin); |
| 5853 | else |
| 5854 | gpiostate &= ~(1 << pin); |
| 5855 | |
| 5856 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5857 | AC_VERB_GET_GPIO_MASK, 0); |
| 5858 | gpiomask |= (1 << pin); |
| 5859 | |
| 5860 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5861 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5862 | gpiodir |= (1 << pin); |
| 5863 | |
| 5864 | |
| 5865 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5866 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5867 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5868 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5869 | |
| 5870 | msleep(1); |
| 5871 | |
| 5872 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5873 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5874 | } |
| 5875 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5876 | /* set up GPIO at initialization */ |
| 5877 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5878 | { |
| 5879 | alc882_gpio_mute(codec, 0, 0); |
| 5880 | alc882_gpio_mute(codec, 1, 0); |
| 5881 | } |
| 5882 | |
| 5883 | /* set up GPIO and update auto-muting at initialization */ |
| 5884 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5885 | { |
| 5886 | alc885_macpro_init_hook(codec); |
| 5887 | alc885_imac24_automute(codec); |
| 5888 | } |
| 5889 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5890 | /* |
| 5891 | * generic initialization of ADC, input mixers and output mixers |
| 5892 | */ |
| 5893 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5894 | /* |
| 5895 | * Unmute ADC0-2 and set the default input to mic-in |
| 5896 | */ |
| 5897 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5898 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5899 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5900 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5901 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5902 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5903 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5904 | /* 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] | 5905 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5906 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5907 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5908 | */ |
| 5909 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5910 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5911 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5912 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5913 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5914 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5915 | |
| 5916 | /* |
| 5917 | * Set up output mixers (0x0c - 0x0f) |
| 5918 | */ |
| 5919 | /* set vol=0 to output mixers */ |
| 5920 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5921 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5923 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5924 | /* set up input amps for analog loopback */ |
| 5925 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5926 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5927 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5928 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5929 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5930 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5931 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5932 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5933 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5934 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5935 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5936 | |
| 5937 | /* FIXME: use matrix-type input source selection */ |
| 5938 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5939 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5940 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5941 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5942 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5943 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5944 | /* Input mixer2 */ |
| 5945 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5946 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5947 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5948 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5949 | /* Input mixer3 */ |
| 5950 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5951 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5952 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5953 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5954 | |
| 5955 | { } |
| 5956 | }; |
| 5957 | |
| 5958 | /* capture mixer elements */ |
| 5959 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5960 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5961 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5962 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5963 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5964 | { |
| 5965 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5966 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5967 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5968 | */ |
| 5969 | /* .name = "Capture Source", */ |
| 5970 | .name = "Input Source", |
| 5971 | .count = 2, |
| 5972 | .info = alc882_mux_enum_info, |
| 5973 | .get = alc882_mux_enum_get, |
| 5974 | .put = alc882_mux_enum_put, |
| 5975 | }, |
| 5976 | { } /* end */ |
| 5977 | }; |
| 5978 | |
| 5979 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5980 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5981 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5982 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5983 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5984 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5985 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5986 | { |
| 5987 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5988 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5989 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5990 | */ |
| 5991 | /* .name = "Capture Source", */ |
| 5992 | .name = "Input Source", |
| 5993 | .count = 3, |
| 5994 | .info = alc882_mux_enum_info, |
| 5995 | .get = alc882_mux_enum_get, |
| 5996 | .put = alc882_mux_enum_put, |
| 5997 | }, |
| 5998 | { } /* end */ |
| 5999 | }; |
| 6000 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6001 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6002 | #define alc882_loopbacks alc880_loopbacks |
| 6003 | #endif |
| 6004 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6005 | /* pcm configuration: identiacal with ALC880 */ |
| 6006 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 6007 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 6008 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 6009 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 6010 | |
| 6011 | /* |
| 6012 | * configuration and preset |
| 6013 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6014 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 6015 | [ALC882_3ST_DIG] = "3stack-dig", |
| 6016 | [ALC882_6ST_DIG] = "6stack-dig", |
| 6017 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6018 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 6019 | [ALC882_TARGA] = "targa", |
| 6020 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 6021 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6022 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6023 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6024 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6025 | [ALC882_AUTO] = "auto", |
| 6026 | }; |
| 6027 | |
| 6028 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 6029 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6030 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 6031 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6032 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6033 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 6034 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 6035 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6036 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 6037 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 6038 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 6039 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 6040 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6041 | {} |
| 6042 | }; |
| 6043 | |
| 6044 | static struct alc_config_preset alc882_presets[] = { |
| 6045 | [ALC882_3ST_DIG] = { |
| 6046 | .mixers = { alc882_base_mixer }, |
| 6047 | .init_verbs = { alc882_init_verbs }, |
| 6048 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6049 | .dac_nids = alc882_dac_nids, |
| 6050 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6051 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6052 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6053 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 6054 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6055 | .input_mux = &alc882_capture_source, |
| 6056 | }, |
| 6057 | [ALC882_6ST_DIG] = { |
| 6058 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6059 | .init_verbs = { alc882_init_verbs }, |
| 6060 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6061 | .dac_nids = alc882_dac_nids, |
| 6062 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6063 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6064 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6065 | .channel_mode = alc882_sixstack_modes, |
| 6066 | .input_mux = &alc882_capture_source, |
| 6067 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 6068 | [ALC882_ARIMA] = { |
| 6069 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 6070 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 6071 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6072 | .dac_nids = alc882_dac_nids, |
| 6073 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 6074 | .channel_mode = alc882_sixstack_modes, |
| 6075 | .input_mux = &alc882_capture_source, |
| 6076 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 6077 | [ALC882_W2JC] = { |
| 6078 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 6079 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6080 | alc880_gpio1_init_verbs }, |
| 6081 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6082 | .dac_nids = alc882_dac_nids, |
| 6083 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6084 | .channel_mode = alc880_threestack_modes, |
| 6085 | .need_dac_fix = 1, |
| 6086 | .input_mux = &alc882_capture_source, |
| 6087 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6088 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6089 | [ALC885_MBP3] = { |
| 6090 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 6091 | .init_verbs = { alc885_mbp3_init_verbs, |
| 6092 | alc880_gpio1_init_verbs }, |
| 6093 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6094 | .dac_nids = alc882_dac_nids, |
| 6095 | .channel_mode = alc885_mbp_6ch_modes, |
| 6096 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 6097 | .input_mux = &alc882_capture_source, |
| 6098 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6099 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6100 | .unsol_event = alc885_mbp3_unsol_event, |
| 6101 | .init_hook = alc885_mbp3_automute, |
| 6102 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6103 | [ALC885_MACPRO] = { |
| 6104 | .mixers = { alc882_macpro_mixer }, |
| 6105 | .init_verbs = { alc882_macpro_init_verbs }, |
| 6106 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6107 | .dac_nids = alc882_dac_nids, |
| 6108 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6109 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6110 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6111 | .channel_mode = alc882_ch_modes, |
| 6112 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6113 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 6114 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6115 | [ALC885_IMAC24] = { |
| 6116 | .mixers = { alc885_imac24_mixer }, |
| 6117 | .init_verbs = { alc885_imac24_init_verbs }, |
| 6118 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6119 | .dac_nids = alc882_dac_nids, |
| 6120 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6121 | .dig_in_nid = ALC882_DIGIN_NID, |
| 6122 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 6123 | .channel_mode = alc882_ch_modes, |
| 6124 | .input_mux = &alc882_capture_source, |
| 6125 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 6126 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6127 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6128 | [ALC882_TARGA] = { |
| 6129 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 6130 | alc882_capture_mixer }, |
| 6131 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 6132 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6133 | .dac_nids = alc882_dac_nids, |
| 6134 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6135 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6136 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6137 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6138 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6139 | .channel_mode = alc882_3ST_6ch_modes, |
| 6140 | .need_dac_fix = 1, |
| 6141 | .input_mux = &alc882_capture_source, |
| 6142 | .unsol_event = alc882_targa_unsol_event, |
| 6143 | .init_hook = alc882_targa_automute, |
| 6144 | }, |
| 6145 | [ALC882_ASUS_A7J] = { |
| 6146 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 6147 | alc882_capture_mixer }, |
| 6148 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 6149 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6150 | .dac_nids = alc882_dac_nids, |
| 6151 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6152 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6153 | .adc_nids = alc882_adc_nids, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6154 | .capsrc_nids = alc882_capsrc_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6155 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6156 | .channel_mode = alc882_3ST_6ch_modes, |
| 6157 | .need_dac_fix = 1, |
| 6158 | .input_mux = &alc882_capture_source, |
| 6159 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6160 | [ALC882_ASUS_A7M] = { |
| 6161 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6162 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6163 | alc880_gpio1_init_verbs, |
| 6164 | alc882_asus_a7m_verbs }, |
| 6165 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6166 | .dac_nids = alc882_dac_nids, |
| 6167 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6168 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6169 | .channel_mode = alc880_threestack_modes, |
| 6170 | .need_dac_fix = 1, |
| 6171 | .input_mux = &alc882_capture_source, |
| 6172 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6173 | }; |
| 6174 | |
| 6175 | |
| 6176 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6177 | * Pin config fixes |
| 6178 | */ |
| 6179 | enum { |
| 6180 | PINFIX_ABIT_AW9D_MAX |
| 6181 | }; |
| 6182 | |
| 6183 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6184 | { 0x15, 0x01080104 }, /* side */ |
| 6185 | { 0x16, 0x01011012 }, /* rear */ |
| 6186 | { 0x17, 0x01016011 }, /* clfe */ |
| 6187 | { } |
| 6188 | }; |
| 6189 | |
| 6190 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6191 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6192 | }; |
| 6193 | |
| 6194 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6195 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6196 | {} |
| 6197 | }; |
| 6198 | |
| 6199 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6200 | * BIOS auto configuration |
| 6201 | */ |
| 6202 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6203 | hda_nid_t nid, int pin_type, |
| 6204 | int dac_idx) |
| 6205 | { |
| 6206 | /* set as output */ |
| 6207 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6208 | int idx; |
| 6209 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6210 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6211 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6212 | idx = 4; |
| 6213 | else |
| 6214 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6215 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6216 | |
| 6217 | } |
| 6218 | |
| 6219 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6220 | { |
| 6221 | struct alc_spec *spec = codec->spec; |
| 6222 | int i; |
| 6223 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6224 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6225 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6226 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6227 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6228 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6229 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6230 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6231 | } |
| 6232 | } |
| 6233 | |
| 6234 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6235 | { |
| 6236 | struct alc_spec *spec = codec->spec; |
| 6237 | hda_nid_t pin; |
| 6238 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6239 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6240 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6241 | /* use dac 0 */ |
| 6242 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6243 | pin = spec->autocfg.speaker_pins[0]; |
| 6244 | if (pin) |
| 6245 | alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6246 | } |
| 6247 | |
| 6248 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6249 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6250 | |
| 6251 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6252 | { |
| 6253 | struct alc_spec *spec = codec->spec; |
| 6254 | int i; |
| 6255 | |
| 6256 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6257 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6258 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6259 | snd_hda_codec_write(codec, nid, 0, |
| 6260 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6261 | i <= AUTO_PIN_FRONT_MIC ? |
| 6262 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6263 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6264 | snd_hda_codec_write(codec, nid, 0, |
| 6265 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6266 | AMP_OUT_MUTE); |
| 6267 | } |
| 6268 | } |
| 6269 | } |
| 6270 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6271 | /* add mic boosts if needed */ |
| 6272 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6273 | { |
| 6274 | struct alc_spec *spec = codec->spec; |
| 6275 | int err; |
| 6276 | hda_nid_t nid; |
| 6277 | |
| 6278 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6279 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6280 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6281 | "Mic Boost", |
| 6282 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6283 | if (err < 0) |
| 6284 | return err; |
| 6285 | } |
| 6286 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6287 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6288 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6289 | "Front Mic Boost", |
| 6290 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6291 | if (err < 0) |
| 6292 | return err; |
| 6293 | } |
| 6294 | return 0; |
| 6295 | } |
| 6296 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6297 | /* almost identical with ALC880 parser... */ |
| 6298 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6299 | { |
| 6300 | struct alc_spec *spec = codec->spec; |
| 6301 | int err = alc880_parse_auto_config(codec); |
| 6302 | |
| 6303 | if (err < 0) |
| 6304 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6305 | else if (!err) |
| 6306 | return 0; /* no config found */ |
| 6307 | |
| 6308 | err = alc_auto_add_mic_boost(codec); |
| 6309 | if (err < 0) |
| 6310 | return err; |
| 6311 | |
| 6312 | /* hack - override the init verbs */ |
| 6313 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6314 | |
| 6315 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6316 | } |
| 6317 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6318 | /* additional initialization for auto-configuration model */ |
| 6319 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6320 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6321 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6322 | alc882_auto_init_multi_out(codec); |
| 6323 | alc882_auto_init_hp_out(codec); |
| 6324 | alc882_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 6325 | if (spec->unsol_event) |
| 6326 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6327 | } |
| 6328 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6329 | static int patch_alc882(struct hda_codec *codec) |
| 6330 | { |
| 6331 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6332 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6333 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6334 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6335 | if (spec == NULL) |
| 6336 | return -ENOMEM; |
| 6337 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6338 | codec->spec = spec; |
| 6339 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6340 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6341 | alc882_models, |
| 6342 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6343 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6344 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6345 | /* Pick up systems that don't supply PCI SSID */ |
| 6346 | switch (codec->subsystem_id) { |
| 6347 | case 0x106b0c00: /* Mac Pro */ |
| 6348 | board_config = ALC885_MACPRO; |
| 6349 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6350 | case 0x106b1000: /* iMac 24 */ |
| 6351 | board_config = ALC885_IMAC24; |
| 6352 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6353 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6354 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6355 | board_config = ALC885_MBP3; |
| 6356 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6357 | default: |
| 6358 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6359 | "trying auto-probe from BIOS...\n"); |
| 6360 | board_config = ALC882_AUTO; |
| 6361 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6362 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6363 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6364 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6365 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6366 | if (board_config == ALC882_AUTO) { |
| 6367 | /* automatic parse from the BIOS config */ |
| 6368 | err = alc882_parse_auto_config(codec); |
| 6369 | if (err < 0) { |
| 6370 | alc_free(codec); |
| 6371 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6372 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6373 | printk(KERN_INFO |
| 6374 | "hda_codec: Cannot set up configuration " |
| 6375 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6376 | board_config = ALC882_3ST_DIG; |
| 6377 | } |
| 6378 | } |
| 6379 | |
| 6380 | if (board_config != ALC882_AUTO) |
| 6381 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6382 | |
| 6383 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6384 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6385 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6386 | /* FIXME: setup DAC5 */ |
| 6387 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6388 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6389 | |
| 6390 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6391 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6392 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6393 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6394 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6395 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6396 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6397 | /* get type */ |
| 6398 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6399 | if (wcap != AC_WID_AUD_IN) { |
| 6400 | spec->adc_nids = alc882_adc_nids_alt; |
| 6401 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6402 | spec->capsrc_nids = alc882_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6403 | spec->mixers[spec->num_mixers] = |
| 6404 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6405 | spec->num_mixers++; |
| 6406 | } else { |
| 6407 | spec->adc_nids = alc882_adc_nids; |
| 6408 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6409 | spec->capsrc_nids = alc882_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6410 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6411 | spec->num_mixers++; |
| 6412 | } |
| 6413 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6414 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6415 | spec->vmaster_nid = 0x0c; |
| 6416 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6417 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6418 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6419 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6420 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6421 | if (!spec->loopback.amplist) |
| 6422 | spec->loopback.amplist = alc882_loopbacks; |
| 6423 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6424 | |
| 6425 | return 0; |
| 6426 | } |
| 6427 | |
| 6428 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6429 | * ALC883 support |
| 6430 | * |
| 6431 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6432 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6433 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6434 | * 6-channel independent captures. |
| 6435 | * |
| 6436 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6437 | * driver yet). |
| 6438 | */ |
| 6439 | #define ALC883_DIGOUT_NID 0x06 |
| 6440 | #define ALC883_DIGIN_NID 0x0a |
| 6441 | |
| 6442 | static hda_nid_t alc883_dac_nids[4] = { |
| 6443 | /* front, rear, clfe, rear_surr */ |
| 6444 | 0x02, 0x04, 0x03, 0x05 |
| 6445 | }; |
| 6446 | |
| 6447 | static hda_nid_t alc883_adc_nids[2] = { |
| 6448 | /* ADC1-2 */ |
| 6449 | 0x08, 0x09, |
| 6450 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6451 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6452 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
| 6453 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6454 | /* input MUX */ |
| 6455 | /* FIXME: should be a matrix-type input source selection */ |
| 6456 | |
| 6457 | static struct hda_input_mux alc883_capture_source = { |
| 6458 | .num_items = 4, |
| 6459 | .items = { |
| 6460 | { "Mic", 0x0 }, |
| 6461 | { "Front Mic", 0x1 }, |
| 6462 | { "Line", 0x2 }, |
| 6463 | { "CD", 0x4 }, |
| 6464 | }, |
| 6465 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6466 | |
| 6467 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6468 | .num_items = 2, |
| 6469 | .items = { |
| 6470 | { "Mic", 0x1 }, |
| 6471 | { "Line", 0x2 }, |
| 6472 | }, |
| 6473 | }; |
| 6474 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6475 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6476 | .num_items = 4, |
| 6477 | .items = { |
| 6478 | { "Mic", 0x0 }, |
| 6479 | { "iMic", 0x1 }, |
| 6480 | { "Line", 0x2 }, |
| 6481 | { "CD", 0x4 }, |
| 6482 | }, |
| 6483 | }; |
| 6484 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6485 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6486 | #define alc883_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 6487 | /* ALC883 has the ALC882-type input selection */ |
| 6488 | #define alc883_mux_enum_put alc882_mux_enum_put |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6489 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6490 | /* |
| 6491 | * 2ch mode |
| 6492 | */ |
| 6493 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6494 | { 2, NULL } |
| 6495 | }; |
| 6496 | |
| 6497 | /* |
| 6498 | * 2ch mode |
| 6499 | */ |
| 6500 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6501 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6502 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6503 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6504 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6505 | { } /* end */ |
| 6506 | }; |
| 6507 | |
| 6508 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6509 | * 4ch mode |
| 6510 | */ |
| 6511 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6512 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6513 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6514 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6515 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6516 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6517 | { } /* end */ |
| 6518 | }; |
| 6519 | |
| 6520 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6521 | * 6ch mode |
| 6522 | */ |
| 6523 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6524 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6525 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6526 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6527 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6528 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6529 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6530 | { } /* end */ |
| 6531 | }; |
| 6532 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6533 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6534 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6535 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6536 | { 6, alc883_3ST_ch6_init }, |
| 6537 | }; |
| 6538 | |
| 6539 | /* |
| 6540 | * 6ch mode |
| 6541 | */ |
| 6542 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6543 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6544 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6545 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6546 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6547 | { } /* end */ |
| 6548 | }; |
| 6549 | |
| 6550 | /* |
| 6551 | * 8ch mode |
| 6552 | */ |
| 6553 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6554 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6555 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6556 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6557 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6558 | { } /* end */ |
| 6559 | }; |
| 6560 | |
| 6561 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6562 | { 6, alc883_sixstack_ch6_init }, |
| 6563 | { 8, alc883_sixstack_ch8_init }, |
| 6564 | }; |
| 6565 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6566 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6567 | /* eanable EAPD on medion laptop */ |
| 6568 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6569 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6570 | { } |
| 6571 | }; |
| 6572 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6573 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6574 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6575 | */ |
| 6576 | |
| 6577 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6578 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6579 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6580 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6581 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6582 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6583 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6584 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6585 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6586 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6587 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6588 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6589 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6590 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6591 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6592 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6593 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6594 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6595 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6596 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6597 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6598 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6599 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6600 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6601 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6602 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6603 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6604 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6605 | { |
| 6606 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6607 | /* .name = "Capture Source", */ |
| 6608 | .name = "Input Source", |
| 6609 | .count = 2, |
| 6610 | .info = alc883_mux_enum_info, |
| 6611 | .get = alc883_mux_enum_get, |
| 6612 | .put = alc883_mux_enum_put, |
| 6613 | }, |
| 6614 | { } /* end */ |
| 6615 | }; |
| 6616 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6617 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6618 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6619 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6620 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6621 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6622 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6623 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6624 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6625 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6626 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6627 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6628 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6629 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6630 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6631 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6632 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6633 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6634 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6635 | { |
| 6636 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6637 | /* .name = "Capture Source", */ |
| 6638 | .name = "Input Source", |
| 6639 | .count = 2, |
| 6640 | .info = alc883_mux_enum_info, |
| 6641 | .get = alc883_mux_enum_get, |
| 6642 | .put = alc883_mux_enum_put, |
| 6643 | }, |
| 6644 | { } /* end */ |
| 6645 | }; |
| 6646 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6647 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6648 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6649 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6650 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6651 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6652 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6653 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6654 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6655 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6656 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6657 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6658 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6659 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6660 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6661 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6662 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6663 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6664 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6665 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6666 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6667 | { |
| 6668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6669 | /* .name = "Capture Source", */ |
| 6670 | .name = "Input Source", |
| 6671 | .count = 2, |
| 6672 | .info = alc883_mux_enum_info, |
| 6673 | .get = alc883_mux_enum_get, |
| 6674 | .put = alc883_mux_enum_put, |
| 6675 | }, |
| 6676 | { } /* end */ |
| 6677 | }; |
| 6678 | |
| 6679 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6680 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6681 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6682 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6683 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6684 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6685 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6686 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6687 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6688 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6690 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6691 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6692 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6693 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6694 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6695 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6696 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6697 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6698 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6699 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6700 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6701 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6702 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6703 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6704 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6705 | { |
| 6706 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6707 | /* .name = "Capture Source", */ |
| 6708 | .name = "Input Source", |
| 6709 | .count = 2, |
| 6710 | .info = alc883_mux_enum_info, |
| 6711 | .get = alc883_mux_enum_get, |
| 6712 | .put = alc883_mux_enum_put, |
| 6713 | }, |
| 6714 | { } /* end */ |
| 6715 | }; |
| 6716 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6717 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6718 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6719 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6720 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6721 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6722 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6723 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6724 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6725 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6726 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6727 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6728 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6729 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6730 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6731 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6732 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6734 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6735 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6736 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6737 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6738 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6739 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6740 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6741 | |
| 6742 | { |
| 6743 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6744 | /* .name = "Capture Source", */ |
| 6745 | .name = "Input Source", |
| 6746 | .count = 1, |
| 6747 | .info = alc883_mux_enum_info, |
| 6748 | .get = alc883_mux_enum_get, |
| 6749 | .put = alc883_mux_enum_put, |
| 6750 | }, |
| 6751 | { } /* end */ |
| 6752 | }; |
| 6753 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6754 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6755 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6756 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6757 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6758 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6759 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6760 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6761 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6762 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6763 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6764 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6765 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6766 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6767 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6768 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, 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 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6785 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6786 | |
| 6787 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6788 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6789 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6790 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6791 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6792 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6793 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6794 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6795 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6796 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6797 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6798 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6799 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6800 | { |
| 6801 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6802 | /* .name = "Capture Source", */ |
| 6803 | .name = "Input Source", |
| 6804 | .count = 2, |
| 6805 | .info = alc883_mux_enum_info, |
| 6806 | .get = alc883_mux_enum_get, |
| 6807 | .put = alc883_mux_enum_put, |
| 6808 | }, |
| 6809 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6810 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6811 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6812 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6813 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6814 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6815 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6816 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6817 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6819 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6820 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6821 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6822 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6823 | { |
| 6824 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6825 | /* .name = "Capture Source", */ |
| 6826 | .name = "Input Source", |
| 6827 | .count = 1, |
| 6828 | .info = alc883_mux_enum_info, |
| 6829 | .get = alc883_mux_enum_get, |
| 6830 | .put = alc883_mux_enum_put, |
| 6831 | }, |
| 6832 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6833 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6834 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6835 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6836 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6837 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6838 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6840 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6841 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6842 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6843 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6844 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6845 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6846 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6847 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6848 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6849 | { |
| 6850 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6851 | /* .name = "Capture Source", */ |
| 6852 | .name = "Input Source", |
| 6853 | .count = 2, |
| 6854 | .info = alc883_mux_enum_info, |
| 6855 | .get = alc883_mux_enum_get, |
| 6856 | .put = alc883_mux_enum_put, |
| 6857 | }, |
| 6858 | { } /* end */ |
| 6859 | }; |
| 6860 | |
| 6861 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6862 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6863 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6864 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6865 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6866 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6867 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6868 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6869 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6870 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6871 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6872 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6873 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6874 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6875 | { |
| 6876 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6877 | /* .name = "Capture Source", */ |
| 6878 | .name = "Input Source", |
| 6879 | .count = 2, |
| 6880 | .info = alc883_mux_enum_info, |
| 6881 | .get = alc883_mux_enum_get, |
| 6882 | .put = alc883_mux_enum_put, |
| 6883 | }, |
| 6884 | { } /* end */ |
| 6885 | }; |
| 6886 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6887 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6888 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6889 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6890 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6891 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6892 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6893 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6894 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6895 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6896 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6897 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6898 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6899 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6900 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6901 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6902 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6903 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6904 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6905 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6906 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6907 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6908 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6909 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6910 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6911 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6912 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6913 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6914 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6915 | { |
| 6916 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6917 | /* .name = "Capture Source", */ |
| 6918 | .name = "Input Source", |
| 6919 | .count = 2, |
| 6920 | .info = alc883_mux_enum_info, |
| 6921 | .get = alc883_mux_enum_get, |
| 6922 | .put = alc883_mux_enum_put, |
| 6923 | }, |
| 6924 | { } /* end */ |
| 6925 | }; |
| 6926 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6927 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6928 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6929 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6930 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6931 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6932 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6933 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6934 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6935 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6936 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6937 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6938 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6939 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6940 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6941 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6942 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6943 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6944 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6945 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6946 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6947 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6948 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6949 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6950 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6951 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6952 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6953 | { |
| 6954 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6955 | /* .name = "Capture Source", */ |
| 6956 | .name = "Input Source", |
| 6957 | .count = 2, |
| 6958 | .info = alc883_mux_enum_info, |
| 6959 | .get = alc883_mux_enum_get, |
| 6960 | .put = alc883_mux_enum_put, |
| 6961 | }, |
| 6962 | { } /* end */ |
| 6963 | }; |
| 6964 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 6965 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 6966 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6967 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6968 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6969 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6970 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6971 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6972 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6973 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6974 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6975 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6976 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6977 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6978 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6979 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6980 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6981 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6982 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6983 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6984 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6985 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6986 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6987 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6988 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6989 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6990 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6991 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6992 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6993 | { |
| 6994 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6995 | /* .name = "Capture Source", */ |
| 6996 | .name = "Input Source", |
| 6997 | .count = 2, |
| 6998 | .info = alc883_mux_enum_info, |
| 6999 | .get = alc883_mux_enum_get, |
| 7000 | .put = alc883_mux_enum_put, |
| 7001 | }, |
| 7002 | { } /* end */ |
| 7003 | }; |
| 7004 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7005 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7006 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7007 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7008 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7009 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7010 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7012 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 7013 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7014 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7015 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7016 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7017 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7018 | { |
| 7019 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7020 | /* .name = "Capture Source", */ |
| 7021 | .name = "Input Source", |
| 7022 | .count = 2, |
| 7023 | .info = alc883_mux_enum_info, |
| 7024 | .get = alc883_mux_enum_get, |
| 7025 | .put = alc883_mux_enum_put, |
| 7026 | }, |
| 7027 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7028 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7029 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7030 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 7031 | { |
| 7032 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7033 | .name = "Channel Mode", |
| 7034 | .info = alc_ch_mode_info, |
| 7035 | .get = alc_ch_mode_get, |
| 7036 | .put = alc_ch_mode_put, |
| 7037 | }, |
| 7038 | { } /* end */ |
| 7039 | }; |
| 7040 | |
| 7041 | static struct hda_verb alc883_init_verbs[] = { |
| 7042 | /* ADC1: mute amp left and right */ |
| 7043 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7044 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7045 | /* ADC2: mute amp left and right */ |
| 7046 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7047 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7048 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 7049 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7050 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7051 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7052 | /* Rear mixer */ |
| 7053 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7054 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7055 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7056 | /* CLFE mixer */ |
| 7057 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7058 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7059 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7060 | /* Side mixer */ |
| 7061 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7062 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7063 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7064 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7065 | /* mute analog input loopbacks */ |
| 7066 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7067 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7068 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7069 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7070 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7071 | |
| 7072 | /* Front Pin: output 0 (0x0c) */ |
| 7073 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7074 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7075 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7076 | /* Rear Pin: output 1 (0x0d) */ |
| 7077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7078 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7079 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 7080 | /* CLFE Pin: output 2 (0x0e) */ |
| 7081 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7082 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7083 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7084 | /* Side Pin: output 3 (0x0f) */ |
| 7085 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7086 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7087 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 7088 | /* Mic (rear) pin: input vref at 80% */ |
| 7089 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7090 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7091 | /* Front Mic pin: input vref at 80% */ |
| 7092 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 7093 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7094 | /* Line In pin: input */ |
| 7095 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7096 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 7097 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 7098 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7099 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7100 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7101 | /* CD pin widget for input */ |
| 7102 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 7103 | |
| 7104 | /* FIXME: use matrix-type input source selection */ |
| 7105 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7106 | /* Input mixer2 */ |
| 7107 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7108 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7109 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7110 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7111 | /* Input mixer3 */ |
| 7112 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7113 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7114 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 7115 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7116 | { } |
| 7117 | }; |
| 7118 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7119 | /* toggle speaker-output according to the hp-jack state */ |
| 7120 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 7121 | { |
| 7122 | unsigned int present; |
| 7123 | |
| 7124 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 7125 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7126 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7127 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7128 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7129 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7130 | } |
| 7131 | |
| 7132 | /* auto-toggle front mic */ |
| 7133 | /* |
| 7134 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7135 | { |
| 7136 | unsigned int present; |
| 7137 | unsigned char bits; |
| 7138 | |
| 7139 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7140 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7141 | bits = present ? HDA_AMP_MUTE : 0; |
| 7142 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7143 | } |
| 7144 | */ |
| 7145 | |
| 7146 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7147 | { |
| 7148 | alc883_mitac_hp_automute(codec); |
| 7149 | /* alc883_mitac_mic_automute(codec); */ |
| 7150 | } |
| 7151 | |
| 7152 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7153 | unsigned int res) |
| 7154 | { |
| 7155 | switch (res >> 26) { |
| 7156 | case ALC880_HP_EVENT: |
| 7157 | alc883_mitac_hp_automute(codec); |
| 7158 | break; |
| 7159 | case ALC880_MIC_EVENT: |
| 7160 | /* alc883_mitac_mic_automute(codec); */ |
| 7161 | break; |
| 7162 | } |
| 7163 | } |
| 7164 | |
| 7165 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7166 | /* HP */ |
| 7167 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7168 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7169 | /* Subwoofer */ |
| 7170 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7171 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7172 | |
| 7173 | /* enable unsolicited event */ |
| 7174 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7175 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7176 | |
| 7177 | { } /* end */ |
| 7178 | }; |
| 7179 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7180 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7182 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7183 | |
| 7184 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7185 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7186 | |
| 7187 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7188 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7189 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7190 | |
| 7191 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7192 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7193 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7194 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7195 | |
| 7196 | { } /* end */ |
| 7197 | }; |
| 7198 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7199 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7200 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7201 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7202 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7203 | { } /* end */ |
| 7204 | }; |
| 7205 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7206 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7207 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7208 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7209 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7210 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7211 | { } /* end */ |
| 7212 | }; |
| 7213 | |
| 7214 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7215 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7216 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7217 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7218 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7219 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7220 | { } /* end */ |
| 7221 | }; |
| 7222 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7223 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7226 | |
| 7227 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7228 | |
| 7229 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7230 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7231 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7232 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7233 | { } /* end */ |
| 7234 | }; |
| 7235 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7236 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7237 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7238 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7239 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7240 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7241 | { } |
| 7242 | }; |
| 7243 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7244 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7245 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7246 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7247 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7248 | { } |
| 7249 | }; |
| 7250 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7251 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7252 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7253 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ |
| 7254 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ |
| 7255 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7256 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7257 | { } |
| 7258 | }; |
| 7259 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7260 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7261 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7262 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7263 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7264 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7265 | { } |
| 7266 | }; |
| 7267 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7268 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7269 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7270 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7271 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7272 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7273 | { } |
| 7274 | }; |
| 7275 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7276 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7277 | { 2, alc888_3st_hp_2ch_init }, |
| 7278 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7279 | }; |
| 7280 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7281 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7282 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7283 | { |
| 7284 | unsigned int present; |
| 7285 | |
| 7286 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7287 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7288 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7289 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7290 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7291 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7292 | } |
| 7293 | |
| 7294 | /* toggle RCA according to the front-jack state */ |
| 7295 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7296 | { |
| 7297 | unsigned int present; |
| 7298 | |
| 7299 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7300 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7301 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7302 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7303 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7304 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7305 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7306 | unsigned int res) |
| 7307 | { |
| 7308 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7309 | alc888_lenovo_ms7195_front_automute(codec); |
| 7310 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7311 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7312 | } |
| 7313 | |
| 7314 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7315 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7316 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7317 | |
| 7318 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7319 | |
| 7320 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7321 | { } /* end */ |
| 7322 | }; |
| 7323 | |
| 7324 | /* toggle speaker-output according to the hp-jack state */ |
| 7325 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7326 | { |
| 7327 | unsigned int present; |
| 7328 | |
| 7329 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7330 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7331 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7332 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7333 | } |
| 7334 | |
| 7335 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7336 | unsigned int res) |
| 7337 | { |
| 7338 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7339 | alc883_medion_md2_automute(codec); |
| 7340 | } |
| 7341 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7342 | /* toggle speaker-output according to the hp-jack state */ |
| 7343 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7344 | { |
| 7345 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7346 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7347 | |
| 7348 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7349 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7350 | bits = present ? HDA_AMP_MUTE : 0; |
| 7351 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7352 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7353 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7354 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7355 | } |
| 7356 | |
| 7357 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7358 | { |
| 7359 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7360 | alc883_tagra_automute(codec); |
| 7361 | } |
| 7362 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7363 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7364 | { |
| 7365 | unsigned int present; |
| 7366 | unsigned char bits; |
| 7367 | |
| 7368 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7369 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7370 | bits = present ? 0x80 : 0; |
| 7371 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7372 | 0x80, bits); |
| 7373 | } |
| 7374 | |
| 7375 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7376 | unsigned int res) |
| 7377 | { |
| 7378 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7379 | alc883_haier_w66_automute(codec); |
| 7380 | } |
| 7381 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7382 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7383 | { |
| 7384 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7385 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7386 | |
| 7387 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7388 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7389 | bits = present ? HDA_AMP_MUTE : 0; |
| 7390 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7391 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7392 | } |
| 7393 | |
| 7394 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7395 | { |
| 7396 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7397 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7398 | |
| 7399 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7400 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7401 | bits = present ? HDA_AMP_MUTE : 0; |
| 7402 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7403 | HDA_AMP_MUTE, bits); |
| 7404 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7405 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7406 | } |
| 7407 | |
| 7408 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7409 | unsigned int res) |
| 7410 | { |
| 7411 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7412 | alc883_lenovo_101e_all_automute(codec); |
| 7413 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7414 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7415 | } |
| 7416 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7417 | /* toggle speaker-output according to the hp-jack state */ |
| 7418 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7419 | { |
| 7420 | unsigned int present; |
| 7421 | |
| 7422 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7423 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7424 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7425 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7426 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7427 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7428 | } |
| 7429 | |
| 7430 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7431 | unsigned int res) |
| 7432 | { |
| 7433 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7434 | alc883_acer_aspire_automute(codec); |
| 7435 | } |
| 7436 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7437 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7438 | /* HP Pin: output 0 (0x0c) */ |
| 7439 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7440 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7441 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7442 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7443 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7444 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7445 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7446 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7447 | /* eanable EAPD on medion laptop */ |
| 7448 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7449 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7450 | /* enable unsolicited event */ |
| 7451 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7452 | { } |
| 7453 | }; |
| 7454 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7455 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7456 | { |
| 7457 | unsigned int present; |
| 7458 | |
| 7459 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7460 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7461 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7462 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7463 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7464 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7465 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7466 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7467 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7468 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7469 | } |
| 7470 | |
| 7471 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7472 | unsigned int res) |
| 7473 | { |
| 7474 | switch (res >> 26) { |
| 7475 | case ALC880_HP_EVENT: |
| 7476 | printk("hp_event\n"); |
| 7477 | alc888_6st_dell_front_automute(codec); |
| 7478 | break; |
| 7479 | } |
| 7480 | } |
| 7481 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7482 | /* |
| 7483 | * generic initialization of ADC, input mixers and output mixers |
| 7484 | */ |
| 7485 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7486 | /* |
| 7487 | * Unmute ADC0-2 and set the default input to mic-in |
| 7488 | */ |
| 7489 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7490 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7491 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7492 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7493 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7494 | /* 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] | 7495 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7496 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7497 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7498 | */ |
| 7499 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7500 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7501 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7502 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7503 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7504 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7505 | |
| 7506 | /* |
| 7507 | * Set up output mixers (0x0c - 0x0f) |
| 7508 | */ |
| 7509 | /* set vol=0 to output mixers */ |
| 7510 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7511 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7512 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7513 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7514 | /* set up input amps for analog loopback */ |
| 7515 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7516 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7517 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7518 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7519 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7520 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7522 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7524 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7525 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7526 | |
| 7527 | /* FIXME: use matrix-type input source selection */ |
| 7528 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7529 | /* Input mixer1 */ |
| 7530 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7531 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7532 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7533 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7534 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7535 | /* Input mixer2 */ |
| 7536 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7537 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7538 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7539 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7540 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7541 | |
| 7542 | { } |
| 7543 | }; |
| 7544 | |
| 7545 | /* capture mixer elements */ |
| 7546 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7547 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7548 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7549 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7550 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7551 | { |
| 7552 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7553 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7554 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7555 | */ |
| 7556 | /* .name = "Capture Source", */ |
| 7557 | .name = "Input Source", |
| 7558 | .count = 2, |
| 7559 | .info = alc882_mux_enum_info, |
| 7560 | .get = alc882_mux_enum_get, |
| 7561 | .put = alc882_mux_enum_put, |
| 7562 | }, |
| 7563 | { } /* end */ |
| 7564 | }; |
| 7565 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7566 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7567 | #define alc883_loopbacks alc880_loopbacks |
| 7568 | #endif |
| 7569 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7570 | /* pcm configuration: identiacal with ALC880 */ |
| 7571 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7572 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7573 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7574 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7575 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7576 | |
| 7577 | /* |
| 7578 | * configuration and preset |
| 7579 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7580 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7581 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7582 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7583 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7584 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7585 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7586 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7587 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7588 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7589 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7590 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7591 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7592 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7593 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7594 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7595 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7596 | [ALC888_6ST_HP] = "6stack-hp", |
| 7597 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7598 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7599 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7600 | [ALC883_AUTO] = "auto", |
| 7601 | }; |
| 7602 | |
| 7603 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7604 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7605 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7606 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7607 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7608 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7609 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7610 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7611 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7612 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7613 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7614 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7615 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7616 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7617 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7618 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7619 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7620 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7621 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7622 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7623 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7624 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7625 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7626 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7627 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7628 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7629 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7630 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7631 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7632 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7633 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7634 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7635 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7636 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7637 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7638 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7639 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7640 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7641 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7642 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7643 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7644 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7645 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7646 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7647 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Andrew Paprocki | 0b167bf | 2008-02-03 10:15:44 +0100 | [diff] [blame] | 7648 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7649 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7650 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7651 | {} |
| 7652 | }; |
| 7653 | |
| 7654 | static struct alc_config_preset alc883_presets[] = { |
| 7655 | [ALC883_3ST_2ch_DIG] = { |
| 7656 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7657 | .init_verbs = { alc883_init_verbs }, |
| 7658 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7659 | .dac_nids = alc883_dac_nids, |
| 7660 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7661 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7662 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7663 | .channel_mode = alc883_3ST_2ch_modes, |
| 7664 | .input_mux = &alc883_capture_source, |
| 7665 | }, |
| 7666 | [ALC883_3ST_6ch_DIG] = { |
| 7667 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7668 | .init_verbs = { alc883_init_verbs }, |
| 7669 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7670 | .dac_nids = alc883_dac_nids, |
| 7671 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7672 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7673 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7674 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7675 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7676 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7677 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7678 | [ALC883_3ST_6ch] = { |
| 7679 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7680 | .init_verbs = { alc883_init_verbs }, |
| 7681 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7682 | .dac_nids = alc883_dac_nids, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7683 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7684 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7685 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7686 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7687 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7688 | [ALC883_6ST_DIG] = { |
| 7689 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7690 | .init_verbs = { alc883_init_verbs }, |
| 7691 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7692 | .dac_nids = alc883_dac_nids, |
| 7693 | .dig_out_nid = ALC883_DIGOUT_NID, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7694 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7695 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7696 | .channel_mode = alc883_sixstack_modes, |
| 7697 | .input_mux = &alc883_capture_source, |
| 7698 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7699 | [ALC883_TARGA_DIG] = { |
| 7700 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7701 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7702 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7703 | .dac_nids = alc883_dac_nids, |
| 7704 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7705 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7706 | .channel_mode = alc883_3ST_6ch_modes, |
| 7707 | .need_dac_fix = 1, |
| 7708 | .input_mux = &alc883_capture_source, |
| 7709 | .unsol_event = alc883_tagra_unsol_event, |
| 7710 | .init_hook = alc883_tagra_automute, |
| 7711 | }, |
| 7712 | [ALC883_TARGA_2ch_DIG] = { |
| 7713 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7714 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7715 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7716 | .dac_nids = alc883_dac_nids, |
| 7717 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7718 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7719 | .channel_mode = alc883_3ST_2ch_modes, |
| 7720 | .input_mux = &alc883_capture_source, |
| 7721 | .unsol_event = alc883_tagra_unsol_event, |
| 7722 | .init_hook = alc883_tagra_automute, |
| 7723 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7724 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7725 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7726 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7727 | * and the headphone jack. Turn this on and rely on the |
| 7728 | * standard mute methods whenever the user wants to turn |
| 7729 | * these outputs off. |
| 7730 | */ |
| 7731 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7732 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7733 | .dac_nids = alc883_dac_nids, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7734 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7735 | .channel_mode = alc883_3ST_2ch_modes, |
| 7736 | .input_mux = &alc883_capture_source, |
| 7737 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7738 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7739 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7740 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7741 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7742 | .dac_nids = alc883_dac_nids, |
| 7743 | .dig_out_nid = ALC883_DIGOUT_NID, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7744 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7745 | .channel_mode = alc883_3ST_2ch_modes, |
| 7746 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7747 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7748 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7749 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7750 | [ALC883_MEDION] = { |
| 7751 | .mixers = { alc883_fivestack_mixer, |
| 7752 | alc883_chmode_mixer }, |
| 7753 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7754 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7755 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7756 | .dac_nids = alc883_dac_nids, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7757 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7758 | .channel_mode = alc883_sixstack_modes, |
| 7759 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7760 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7761 | [ALC883_MEDION_MD2] = { |
| 7762 | .mixers = { alc883_medion_md2_mixer}, |
| 7763 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7764 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7765 | .dac_nids = alc883_dac_nids, |
| 7766 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7767 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7768 | .channel_mode = alc883_3ST_2ch_modes, |
| 7769 | .input_mux = &alc883_capture_source, |
| 7770 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7771 | .init_hook = alc883_medion_md2_automute, |
| 7772 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7773 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7774 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7775 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7776 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7777 | .dac_nids = alc883_dac_nids, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7778 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7779 | .channel_mode = alc883_3ST_2ch_modes, |
| 7780 | .input_mux = &alc883_capture_source, |
| 7781 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7782 | [ALC883_LENOVO_101E_2ch] = { |
| 7783 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7784 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7785 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7786 | .dac_nids = alc883_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7787 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7788 | .channel_mode = alc883_3ST_2ch_modes, |
| 7789 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7790 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7791 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7792 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7793 | [ALC883_LENOVO_NB0763] = { |
| 7794 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7795 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7796 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7797 | .dac_nids = alc883_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7798 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7799 | .channel_mode = alc883_3ST_2ch_modes, |
| 7800 | .need_dac_fix = 1, |
| 7801 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7802 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7803 | .init_hook = alc883_medion_md2_automute, |
| 7804 | }, |
| 7805 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7806 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7807 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7808 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7809 | .dac_nids = alc883_dac_nids, |
| 7810 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7811 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7812 | .channel_mode = alc883_3ST_6ch_modes, |
| 7813 | .need_dac_fix = 1, |
| 7814 | .input_mux = &alc883_capture_source, |
| 7815 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7816 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7817 | }, |
| 7818 | [ALC883_HAIER_W66] = { |
| 7819 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7820 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7821 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7822 | .dac_nids = alc883_dac_nids, |
| 7823 | .dig_out_nid = ALC883_DIGOUT_NID, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7824 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7825 | .channel_mode = alc883_3ST_2ch_modes, |
| 7826 | .input_mux = &alc883_capture_source, |
| 7827 | .unsol_event = alc883_haier_w66_unsol_event, |
| 7828 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7829 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7830 | [ALC888_6ST_HP] = { |
| 7831 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7832 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7833 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7834 | .dac_nids = alc883_dac_nids, |
| 7835 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7836 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7837 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7838 | .channel_mode = alc883_sixstack_modes, |
| 7839 | .input_mux = &alc883_capture_source, |
| 7840 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7841 | [ALC888_3ST_HP] = { |
| 7842 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7843 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7844 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7845 | .dac_nids = alc883_dac_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7846 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7847 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7848 | .need_dac_fix = 1, |
| 7849 | .input_mux = &alc883_capture_source, |
| 7850 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7851 | [ALC888_6ST_DELL] = { |
| 7852 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7853 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7854 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7855 | .dac_nids = alc883_dac_nids, |
| 7856 | .dig_out_nid = ALC883_DIGOUT_NID, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7857 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7858 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7859 | .channel_mode = alc883_sixstack_modes, |
| 7860 | .input_mux = &alc883_capture_source, |
| 7861 | .unsol_event = alc888_6st_dell_unsol_event, |
| 7862 | .init_hook = alc888_6st_dell_front_automute, |
| 7863 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7864 | [ALC883_MITAC] = { |
| 7865 | .mixers = { alc883_mitac_mixer }, |
| 7866 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7867 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7868 | .dac_nids = alc883_dac_nids, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7869 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7870 | .channel_mode = alc883_3ST_2ch_modes, |
| 7871 | .input_mux = &alc883_capture_source, |
| 7872 | .unsol_event = alc883_mitac_unsol_event, |
| 7873 | .init_hook = alc883_mitac_automute, |
| 7874 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7875 | }; |
| 7876 | |
| 7877 | |
| 7878 | /* |
| 7879 | * BIOS auto configuration |
| 7880 | */ |
| 7881 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7882 | hda_nid_t nid, int pin_type, |
| 7883 | int dac_idx) |
| 7884 | { |
| 7885 | /* set as output */ |
| 7886 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7887 | int idx; |
| 7888 | |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7889 | alc_set_pin_output(codec, nid, pin_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7890 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7891 | idx = 4; |
| 7892 | else |
| 7893 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7894 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7895 | |
| 7896 | } |
| 7897 | |
| 7898 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7899 | { |
| 7900 | struct alc_spec *spec = codec->spec; |
| 7901 | int i; |
| 7902 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7903 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7904 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7905 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7906 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7907 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7908 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7909 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7910 | } |
| 7911 | } |
| 7912 | |
| 7913 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7914 | { |
| 7915 | struct alc_spec *spec = codec->spec; |
| 7916 | hda_nid_t pin; |
| 7917 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7918 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7919 | if (pin) /* connect to front */ |
| 7920 | /* use dac 0 */ |
| 7921 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7922 | pin = spec->autocfg.speaker_pins[0]; |
| 7923 | if (pin) |
| 7924 | alc883_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7925 | } |
| 7926 | |
| 7927 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7928 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7929 | |
| 7930 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7931 | { |
| 7932 | struct alc_spec *spec = codec->spec; |
| 7933 | int i; |
| 7934 | |
| 7935 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7936 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7937 | if (alc883_is_input_pin(nid)) { |
| 7938 | snd_hda_codec_write(codec, nid, 0, |
| 7939 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7940 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7941 | PIN_VREF80 : PIN_IN)); |
| 7942 | if (nid != ALC883_PIN_CD_NID) |
| 7943 | snd_hda_codec_write(codec, nid, 0, |
| 7944 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7945 | AMP_OUT_MUTE); |
| 7946 | } |
| 7947 | } |
| 7948 | } |
| 7949 | |
| 7950 | /* almost identical with ALC880 parser... */ |
| 7951 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7952 | { |
| 7953 | struct alc_spec *spec = codec->spec; |
| 7954 | int err = alc880_parse_auto_config(codec); |
| 7955 | |
| 7956 | if (err < 0) |
| 7957 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7958 | else if (!err) |
| 7959 | return 0; /* no config found */ |
| 7960 | |
| 7961 | err = alc_auto_add_mic_boost(codec); |
| 7962 | if (err < 0) |
| 7963 | return err; |
| 7964 | |
| 7965 | /* hack - override the init verbs */ |
| 7966 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7967 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7968 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7969 | |
| 7970 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7971 | } |
| 7972 | |
| 7973 | /* additional initialization for auto-configuration model */ |
| 7974 | static void alc883_auto_init(struct hda_codec *codec) |
| 7975 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7976 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7977 | alc883_auto_init_multi_out(codec); |
| 7978 | alc883_auto_init_hp_out(codec); |
| 7979 | alc883_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 7980 | if (spec->unsol_event) |
| 7981 | alc_sku_automute(codec); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7982 | } |
| 7983 | |
| 7984 | static int patch_alc883(struct hda_codec *codec) |
| 7985 | { |
| 7986 | struct alc_spec *spec; |
| 7987 | int err, board_config; |
| 7988 | |
| 7989 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7990 | if (spec == NULL) |
| 7991 | return -ENOMEM; |
| 7992 | |
| 7993 | codec->spec = spec; |
| 7994 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7995 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7996 | alc883_models, |
| 7997 | alc883_cfg_tbl); |
| 7998 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7999 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 8000 | "trying auto-probe from BIOS...\n"); |
| 8001 | board_config = ALC883_AUTO; |
| 8002 | } |
| 8003 | |
| 8004 | if (board_config == ALC883_AUTO) { |
| 8005 | /* automatic parse from the BIOS config */ |
| 8006 | err = alc883_parse_auto_config(codec); |
| 8007 | if (err < 0) { |
| 8008 | alc_free(codec); |
| 8009 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8010 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8011 | printk(KERN_INFO |
| 8012 | "hda_codec: Cannot set up configuration " |
| 8013 | "from BIOS. Using base mode...\n"); |
| 8014 | board_config = ALC883_3ST_2ch_DIG; |
| 8015 | } |
| 8016 | } |
| 8017 | |
| 8018 | if (board_config != ALC883_AUTO) |
| 8019 | setup_preset(spec, &alc883_presets[board_config]); |
| 8020 | |
| 8021 | spec->stream_name_analog = "ALC883 Analog"; |
| 8022 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 8023 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 8024 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8025 | |
| 8026 | spec->stream_name_digital = "ALC883 Digital"; |
| 8027 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 8028 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 8029 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 8030 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 8031 | spec->adc_nids = alc883_adc_nids; |
| 8032 | spec->capsrc_nids = alc883_capsrc_nids; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8033 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 8034 | spec->vmaster_nid = 0x0c; |
| 8035 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8036 | codec->patch_ops = alc_patch_ops; |
| 8037 | if (board_config == ALC883_AUTO) |
| 8038 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8039 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8040 | if (!spec->loopback.amplist) |
| 8041 | spec->loopback.amplist = alc883_loopbacks; |
| 8042 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8043 | |
| 8044 | return 0; |
| 8045 | } |
| 8046 | |
| 8047 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8048 | * ALC262 support |
| 8049 | */ |
| 8050 | |
| 8051 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 8052 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 8053 | |
| 8054 | #define alc262_dac_nids alc260_dac_nids |
| 8055 | #define alc262_adc_nids alc882_adc_nids |
| 8056 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 8057 | #define alc262_capsrc_nids alc882_capsrc_nids |
| 8058 | #define alc262_capsrc_nids_alt alc882_capsrc_nids_alt |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8059 | |
| 8060 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 8061 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8062 | |
| 8063 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 8064 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8065 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8066 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8067 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8068 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8069 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8070 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8071 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8072 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8073 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8074 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8075 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8076 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8077 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8078 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 8079 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8080 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8081 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8082 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8083 | }; |
| 8084 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8085 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 8086 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8087 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8088 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8089 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8090 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8091 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8092 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8093 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8094 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8095 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8096 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8097 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8098 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 8099 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8100 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8101 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8102 | { } /* end */ |
| 8103 | }; |
| 8104 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8105 | /* update HP, line and mono-out pins according to the master switch */ |
| 8106 | static void alc262_hp_master_update(struct hda_codec *codec) |
| 8107 | { |
| 8108 | struct alc_spec *spec = codec->spec; |
| 8109 | int val = spec->master_sw; |
| 8110 | |
| 8111 | /* HP & line-out */ |
| 8112 | snd_hda_codec_write_cache(codec, 0x1b, 0, |
| 8113 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8114 | val ? PIN_HP : 0); |
| 8115 | snd_hda_codec_write_cache(codec, 0x15, 0, |
| 8116 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8117 | val ? PIN_HP : 0); |
| 8118 | /* mono (speaker) depending on the HP jack sense */ |
| 8119 | val = val && !spec->jack_present; |
| 8120 | snd_hda_codec_write_cache(codec, 0x16, 0, |
| 8121 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 8122 | val ? PIN_OUT : 0); |
| 8123 | } |
| 8124 | |
| 8125 | static void alc262_hp_bpc_automute(struct hda_codec *codec) |
| 8126 | { |
| 8127 | struct alc_spec *spec = codec->spec; |
| 8128 | unsigned int presence; |
| 8129 | presence = snd_hda_codec_read(codec, 0x1b, 0, |
| 8130 | AC_VERB_GET_PIN_SENSE, 0); |
| 8131 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8132 | alc262_hp_master_update(codec); |
| 8133 | } |
| 8134 | |
| 8135 | static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 8136 | { |
| 8137 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8138 | return; |
| 8139 | alc262_hp_bpc_automute(codec); |
| 8140 | } |
| 8141 | |
| 8142 | static void alc262_hp_wildwest_automute(struct hda_codec *codec) |
| 8143 | { |
| 8144 | struct alc_spec *spec = codec->spec; |
| 8145 | unsigned int presence; |
| 8146 | presence = snd_hda_codec_read(codec, 0x15, 0, |
| 8147 | AC_VERB_GET_PIN_SENSE, 0); |
| 8148 | spec->jack_present = !!(presence & AC_PINSENSE_PRESENCE); |
| 8149 | alc262_hp_master_update(codec); |
| 8150 | } |
| 8151 | |
| 8152 | static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec, |
| 8153 | unsigned int res) |
| 8154 | { |
| 8155 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8156 | return; |
| 8157 | alc262_hp_wildwest_automute(codec); |
| 8158 | } |
| 8159 | |
| 8160 | static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, |
| 8161 | struct snd_ctl_elem_value *ucontrol) |
| 8162 | { |
| 8163 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8164 | struct alc_spec *spec = codec->spec; |
| 8165 | *ucontrol->value.integer.value = spec->master_sw; |
| 8166 | return 0; |
| 8167 | } |
| 8168 | |
| 8169 | static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8170 | struct snd_ctl_elem_value *ucontrol) |
| 8171 | { |
| 8172 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8173 | struct alc_spec *spec = codec->spec; |
| 8174 | int val = !!*ucontrol->value.integer.value; |
| 8175 | |
| 8176 | if (val == spec->master_sw) |
| 8177 | return 0; |
| 8178 | spec->master_sw = val; |
| 8179 | alc262_hp_master_update(codec); |
| 8180 | return 1; |
| 8181 | } |
| 8182 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8183 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8184 | { |
| 8185 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8186 | .name = "Master Playback Switch", |
| 8187 | .info = snd_ctl_boolean_mono_info, |
| 8188 | .get = alc262_hp_master_sw_get, |
| 8189 | .put = alc262_hp_master_sw_put, |
| 8190 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8191 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8192 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8193 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8194 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8195 | HDA_OUTPUT), |
| 8196 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8197 | HDA_OUTPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8198 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8199 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8200 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8201 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8202 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8203 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8204 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8205 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8206 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8207 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8208 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8209 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8210 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8211 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8212 | { } /* end */ |
| 8213 | }; |
| 8214 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8215 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8216 | { |
| 8217 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8218 | .name = "Master Playback Switch", |
| 8219 | .info = snd_ctl_boolean_mono_info, |
| 8220 | .get = alc262_hp_master_sw_get, |
| 8221 | .put = alc262_hp_master_sw_put, |
| 8222 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8223 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8224 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8225 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8227 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 2, 0x0, |
| 8228 | HDA_OUTPUT), |
| 8229 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 2, 0x0, |
| 8230 | HDA_OUTPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8231 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8232 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8233 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8234 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8235 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8236 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8237 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8238 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8239 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8240 | { } /* end */ |
| 8241 | }; |
| 8242 | |
| 8243 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8244 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8245 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8246 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8247 | { } /* end */ |
| 8248 | }; |
| 8249 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8250 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8251 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8252 | { |
| 8253 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8254 | |
| 8255 | if (force || !spec->sense_updated) { |
| 8256 | unsigned int present; |
| 8257 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8258 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8259 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8260 | spec->sense_updated = 1; |
| 8261 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8262 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8263 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8264 | } |
| 8265 | |
| 8266 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8267 | unsigned int res) |
| 8268 | { |
| 8269 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8270 | return; |
| 8271 | alc262_hp_t5735_automute(codec, 1); |
| 8272 | } |
| 8273 | |
| 8274 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8275 | { |
| 8276 | alc262_hp_t5735_automute(codec, 1); |
| 8277 | } |
| 8278 | |
| 8279 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8280 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8281 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8282 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8283 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8284 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8285 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8286 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8287 | { } /* end */ |
| 8288 | }; |
| 8289 | |
| 8290 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8291 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8292 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8293 | |
| 8294 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8295 | { } |
| 8296 | }; |
| 8297 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8298 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame] | 8299 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8300 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8301 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8302 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8303 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8304 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8305 | { } /* end */ |
| 8306 | }; |
| 8307 | |
| 8308 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8309 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8310 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8311 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8312 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8313 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8314 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8315 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8316 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8317 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8318 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8319 | {} |
| 8320 | }; |
| 8321 | |
| 8322 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8323 | .num_items = 1, |
| 8324 | .items = { |
| 8325 | { "Line", 0x1 }, |
| 8326 | }, |
| 8327 | }; |
| 8328 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8329 | /* bind hp and internal speaker mute (with plug check) */ |
| 8330 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8331 | struct snd_ctl_elem_value *ucontrol) |
| 8332 | { |
| 8333 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8334 | long *valp = ucontrol->value.integer.value; |
| 8335 | int change; |
| 8336 | |
| 8337 | /* change hp mute */ |
| 8338 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8339 | HDA_AMP_MUTE, |
| 8340 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8341 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8342 | HDA_AMP_MUTE, |
| 8343 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8344 | if (change) { |
| 8345 | /* change speaker according to HP jack state */ |
| 8346 | struct alc_spec *spec = codec->spec; |
| 8347 | unsigned int mute; |
| 8348 | if (spec->jack_present) |
| 8349 | mute = HDA_AMP_MUTE; |
| 8350 | else |
| 8351 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8352 | HDA_OUTPUT, 0); |
| 8353 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8354 | HDA_AMP_MUTE, mute); |
| 8355 | } |
| 8356 | return change; |
| 8357 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8358 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8359 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8360 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8361 | { |
| 8362 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8363 | .name = "Master Playback Switch", |
| 8364 | .info = snd_hda_mixer_amp_switch_info, |
| 8365 | .get = snd_hda_mixer_amp_switch_get, |
| 8366 | .put = alc262_sony_master_sw_put, |
| 8367 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8368 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8369 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8371 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8372 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8373 | { } /* end */ |
| 8374 | }; |
| 8375 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8376 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8377 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8378 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8379 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8380 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8381 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8382 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8383 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8384 | { } /* end */ |
| 8385 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8386 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8387 | #define alc262_capture_mixer alc882_capture_mixer |
| 8388 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8389 | |
| 8390 | /* |
| 8391 | * generic initialization of ADC, input mixers and output mixers |
| 8392 | */ |
| 8393 | static struct hda_verb alc262_init_verbs[] = { |
| 8394 | /* |
| 8395 | * Unmute ADC0-2 and set the default input to mic-in |
| 8396 | */ |
| 8397 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8398 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8399 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8400 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8401 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8402 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8403 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8404 | /* 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] | 8405 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8406 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8407 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8408 | */ |
| 8409 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8410 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8411 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8412 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8413 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8414 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8415 | |
| 8416 | /* |
| 8417 | * Set up output mixers (0x0c - 0x0e) |
| 8418 | */ |
| 8419 | /* set vol=0 to output mixers */ |
| 8420 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8421 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8422 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8423 | /* set up input amps for analog loopback */ |
| 8424 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8425 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8426 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8427 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8429 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8430 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8431 | |
| 8432 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8433 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8434 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8435 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8436 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8437 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8438 | |
| 8439 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8440 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8441 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8442 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8443 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8444 | |
| 8445 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8446 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8447 | |
| 8448 | /* FIXME: use matrix-type input source selection */ |
| 8449 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8450 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8451 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8452 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8453 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8454 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8455 | /* Input mixer2 */ |
| 8456 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8457 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8458 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8459 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8460 | /* Input mixer3 */ |
| 8461 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8462 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8463 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8464 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8465 | |
| 8466 | { } |
| 8467 | }; |
| 8468 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8469 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8470 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8471 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8472 | {} |
| 8473 | }; |
| 8474 | |
| 8475 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8476 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8477 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8478 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8479 | |
| 8480 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8481 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8482 | {} |
| 8483 | }; |
| 8484 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8485 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8486 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8487 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8488 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8489 | |
| 8490 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8491 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8492 | }; |
| 8493 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8494 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8495 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8496 | { |
| 8497 | struct alc_spec *spec = codec->spec; |
| 8498 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8499 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8500 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8501 | /* need to execute and sync at first */ |
| 8502 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8503 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8504 | AC_VERB_GET_PIN_SENSE, 0); |
| 8505 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8506 | if (spec->jack_present) { |
| 8507 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8508 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8509 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8510 | } else { |
| 8511 | /* unmute internal speaker if necessary */ |
| 8512 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8513 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8514 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8515 | } |
| 8516 | } |
| 8517 | |
| 8518 | /* unsolicited event for HP jack sensing */ |
| 8519 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8520 | unsigned int res) |
| 8521 | { |
| 8522 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8523 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8524 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8525 | } |
| 8526 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8527 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8528 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8529 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8530 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8531 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8532 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8533 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8534 | AC_VERB_GET_PIN_SENSE, 0); |
| 8535 | present = (present & 0x80000000) != 0; |
| 8536 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8537 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8538 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8539 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8540 | } else { |
| 8541 | /* unmute internal speaker if necessary */ |
| 8542 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8543 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8544 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8545 | } |
| 8546 | } |
| 8547 | |
| 8548 | /* unsolicited event for HP jack sensing */ |
| 8549 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8550 | unsigned int res) |
| 8551 | { |
| 8552 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8553 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8554 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8555 | } |
| 8556 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8557 | /* |
| 8558 | * fujitsu model |
| 8559 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8560 | */ |
| 8561 | |
| 8562 | #define ALC_HP_EVENT 0x37 |
| 8563 | |
| 8564 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8565 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8566 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8567 | {} |
| 8568 | }; |
| 8569 | |
| 8570 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8571 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8572 | .items = { |
| 8573 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8574 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8575 | { "CD", 0x4 }, |
| 8576 | }, |
| 8577 | }; |
| 8578 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8579 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8580 | .num_items = 5, |
| 8581 | .items = { |
| 8582 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8583 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8584 | { "Line", 0x2 }, |
| 8585 | { "CD", 0x4 }, |
| 8586 | { "AUX IN", 0x6 }, |
| 8587 | }, |
| 8588 | }; |
| 8589 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8590 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8591 | .num_items = 4, |
| 8592 | .items = { |
| 8593 | { "Mic", 0x0 }, |
| 8594 | { "Front Mic", 0x2 }, |
| 8595 | { "Line", 0x1 }, |
| 8596 | { "CD", 0x4 }, |
| 8597 | }, |
| 8598 | }; |
| 8599 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8600 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8601 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8602 | { |
| 8603 | struct alc_spec *spec = codec->spec; |
| 8604 | unsigned int mute; |
| 8605 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8606 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8607 | unsigned int present; |
| 8608 | /* need to execute and sync at first */ |
| 8609 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8610 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8611 | AC_VERB_GET_PIN_SENSE, 0); |
| 8612 | spec->jack_present = (present & 0x80000000) != 0; |
| 8613 | spec->sense_updated = 1; |
| 8614 | } |
| 8615 | if (spec->jack_present) { |
| 8616 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8617 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8618 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8619 | } else { |
| 8620 | /* unmute internal speaker if necessary */ |
| 8621 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8622 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8623 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8624 | } |
| 8625 | } |
| 8626 | |
| 8627 | /* unsolicited event for HP jack sensing */ |
| 8628 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8629 | unsigned int res) |
| 8630 | { |
| 8631 | if ((res >> 26) != ALC_HP_EVENT) |
| 8632 | return; |
| 8633 | alc262_fujitsu_automute(codec, 1); |
| 8634 | } |
| 8635 | |
| 8636 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8637 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8638 | .ops = &snd_hda_bind_vol, |
| 8639 | .values = { |
| 8640 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8641 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8642 | 0 |
| 8643 | }, |
| 8644 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8645 | |
| 8646 | /* bind hp and internal speaker mute (with plug check) */ |
| 8647 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8648 | struct snd_ctl_elem_value *ucontrol) |
| 8649 | { |
| 8650 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8651 | long *valp = ucontrol->value.integer.value; |
| 8652 | int change; |
| 8653 | |
| 8654 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8655 | HDA_AMP_MUTE, |
| 8656 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8657 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8658 | HDA_AMP_MUTE, |
| 8659 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8660 | if (change) |
| 8661 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8662 | return change; |
| 8663 | } |
| 8664 | |
| 8665 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8666 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8667 | { |
| 8668 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8669 | .name = "Master Playback Switch", |
| 8670 | .info = snd_hda_mixer_amp_switch_info, |
| 8671 | .get = snd_hda_mixer_amp_switch_get, |
| 8672 | .put = alc262_fujitsu_master_sw_put, |
| 8673 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8674 | }, |
| 8675 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8676 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8677 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8678 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8679 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8680 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8681 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8682 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8683 | { } /* end */ |
| 8684 | }; |
| 8685 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8686 | /* additional init verbs for Benq laptops */ |
| 8687 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8688 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8689 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8690 | {} |
| 8691 | }; |
| 8692 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8693 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8694 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8695 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8696 | |
| 8697 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8698 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8699 | {} |
| 8700 | }; |
| 8701 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8702 | /* Samsung Q1 Ultra Vista model setup */ |
| 8703 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8704 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8705 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8706 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8709 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8710 | { } /* end */ |
| 8711 | }; |
| 8712 | |
| 8713 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8714 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8715 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8716 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8717 | /* Mic is on Node 0x19 */ |
| 8718 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8719 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8720 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8721 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8722 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8723 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8724 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8725 | {} |
| 8726 | }; |
| 8727 | |
| 8728 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8729 | .num_items = 1, |
| 8730 | .items = { |
| 8731 | { "Mic", 0x1 }, |
| 8732 | }, |
| 8733 | }; |
| 8734 | |
| 8735 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8736 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8737 | { |
| 8738 | struct alc_spec *spec = codec->spec; |
| 8739 | unsigned int mute; |
| 8740 | unsigned int present; |
| 8741 | |
| 8742 | /* need to execute and sync at first */ |
| 8743 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8744 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8745 | AC_VERB_GET_PIN_SENSE, 0); |
| 8746 | spec->jack_present = (present & 0x80000000) != 0; |
| 8747 | if (spec->jack_present) { |
| 8748 | /* mute internal speaker */ |
| 8749 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8750 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8751 | } else { |
| 8752 | /* unmute internal speaker if necessary */ |
| 8753 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8754 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8755 | HDA_AMP_MUTE, mute); |
| 8756 | } |
| 8757 | } |
| 8758 | |
| 8759 | /* unsolicited event for HP jack sensing */ |
| 8760 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8761 | unsigned int res) |
| 8762 | { |
| 8763 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8764 | return; |
| 8765 | alc262_ultra_automute(codec); |
| 8766 | } |
| 8767 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8768 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8769 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8770 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8771 | { |
| 8772 | hda_nid_t nid; |
| 8773 | int err; |
| 8774 | |
| 8775 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8776 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8777 | spec->multiout.dac_nids[0] = 2; |
| 8778 | |
| 8779 | nid = cfg->line_out_pins[0]; |
| 8780 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8781 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8782 | "Front Playback Volume", |
| 8783 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8784 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8785 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8786 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8787 | "Front Playback Switch", |
| 8788 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8789 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8790 | return err; |
| 8791 | } |
| 8792 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8793 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8794 | if (nid) { |
| 8795 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8796 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8797 | "Speaker Playback Volume", |
| 8798 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8799 | HDA_OUTPUT)); |
| 8800 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8801 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8802 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8803 | "Speaker Playback Switch", |
| 8804 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8805 | HDA_OUTPUT)); |
| 8806 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8807 | return err; |
| 8808 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8809 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8810 | "Speaker Playback Switch", |
| 8811 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8812 | HDA_OUTPUT)); |
| 8813 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8814 | return err; |
| 8815 | } |
| 8816 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8817 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8818 | if (nid) { |
| 8819 | /* spec->multiout.hp_nid = 2; */ |
| 8820 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8821 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8822 | "Headphone Playback Volume", |
| 8823 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8824 | HDA_OUTPUT)); |
| 8825 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8826 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8827 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8828 | "Headphone Playback Switch", |
| 8829 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8830 | HDA_OUTPUT)); |
| 8831 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8832 | return err; |
| 8833 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8834 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8835 | "Headphone Playback Switch", |
| 8836 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8837 | HDA_OUTPUT)); |
| 8838 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8839 | return err; |
| 8840 | } |
| 8841 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8842 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8843 | } |
| 8844 | |
| 8845 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8846 | #define alc262_auto_create_analog_input_ctls \ |
| 8847 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8848 | |
| 8849 | /* |
| 8850 | * generic initialization of ADC, input mixers and output mixers |
| 8851 | */ |
| 8852 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8853 | /* |
| 8854 | * Unmute ADC0-2 and set the default input to mic-in |
| 8855 | */ |
| 8856 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8857 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8858 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8859 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8860 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8861 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8862 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8863 | /* 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] | 8864 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8865 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8866 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8867 | */ |
| 8868 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8869 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8870 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8871 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8872 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8873 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8874 | |
| 8875 | /* |
| 8876 | * Set up output mixers (0x0c - 0x0f) |
| 8877 | */ |
| 8878 | /* set vol=0 to output mixers */ |
| 8879 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8880 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8881 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8882 | |
| 8883 | /* set up input amps for analog loopback */ |
| 8884 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8885 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8886 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8887 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8888 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8889 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8890 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8891 | |
| 8892 | /* FIXME: use matrix-type input source selection */ |
| 8893 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8894 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8895 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8896 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8897 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8898 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8899 | /* Input mixer2 */ |
| 8900 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8901 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8902 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8903 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8904 | /* Input mixer3 */ |
| 8905 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8906 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8907 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8908 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8909 | |
| 8910 | { } |
| 8911 | }; |
| 8912 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8913 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8914 | /* |
| 8915 | * Unmute ADC0-2 and set the default input to mic-in |
| 8916 | */ |
| 8917 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8918 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8920 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8921 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8922 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8923 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8924 | /* 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] | 8925 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8926 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8927 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8928 | */ |
| 8929 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8930 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8936 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8937 | |
| 8938 | /* |
| 8939 | * Set up output mixers (0x0c - 0x0e) |
| 8940 | */ |
| 8941 | /* set vol=0 to output mixers */ |
| 8942 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8943 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8944 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8945 | |
| 8946 | /* set up input amps for analog loopback */ |
| 8947 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8948 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8949 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8950 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8951 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8952 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8953 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8954 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8955 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8956 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8957 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8958 | |
| 8959 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8960 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8961 | |
| 8962 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8963 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8964 | |
| 8965 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8966 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8967 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8968 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8969 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8970 | |
| 8971 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8972 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8973 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8974 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8975 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8976 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8977 | |
| 8978 | |
| 8979 | /* FIXME: use matrix-type input source selection */ |
| 8980 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8981 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8982 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8983 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8984 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8985 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8986 | /* Input mixer2 */ |
| 8987 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8988 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8989 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8990 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8991 | /* Input mixer3 */ |
| 8992 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8993 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8994 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8995 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8996 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 8997 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8998 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8999 | { } |
| 9000 | }; |
| 9001 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9002 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 9003 | /* |
| 9004 | * Unmute ADC0-2 and set the default input to mic-in |
| 9005 | */ |
| 9006 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9007 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9008 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9009 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9010 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9011 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9012 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9013 | /* 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] | 9014 | * mixer widget |
| 9015 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 9016 | * panel mic (mic 2) |
| 9017 | */ |
| 9018 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9019 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 9020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9021 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 9022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 9023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 9024 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 9025 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 9026 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9027 | /* |
| 9028 | * Set up output mixers (0x0c - 0x0e) |
| 9029 | */ |
| 9030 | /* set vol=0 to output mixers */ |
| 9031 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9032 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9033 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9034 | |
| 9035 | /* set up input amps for analog loopback */ |
| 9036 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 9037 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9038 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9039 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9040 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9041 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9042 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9043 | |
| 9044 | |
| 9045 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 9046 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 9047 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 9048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 9049 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 9050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 9051 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 9052 | |
| 9053 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9054 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 9055 | |
| 9056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9057 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 9058 | |
| 9059 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 9060 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9061 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9062 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 9063 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9064 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 9065 | |
| 9066 | /* FIXME: use matrix-type input source selection */ |
| 9067 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 9068 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 9069 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 9070 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 9071 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 9072 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 9073 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 9074 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9075 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 9076 | /* Input mixer2 */ |
| 9077 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9078 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9079 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9080 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9082 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9083 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9084 | /* Input mixer3 */ |
| 9085 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9086 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 9087 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 9088 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 9089 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 9090 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 9091 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 9092 | |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9093 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9094 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9095 | { } |
| 9096 | }; |
| 9097 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9098 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9099 | #define alc262_loopbacks alc880_loopbacks |
| 9100 | #endif |
| 9101 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9102 | /* pcm configuration: identiacal with ALC880 */ |
| 9103 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 9104 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 9105 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 9106 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 9107 | |
| 9108 | /* |
| 9109 | * BIOS auto configuration |
| 9110 | */ |
| 9111 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 9112 | { |
| 9113 | struct alc_spec *spec = codec->spec; |
| 9114 | int err; |
| 9115 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 9116 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9117 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9118 | alc262_ignore); |
| 9119 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9120 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9121 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9122 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9123 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9124 | if (err < 0) |
| 9125 | return err; |
| 9126 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9127 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9128 | return err; |
| 9129 | |
| 9130 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 9131 | |
| 9132 | if (spec->autocfg.dig_out_pin) |
| 9133 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 9134 | if (spec->autocfg.dig_in_pin) |
| 9135 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 9136 | |
| 9137 | if (spec->kctl_alloc) |
| 9138 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9139 | |
| 9140 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 9141 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9142 | spec->input_mux = &spec->private_imux; |
| 9143 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9144 | err = alc_auto_add_mic_boost(codec); |
| 9145 | if (err < 0) |
| 9146 | return err; |
| 9147 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9148 | return 1; |
| 9149 | } |
| 9150 | |
| 9151 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 9152 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 9153 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 9154 | |
| 9155 | |
| 9156 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9157 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9158 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9159 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9160 | alc262_auto_init_multi_out(codec); |
| 9161 | alc262_auto_init_hp_out(codec); |
| 9162 | alc262_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 9163 | if (spec->unsol_event) |
| 9164 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9165 | } |
| 9166 | |
| 9167 | /* |
| 9168 | * configuration and preset |
| 9169 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9170 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 9171 | [ALC262_BASIC] = "basic", |
| 9172 | [ALC262_HIPPO] = "hippo", |
| 9173 | [ALC262_HIPPO_1] = "hippo_1", |
| 9174 | [ALC262_FUJITSU] = "fujitsu", |
| 9175 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9176 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 9177 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9178 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9179 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 9180 | [ALC262_BENQ_T31] = "benq-t31", |
| 9181 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9182 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9183 | [ALC262_AUTO] = "auto", |
| 9184 | }; |
| 9185 | |
| 9186 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 9187 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 9188 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9189 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9190 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 9191 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 9192 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9193 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9194 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 9195 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9196 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9197 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9198 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9199 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9200 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9201 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9202 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9203 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9204 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9205 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9206 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9207 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9208 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9209 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9210 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9211 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9212 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9213 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9214 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9215 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Tony Vroon | 3f1eeae | 2008-02-25 16:44:13 +0100 | [diff] [blame] | 9216 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9217 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9218 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9219 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9220 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9221 | {} |
| 9222 | }; |
| 9223 | |
| 9224 | static struct alc_config_preset alc262_presets[] = { |
| 9225 | [ALC262_BASIC] = { |
| 9226 | .mixers = { alc262_base_mixer }, |
| 9227 | .init_verbs = { alc262_init_verbs }, |
| 9228 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9229 | .dac_nids = alc262_dac_nids, |
| 9230 | .hp_nid = 0x03, |
| 9231 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9232 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9233 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9234 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9235 | [ALC262_HIPPO] = { |
| 9236 | .mixers = { alc262_base_mixer }, |
| 9237 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9238 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9239 | .dac_nids = alc262_dac_nids, |
| 9240 | .hp_nid = 0x03, |
| 9241 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9242 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9243 | .channel_mode = alc262_modes, |
| 9244 | .input_mux = &alc262_capture_source, |
| 9245 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9246 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9247 | }, |
| 9248 | [ALC262_HIPPO_1] = { |
| 9249 | .mixers = { alc262_hippo1_mixer }, |
| 9250 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9251 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9252 | .dac_nids = alc262_dac_nids, |
| 9253 | .hp_nid = 0x02, |
| 9254 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9255 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9256 | .channel_mode = alc262_modes, |
| 9257 | .input_mux = &alc262_capture_source, |
| 9258 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9259 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9260 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9261 | [ALC262_FUJITSU] = { |
| 9262 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9263 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9264 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9265 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9266 | .dac_nids = alc262_dac_nids, |
| 9267 | .hp_nid = 0x03, |
| 9268 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9269 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9270 | .channel_mode = alc262_modes, |
| 9271 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9272 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9273 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9274 | [ALC262_HP_BPC] = { |
| 9275 | .mixers = { alc262_HP_BPC_mixer }, |
| 9276 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9277 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9278 | .dac_nids = alc262_dac_nids, |
| 9279 | .hp_nid = 0x03, |
| 9280 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9281 | .channel_mode = alc262_modes, |
| 9282 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9283 | .unsol_event = alc262_hp_bpc_unsol_event, |
| 9284 | .init_hook = alc262_hp_bpc_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9285 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9286 | [ALC262_HP_BPC_D7000_WF] = { |
| 9287 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9288 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9289 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9290 | .dac_nids = alc262_dac_nids, |
| 9291 | .hp_nid = 0x03, |
| 9292 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9293 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9294 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9295 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9296 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9297 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9298 | [ALC262_HP_BPC_D7000_WL] = { |
| 9299 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9300 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9301 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9302 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9303 | .dac_nids = alc262_dac_nids, |
| 9304 | .hp_nid = 0x03, |
| 9305 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9306 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9307 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | ce875f0 | 2008-01-28 18:17:43 +0100 | [diff] [blame] | 9308 | .unsol_event = alc262_hp_wildwest_unsol_event, |
| 9309 | .init_hook = alc262_hp_wildwest_automute, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9310 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9311 | [ALC262_HP_TC_T5735] = { |
| 9312 | .mixers = { alc262_hp_t5735_mixer }, |
| 9313 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9314 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9315 | .dac_nids = alc262_dac_nids, |
| 9316 | .hp_nid = 0x03, |
| 9317 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9318 | .channel_mode = alc262_modes, |
| 9319 | .input_mux = &alc262_capture_source, |
| 9320 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9321 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9322 | }, |
| 9323 | [ALC262_HP_RP5700] = { |
| 9324 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9325 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9326 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9327 | .dac_nids = alc262_dac_nids, |
| 9328 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9329 | .channel_mode = alc262_modes, |
| 9330 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9331 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9332 | [ALC262_BENQ_ED8] = { |
| 9333 | .mixers = { alc262_base_mixer }, |
| 9334 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9335 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9336 | .dac_nids = alc262_dac_nids, |
| 9337 | .hp_nid = 0x03, |
| 9338 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9339 | .channel_mode = alc262_modes, |
| 9340 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9341 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9342 | [ALC262_SONY_ASSAMD] = { |
| 9343 | .mixers = { alc262_sony_mixer }, |
| 9344 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9345 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9346 | .dac_nids = alc262_dac_nids, |
| 9347 | .hp_nid = 0x02, |
| 9348 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9349 | .channel_mode = alc262_modes, |
| 9350 | .input_mux = &alc262_capture_source, |
| 9351 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9352 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9353 | }, |
| 9354 | [ALC262_BENQ_T31] = { |
| 9355 | .mixers = { alc262_benq_t31_mixer }, |
| 9356 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9357 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9358 | .dac_nids = alc262_dac_nids, |
| 9359 | .hp_nid = 0x03, |
| 9360 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9361 | .channel_mode = alc262_modes, |
| 9362 | .input_mux = &alc262_capture_source, |
| 9363 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9364 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9365 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9366 | [ALC262_ULTRA] = { |
| 9367 | .mixers = { alc262_ultra_mixer }, |
| 9368 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9369 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9370 | .dac_nids = alc262_dac_nids, |
| 9371 | .hp_nid = 0x03, |
| 9372 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9373 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9374 | .channel_mode = alc262_modes, |
| 9375 | .input_mux = &alc262_ultra_capture_source, |
| 9376 | .unsol_event = alc262_ultra_unsol_event, |
| 9377 | .init_hook = alc262_ultra_automute, |
| 9378 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9379 | }; |
| 9380 | |
| 9381 | static int patch_alc262(struct hda_codec *codec) |
| 9382 | { |
| 9383 | struct alc_spec *spec; |
| 9384 | int board_config; |
| 9385 | int err; |
| 9386 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9387 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9388 | if (spec == NULL) |
| 9389 | return -ENOMEM; |
| 9390 | |
| 9391 | codec->spec = spec; |
| 9392 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9393 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9394 | * under-run |
| 9395 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9396 | { |
| 9397 | int tmp; |
| 9398 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9399 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9400 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9401 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9402 | } |
| 9403 | #endif |
| 9404 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9405 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9406 | alc262_models, |
| 9407 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9408 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9409 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9410 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9411 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9412 | board_config = ALC262_AUTO; |
| 9413 | } |
| 9414 | |
| 9415 | if (board_config == ALC262_AUTO) { |
| 9416 | /* automatic parse from the BIOS config */ |
| 9417 | err = alc262_parse_auto_config(codec); |
| 9418 | if (err < 0) { |
| 9419 | alc_free(codec); |
| 9420 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9421 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9422 | printk(KERN_INFO |
| 9423 | "hda_codec: Cannot set up configuration " |
| 9424 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9425 | board_config = ALC262_BASIC; |
| 9426 | } |
| 9427 | } |
| 9428 | |
| 9429 | if (board_config != ALC262_AUTO) |
| 9430 | setup_preset(spec, &alc262_presets[board_config]); |
| 9431 | |
| 9432 | spec->stream_name_analog = "ALC262 Analog"; |
| 9433 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9434 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9435 | |
| 9436 | spec->stream_name_digital = "ALC262 Digital"; |
| 9437 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9438 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9439 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9440 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9441 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9442 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9443 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9444 | /* get type */ |
| 9445 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9446 | if (wcap != AC_WID_AUD_IN) { |
| 9447 | spec->adc_nids = alc262_adc_nids_alt; |
| 9448 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9449 | spec->capsrc_nids = alc262_capsrc_nids_alt; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9450 | spec->mixers[spec->num_mixers] = |
| 9451 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9452 | spec->num_mixers++; |
| 9453 | } else { |
| 9454 | spec->adc_nids = alc262_adc_nids; |
| 9455 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
Takashi Iwai | 88c71a9 | 2008-02-14 17:27:17 +0100 | [diff] [blame] | 9456 | spec->capsrc_nids = alc262_capsrc_nids; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9457 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9458 | spec->num_mixers++; |
| 9459 | } |
| 9460 | } |
| 9461 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9462 | spec->vmaster_nid = 0x0c; |
| 9463 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9464 | codec->patch_ops = alc_patch_ops; |
| 9465 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9466 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9467 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9468 | if (!spec->loopback.amplist) |
| 9469 | spec->loopback.amplist = alc262_loopbacks; |
| 9470 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9471 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9472 | return 0; |
| 9473 | } |
| 9474 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9475 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9476 | * ALC268 channel source setting (2 channel) |
| 9477 | */ |
| 9478 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9479 | #define alc268_modes alc260_modes |
| 9480 | |
| 9481 | static hda_nid_t alc268_dac_nids[2] = { |
| 9482 | /* front, hp */ |
| 9483 | 0x02, 0x03 |
| 9484 | }; |
| 9485 | |
| 9486 | static hda_nid_t alc268_adc_nids[2] = { |
| 9487 | /* ADC0-1 */ |
| 9488 | 0x08, 0x07 |
| 9489 | }; |
| 9490 | |
| 9491 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9492 | /* ADC0 */ |
| 9493 | 0x08 |
| 9494 | }; |
| 9495 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9496 | static hda_nid_t alc268_capsrc_nids[2] = { 0x23, 0x24 }; |
| 9497 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9498 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9499 | /* output mixer control */ |
| 9500 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9501 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9502 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9503 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9504 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9505 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9506 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9507 | { } |
| 9508 | }; |
| 9509 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9510 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9511 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9512 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9513 | { } |
| 9514 | }; |
| 9515 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9516 | /* Toshiba specific */ |
| 9517 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9518 | |
| 9519 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9520 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9521 | { } /* end */ |
| 9522 | }; |
| 9523 | |
| 9524 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9525 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9526 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9527 | .ops = &snd_hda_bind_vol, |
| 9528 | .values = { |
| 9529 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9530 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9531 | 0 |
| 9532 | }, |
| 9533 | }; |
| 9534 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9535 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9536 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9537 | { |
| 9538 | struct alc_spec *spec = codec->spec; |
| 9539 | unsigned int mute; |
| 9540 | |
| 9541 | if (force || !spec->sense_updated) { |
| 9542 | unsigned int present; |
| 9543 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9544 | AC_VERB_GET_PIN_SENSE, 0); |
| 9545 | spec->jack_present = (present & 0x80000000) != 0; |
| 9546 | spec->sense_updated = 1; |
| 9547 | } |
| 9548 | if (spec->jack_present) |
| 9549 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9550 | else /* unmute internal speaker if necessary */ |
| 9551 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9552 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9553 | HDA_AMP_MUTE, mute); |
| 9554 | } |
| 9555 | |
| 9556 | |
| 9557 | /* bind hp and internal speaker mute (with plug check) */ |
| 9558 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9559 | struct snd_ctl_elem_value *ucontrol) |
| 9560 | { |
| 9561 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9562 | long *valp = ucontrol->value.integer.value; |
| 9563 | int change; |
| 9564 | |
| 9565 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9566 | HDA_AMP_MUTE, |
| 9567 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9568 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9569 | HDA_AMP_MUTE, |
| 9570 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9571 | if (change) |
| 9572 | alc268_acer_automute(codec, 0); |
| 9573 | return change; |
| 9574 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9575 | |
| 9576 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9577 | /* output mixer control */ |
| 9578 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9579 | { |
| 9580 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9581 | .name = "Master Playback Switch", |
| 9582 | .info = snd_hda_mixer_amp_switch_info, |
| 9583 | .get = snd_hda_mixer_amp_switch_get, |
| 9584 | .put = alc268_acer_master_sw_put, |
| 9585 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9586 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9587 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9588 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9589 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9590 | { } |
| 9591 | }; |
| 9592 | |
| 9593 | static struct hda_verb alc268_acer_verbs[] = { |
| 9594 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9595 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9596 | |
| 9597 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9598 | { } |
| 9599 | }; |
| 9600 | |
| 9601 | /* unsolicited event for HP jack sensing */ |
| 9602 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9603 | unsigned int res) |
| 9604 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9605 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9606 | return; |
| 9607 | alc268_toshiba_automute(codec); |
| 9608 | } |
| 9609 | |
| 9610 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9611 | unsigned int res) |
| 9612 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9613 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9614 | return; |
| 9615 | alc268_acer_automute(codec, 1); |
| 9616 | } |
| 9617 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9618 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9619 | { |
| 9620 | alc268_acer_automute(codec, 1); |
| 9621 | } |
| 9622 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9623 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9624 | /* output mixer control */ |
| 9625 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9626 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9627 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9628 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9629 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9630 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9631 | { } |
| 9632 | }; |
| 9633 | |
| 9634 | static struct hda_verb alc268_dell_verbs[] = { |
| 9635 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9636 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9637 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9638 | { } |
| 9639 | }; |
| 9640 | |
| 9641 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9642 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9643 | { |
| 9644 | unsigned int present; |
| 9645 | unsigned int mute; |
| 9646 | |
| 9647 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9648 | if (present & 0x80000000) |
| 9649 | mute = HDA_AMP_MUTE; |
| 9650 | else |
| 9651 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9652 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9653 | HDA_AMP_MUTE, mute); |
| 9654 | } |
| 9655 | |
| 9656 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9657 | unsigned int res) |
| 9658 | { |
| 9659 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9660 | return; |
| 9661 | alc268_dell_automute(codec); |
| 9662 | } |
| 9663 | |
| 9664 | #define alc268_dell_init_hook alc268_dell_automute |
| 9665 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9666 | /* |
| 9667 | * generic initialization of ADC, input mixers and output mixers |
| 9668 | */ |
| 9669 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9670 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9671 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9672 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9673 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9674 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9675 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9677 | |
| 9678 | /* |
| 9679 | * Set up output mixers (0x0c - 0x0e) |
| 9680 | */ |
| 9681 | /* set vol=0 to output mixers */ |
| 9682 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9683 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9684 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9685 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9686 | |
| 9687 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9688 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9689 | |
| 9690 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9691 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9693 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9694 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9695 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9696 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9697 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9698 | |
| 9699 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9700 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9701 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9702 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9703 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9704 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9705 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9706 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9707 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9708 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9709 | |
| 9710 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9711 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9712 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9713 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9714 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9715 | { } |
| 9716 | }; |
| 9717 | |
| 9718 | /* |
| 9719 | * generic initialization of ADC, input mixers and output mixers |
| 9720 | */ |
| 9721 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9722 | /* set output DAC */ |
| 9723 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9724 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9725 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9726 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9727 | |
| 9728 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9729 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9730 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9731 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9732 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9733 | |
| 9734 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9735 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9736 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9737 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9738 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9739 | |
| 9740 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9741 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9742 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9743 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9744 | |
| 9745 | /* set PCBEEP vol = 0 */ |
| 9746 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9747 | |
| 9748 | { } |
| 9749 | }; |
| 9750 | |
| 9751 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9752 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9753 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9754 | |
| 9755 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9756 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9757 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9758 | { |
| 9759 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9760 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9761 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9762 | */ |
| 9763 | /* .name = "Capture Source", */ |
| 9764 | .name = "Input Source", |
| 9765 | .count = 1, |
| 9766 | .info = alc268_mux_enum_info, |
| 9767 | .get = alc268_mux_enum_get, |
| 9768 | .put = alc268_mux_enum_put, |
| 9769 | }, |
| 9770 | { } /* end */ |
| 9771 | }; |
| 9772 | |
| 9773 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9774 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9775 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9776 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9777 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9778 | { |
| 9779 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9780 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9781 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9782 | */ |
| 9783 | /* .name = "Capture Source", */ |
| 9784 | .name = "Input Source", |
| 9785 | .count = 2, |
| 9786 | .info = alc268_mux_enum_info, |
| 9787 | .get = alc268_mux_enum_get, |
| 9788 | .put = alc268_mux_enum_put, |
| 9789 | }, |
| 9790 | { } /* end */ |
| 9791 | }; |
| 9792 | |
| 9793 | static struct hda_input_mux alc268_capture_source = { |
| 9794 | .num_items = 4, |
| 9795 | .items = { |
| 9796 | { "Mic", 0x0 }, |
| 9797 | { "Front Mic", 0x1 }, |
| 9798 | { "Line", 0x2 }, |
| 9799 | { "CD", 0x3 }, |
| 9800 | }, |
| 9801 | }; |
| 9802 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9803 | #ifdef CONFIG_SND_DEBUG |
| 9804 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9805 | /* Volume widgets */ |
| 9806 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9807 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9808 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9809 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9810 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9811 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9812 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9813 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9814 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9815 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9816 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9817 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9818 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 9819 | /* The below appears problematic on some hardwares */ |
| 9820 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9821 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9822 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9823 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9824 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9825 | |
| 9826 | /* Modes for retasking pin widgets */ |
| 9827 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9828 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9829 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9830 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9831 | |
| 9832 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9833 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9834 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9835 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9836 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9837 | |
| 9838 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9839 | * The ALC268 does not have an SPDIF input. |
| 9840 | */ |
| 9841 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9842 | |
| 9843 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9844 | * this output to turn on an external amplifier. |
| 9845 | */ |
| 9846 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9847 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9848 | |
| 9849 | { } /* end */ |
| 9850 | }; |
| 9851 | #endif |
| 9852 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9853 | /* create input playback/capture controls for the given pin */ |
| 9854 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9855 | const char *ctlname, int idx) |
| 9856 | { |
| 9857 | char name[32]; |
| 9858 | int err; |
| 9859 | |
| 9860 | sprintf(name, "%s Playback Volume", ctlname); |
| 9861 | if (nid == 0x14) { |
| 9862 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9863 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9864 | HDA_OUTPUT)); |
| 9865 | if (err < 0) |
| 9866 | return err; |
| 9867 | } else if (nid == 0x15) { |
| 9868 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9869 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9870 | HDA_OUTPUT)); |
| 9871 | if (err < 0) |
| 9872 | return err; |
| 9873 | } else |
| 9874 | return -1; |
| 9875 | sprintf(name, "%s Playback Switch", ctlname); |
| 9876 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9877 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9878 | if (err < 0) |
| 9879 | return err; |
| 9880 | return 0; |
| 9881 | } |
| 9882 | |
| 9883 | /* add playback controls from the parsed DAC table */ |
| 9884 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9885 | const struct auto_pin_cfg *cfg) |
| 9886 | { |
| 9887 | hda_nid_t nid; |
| 9888 | int err; |
| 9889 | |
| 9890 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9891 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9892 | spec->multiout.dac_nids[0] = 2; |
| 9893 | spec->multiout.dac_nids[1] = 3; |
| 9894 | |
| 9895 | nid = cfg->line_out_pins[0]; |
| 9896 | if (nid) |
| 9897 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9898 | |
| 9899 | nid = cfg->speaker_pins[0]; |
| 9900 | if (nid == 0x1d) { |
| 9901 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9902 | "Speaker Playback Volume", |
| 9903 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9904 | if (err < 0) |
| 9905 | return err; |
| 9906 | } |
| 9907 | nid = cfg->hp_pins[0]; |
| 9908 | if (nid) |
| 9909 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9910 | |
| 9911 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9912 | if (nid == 0x16) { |
| 9913 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9914 | "Mono Playback Switch", |
| 9915 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9916 | if (err < 0) |
| 9917 | return err; |
| 9918 | } |
| 9919 | return 0; |
| 9920 | } |
| 9921 | |
| 9922 | /* create playback/capture controls for input pins */ |
| 9923 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9924 | const struct auto_pin_cfg *cfg) |
| 9925 | { |
| 9926 | struct hda_input_mux *imux = &spec->private_imux; |
| 9927 | int i, idx1; |
| 9928 | |
| 9929 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9930 | switch(cfg->input_pins[i]) { |
| 9931 | case 0x18: |
| 9932 | idx1 = 0; /* Mic 1 */ |
| 9933 | break; |
| 9934 | case 0x19: |
| 9935 | idx1 = 1; /* Mic 2 */ |
| 9936 | break; |
| 9937 | case 0x1a: |
| 9938 | idx1 = 2; /* Line In */ |
| 9939 | break; |
| 9940 | case 0x1c: |
| 9941 | idx1 = 3; /* CD */ |
| 9942 | break; |
| 9943 | default: |
| 9944 | continue; |
| 9945 | } |
| 9946 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9947 | imux->items[imux->num_items].index = idx1; |
| 9948 | imux->num_items++; |
| 9949 | } |
| 9950 | return 0; |
| 9951 | } |
| 9952 | |
| 9953 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9954 | { |
| 9955 | struct alc_spec *spec = codec->spec; |
| 9956 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9957 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9958 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9959 | unsigned int dac_vol1, dac_vol2; |
| 9960 | |
| 9961 | if (speaker_nid) { |
| 9962 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9963 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9964 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9965 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9966 | AMP_IN_UNMUTE(1)); |
| 9967 | snd_hda_codec_write(codec, 0x10, 0, |
| 9968 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9969 | AMP_IN_UNMUTE(1)); |
| 9970 | } else { |
| 9971 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9972 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9973 | snd_hda_codec_write(codec, 0x10, 0, |
| 9974 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9975 | } |
| 9976 | |
| 9977 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 9978 | if (line_nid == 0x14) |
| 9979 | dac_vol2 = AMP_OUT_ZERO; |
| 9980 | else if (line_nid == 0x15) |
| 9981 | dac_vol1 = AMP_OUT_ZERO; |
| 9982 | if (hp_nid == 0x14) |
| 9983 | dac_vol2 = AMP_OUT_ZERO; |
| 9984 | else if (hp_nid == 0x15) |
| 9985 | dac_vol1 = AMP_OUT_ZERO; |
| 9986 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 9987 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 9988 | spec->autocfg.line_out_pins[2] != 0x16) |
| 9989 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 9990 | |
| 9991 | snd_hda_codec_write(codec, 0x02, 0, |
| 9992 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 9993 | snd_hda_codec_write(codec, 0x03, 0, |
| 9994 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 9995 | } |
| 9996 | |
| 9997 | /* pcm configuration: identiacal with ALC880 */ |
| 9998 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 9999 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10000 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10001 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10002 | |
| 10003 | /* |
| 10004 | * BIOS auto configuration |
| 10005 | */ |
| 10006 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10007 | { |
| 10008 | struct alc_spec *spec = codec->spec; |
| 10009 | int err; |
| 10010 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10011 | |
| 10012 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10013 | alc268_ignore); |
| 10014 | if (err < 0) |
| 10015 | return err; |
| 10016 | if (!spec->autocfg.line_outs) |
| 10017 | return 0; /* can't find valid BIOS pin config */ |
| 10018 | |
| 10019 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10020 | if (err < 0) |
| 10021 | return err; |
| 10022 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10023 | if (err < 0) |
| 10024 | return err; |
| 10025 | |
| 10026 | spec->multiout.max_channels = 2; |
| 10027 | |
| 10028 | /* digital only support output */ |
| 10029 | if (spec->autocfg.dig_out_pin) |
| 10030 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10031 | |
| 10032 | if (spec->kctl_alloc) |
| 10033 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10034 | |
| 10035 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10036 | spec->num_mux_defs = 1; |
| 10037 | spec->input_mux = &spec->private_imux; |
| 10038 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10039 | err = alc_auto_add_mic_boost(codec); |
| 10040 | if (err < 0) |
| 10041 | return err; |
| 10042 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10043 | return 1; |
| 10044 | } |
| 10045 | |
| 10046 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10047 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10048 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10049 | |
| 10050 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10051 | static void alc268_auto_init(struct hda_codec *codec) |
| 10052 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10053 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10054 | alc268_auto_init_multi_out(codec); |
| 10055 | alc268_auto_init_hp_out(codec); |
| 10056 | alc268_auto_init_mono_speaker_out(codec); |
| 10057 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10058 | if (spec->unsol_event) |
| 10059 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10060 | } |
| 10061 | |
| 10062 | /* |
| 10063 | * configuration and preset |
| 10064 | */ |
| 10065 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10066 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10067 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10068 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10069 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10070 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10071 | #ifdef CONFIG_SND_DEBUG |
| 10072 | [ALC268_TEST] = "test", |
| 10073 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10074 | [ALC268_AUTO] = "auto", |
| 10075 | }; |
| 10076 | |
| 10077 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10078 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10079 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10080 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10081 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10082 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10083 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10084 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10085 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10086 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10087 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10088 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10089 | {} |
| 10090 | }; |
| 10091 | |
| 10092 | static struct alc_config_preset alc268_presets[] = { |
| 10093 | [ALC268_3ST] = { |
| 10094 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 10095 | .init_verbs = { alc268_base_init_verbs }, |
| 10096 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10097 | .dac_nids = alc268_dac_nids, |
| 10098 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10099 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10100 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10101 | .hp_nid = 0x03, |
| 10102 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10103 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10104 | .channel_mode = alc268_modes, |
| 10105 | .input_mux = &alc268_capture_source, |
| 10106 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10107 | [ALC268_TOSHIBA] = { |
| 10108 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10109 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10110 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10111 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10112 | .dac_nids = alc268_dac_nids, |
| 10113 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10114 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10115 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10116 | .hp_nid = 0x03, |
| 10117 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10118 | .channel_mode = alc268_modes, |
| 10119 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10120 | .unsol_event = alc268_toshiba_unsol_event, |
| 10121 | .init_hook = alc268_toshiba_automute, |
| 10122 | }, |
| 10123 | [ALC268_ACER] = { |
| 10124 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 10125 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10126 | alc268_acer_verbs }, |
| 10127 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10128 | .dac_nids = alc268_dac_nids, |
| 10129 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10130 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10131 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10132 | .hp_nid = 0x02, |
| 10133 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10134 | .channel_mode = alc268_modes, |
| 10135 | .input_mux = &alc268_capture_source, |
| 10136 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10137 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10138 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10139 | [ALC268_DELL] = { |
| 10140 | .mixers = { alc268_dell_mixer }, |
| 10141 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10142 | alc268_dell_verbs }, |
| 10143 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10144 | .dac_nids = alc268_dac_nids, |
| 10145 | .hp_nid = 0x02, |
| 10146 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10147 | .channel_mode = alc268_modes, |
| 10148 | .unsol_event = alc268_dell_unsol_event, |
| 10149 | .init_hook = alc268_dell_init_hook, |
| 10150 | .input_mux = &alc268_capture_source, |
| 10151 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10152 | [ALC268_ZEPTO] = { |
| 10153 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 10154 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10155 | alc268_toshiba_verbs }, |
| 10156 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10157 | .dac_nids = alc268_dac_nids, |
| 10158 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10159 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10160 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10161 | .hp_nid = 0x03, |
| 10162 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10163 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10164 | .channel_mode = alc268_modes, |
| 10165 | .input_mux = &alc268_capture_source, |
| 10166 | .unsol_event = alc268_toshiba_unsol_event, |
| 10167 | .init_hook = alc268_toshiba_automute |
| 10168 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10169 | #ifdef CONFIG_SND_DEBUG |
| 10170 | [ALC268_TEST] = { |
| 10171 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10172 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10173 | alc268_volume_init_verbs }, |
| 10174 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10175 | .dac_nids = alc268_dac_nids, |
| 10176 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10177 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10178 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10179 | .hp_nid = 0x03, |
| 10180 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10181 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10182 | .channel_mode = alc268_modes, |
| 10183 | .input_mux = &alc268_capture_source, |
| 10184 | }, |
| 10185 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10186 | }; |
| 10187 | |
| 10188 | static int patch_alc268(struct hda_codec *codec) |
| 10189 | { |
| 10190 | struct alc_spec *spec; |
| 10191 | int board_config; |
| 10192 | int err; |
| 10193 | |
| 10194 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10195 | if (spec == NULL) |
| 10196 | return -ENOMEM; |
| 10197 | |
| 10198 | codec->spec = spec; |
| 10199 | |
| 10200 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10201 | alc268_models, |
| 10202 | alc268_cfg_tbl); |
| 10203 | |
| 10204 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10205 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10206 | "trying auto-probe from BIOS...\n"); |
| 10207 | board_config = ALC268_AUTO; |
| 10208 | } |
| 10209 | |
| 10210 | if (board_config == ALC268_AUTO) { |
| 10211 | /* automatic parse from the BIOS config */ |
| 10212 | err = alc268_parse_auto_config(codec); |
| 10213 | if (err < 0) { |
| 10214 | alc_free(codec); |
| 10215 | return err; |
| 10216 | } else if (!err) { |
| 10217 | printk(KERN_INFO |
| 10218 | "hda_codec: Cannot set up configuration " |
| 10219 | "from BIOS. Using base mode...\n"); |
| 10220 | board_config = ALC268_3ST; |
| 10221 | } |
| 10222 | } |
| 10223 | |
| 10224 | if (board_config != ALC268_AUTO) |
| 10225 | setup_preset(spec, &alc268_presets[board_config]); |
| 10226 | |
| 10227 | spec->stream_name_analog = "ALC268 Analog"; |
| 10228 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10229 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10230 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10231 | |
| 10232 | spec->stream_name_digital = "ALC268 Digital"; |
| 10233 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10234 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10235 | if (!spec->adc_nids && spec->input_mux) { |
| 10236 | /* check whether NID 0x07 is valid */ |
| 10237 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10238 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10239 | /* get type */ |
| 10240 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 10241 | if (wcap != AC_WID_AUD_IN) { |
| 10242 | spec->adc_nids = alc268_adc_nids_alt; |
| 10243 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10244 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10245 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10246 | spec->num_mixers++; |
| 10247 | } else { |
| 10248 | spec->adc_nids = alc268_adc_nids; |
| 10249 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10250 | spec->mixers[spec->num_mixers] = |
| 10251 | alc268_capture_mixer; |
| 10252 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10253 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10254 | spec->capsrc_nids = alc268_capsrc_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10255 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10256 | |
| 10257 | spec->vmaster_nid = 0x02; |
| 10258 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10259 | codec->patch_ops = alc_patch_ops; |
| 10260 | if (board_config == ALC268_AUTO) |
| 10261 | spec->init_hook = alc268_auto_init; |
| 10262 | |
| 10263 | return 0; |
| 10264 | } |
| 10265 | |
| 10266 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10267 | * ALC269 channel source setting (2 channel) |
| 10268 | */ |
| 10269 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10270 | |
| 10271 | #define alc269_dac_nids alc260_dac_nids |
| 10272 | |
| 10273 | static hda_nid_t alc269_adc_nids[1] = { |
| 10274 | /* ADC1 */ |
| 10275 | 0x07, |
| 10276 | }; |
| 10277 | |
| 10278 | #define alc269_modes alc260_modes |
| 10279 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10280 | |
| 10281 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10282 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10283 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10284 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10285 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10286 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10287 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10288 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10289 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10290 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10291 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10292 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10293 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10294 | { } /* end */ |
| 10295 | }; |
| 10296 | |
| 10297 | /* capture mixer elements */ |
| 10298 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10299 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10300 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10301 | { |
| 10302 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10303 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10304 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10305 | */ |
| 10306 | /* .name = "Capture Source", */ |
| 10307 | .name = "Input Source", |
| 10308 | .count = 1, |
| 10309 | .info = alc_mux_enum_info, |
| 10310 | .get = alc_mux_enum_get, |
| 10311 | .put = alc_mux_enum_put, |
| 10312 | }, |
| 10313 | { } /* end */ |
| 10314 | }; |
| 10315 | |
| 10316 | /* |
| 10317 | * generic initialization of ADC, input mixers and output mixers |
| 10318 | */ |
| 10319 | static struct hda_verb alc269_init_verbs[] = { |
| 10320 | /* |
| 10321 | * Unmute ADC0 and set the default input to mic-in |
| 10322 | */ |
| 10323 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10324 | |
| 10325 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10326 | * analog-loopback mixer widget |
| 10327 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10328 | * front panel mic (mic 2) |
| 10329 | */ |
| 10330 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10331 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10332 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10333 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10334 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10335 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10336 | |
| 10337 | /* |
| 10338 | * Set up output mixers (0x0c - 0x0e) |
| 10339 | */ |
| 10340 | /* set vol=0 to output mixers */ |
| 10341 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10342 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10343 | |
| 10344 | /* set up input amps for analog loopback */ |
| 10345 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10346 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10347 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10348 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10349 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10350 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10351 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10352 | |
| 10353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10354 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10355 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10356 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10357 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10358 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10359 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10360 | |
| 10361 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10362 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10363 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10364 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10365 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10366 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10367 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10368 | |
| 10369 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10370 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10371 | |
| 10372 | /* FIXME: use matrix-type input source selection */ |
| 10373 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10374 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10375 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10376 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10377 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10378 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10379 | |
| 10380 | /* set EAPD */ |
| 10381 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10382 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10383 | { } |
| 10384 | }; |
| 10385 | |
| 10386 | /* add playback controls from the parsed DAC table */ |
| 10387 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10388 | const struct auto_pin_cfg *cfg) |
| 10389 | { |
| 10390 | hda_nid_t nid; |
| 10391 | int err; |
| 10392 | |
| 10393 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10394 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10395 | spec->multiout.dac_nids[0] = 2; |
| 10396 | |
| 10397 | nid = cfg->line_out_pins[0]; |
| 10398 | if (nid) { |
| 10399 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10400 | "Front Playback Volume", |
| 10401 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10402 | if (err < 0) |
| 10403 | return err; |
| 10404 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10405 | "Front Playback Switch", |
| 10406 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10407 | if (err < 0) |
| 10408 | return err; |
| 10409 | } |
| 10410 | |
| 10411 | nid = cfg->speaker_pins[0]; |
| 10412 | if (nid) { |
| 10413 | if (!cfg->line_out_pins[0]) { |
| 10414 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10415 | "Speaker Playback Volume", |
| 10416 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10417 | HDA_OUTPUT)); |
| 10418 | if (err < 0) |
| 10419 | return err; |
| 10420 | } |
| 10421 | if (nid == 0x16) { |
| 10422 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10423 | "Speaker Playback Switch", |
| 10424 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10425 | HDA_OUTPUT)); |
| 10426 | if (err < 0) |
| 10427 | return err; |
| 10428 | } else { |
| 10429 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10430 | "Speaker Playback Switch", |
| 10431 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10432 | HDA_OUTPUT)); |
| 10433 | if (err < 0) |
| 10434 | return err; |
| 10435 | } |
| 10436 | } |
| 10437 | nid = cfg->hp_pins[0]; |
| 10438 | if (nid) { |
| 10439 | /* spec->multiout.hp_nid = 2; */ |
| 10440 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10441 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10442 | "Headphone Playback Volume", |
| 10443 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10444 | HDA_OUTPUT)); |
| 10445 | if (err < 0) |
| 10446 | return err; |
| 10447 | } |
| 10448 | if (nid == 0x16) { |
| 10449 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10450 | "Headphone Playback Switch", |
| 10451 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10452 | HDA_OUTPUT)); |
| 10453 | if (err < 0) |
| 10454 | return err; |
| 10455 | } else { |
| 10456 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10457 | "Headphone Playback Switch", |
| 10458 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10459 | HDA_OUTPUT)); |
| 10460 | if (err < 0) |
| 10461 | return err; |
| 10462 | } |
| 10463 | } |
| 10464 | return 0; |
| 10465 | } |
| 10466 | |
| 10467 | #define alc269_auto_create_analog_input_ctls \ |
| 10468 | alc880_auto_create_analog_input_ctls |
| 10469 | |
| 10470 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10471 | #define alc269_loopbacks alc880_loopbacks |
| 10472 | #endif |
| 10473 | |
| 10474 | /* pcm configuration: identiacal with ALC880 */ |
| 10475 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10476 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10477 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10478 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10479 | |
| 10480 | /* |
| 10481 | * BIOS auto configuration |
| 10482 | */ |
| 10483 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10484 | { |
| 10485 | struct alc_spec *spec = codec->spec; |
| 10486 | int err; |
| 10487 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10488 | |
| 10489 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10490 | alc269_ignore); |
| 10491 | if (err < 0) |
| 10492 | return err; |
| 10493 | |
| 10494 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10495 | if (err < 0) |
| 10496 | return err; |
| 10497 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10498 | if (err < 0) |
| 10499 | return err; |
| 10500 | |
| 10501 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10502 | |
| 10503 | if (spec->autocfg.dig_out_pin) |
| 10504 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10505 | |
| 10506 | if (spec->kctl_alloc) |
| 10507 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10508 | |
| 10509 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10510 | spec->num_mux_defs = 1; |
| 10511 | spec->input_mux = &spec->private_imux; |
| 10512 | |
| 10513 | err = alc_auto_add_mic_boost(codec); |
| 10514 | if (err < 0) |
| 10515 | return err; |
| 10516 | |
| 10517 | return 1; |
| 10518 | } |
| 10519 | |
| 10520 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10521 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10522 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10523 | |
| 10524 | |
| 10525 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10526 | static void alc269_auto_init(struct hda_codec *codec) |
| 10527 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10528 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10529 | alc269_auto_init_multi_out(codec); |
| 10530 | alc269_auto_init_hp_out(codec); |
| 10531 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10532 | if (spec->unsol_event) |
| 10533 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10534 | } |
| 10535 | |
| 10536 | /* |
| 10537 | * configuration and preset |
| 10538 | */ |
| 10539 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10540 | [ALC269_BASIC] = "basic", |
| 10541 | }; |
| 10542 | |
| 10543 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10544 | {} |
| 10545 | }; |
| 10546 | |
| 10547 | static struct alc_config_preset alc269_presets[] = { |
| 10548 | [ALC269_BASIC] = { |
| 10549 | .mixers = { alc269_base_mixer }, |
| 10550 | .init_verbs = { alc269_init_verbs }, |
| 10551 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10552 | .dac_nids = alc269_dac_nids, |
| 10553 | .hp_nid = 0x03, |
| 10554 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10555 | .channel_mode = alc269_modes, |
| 10556 | .input_mux = &alc269_capture_source, |
| 10557 | }, |
| 10558 | }; |
| 10559 | |
| 10560 | static int patch_alc269(struct hda_codec *codec) |
| 10561 | { |
| 10562 | struct alc_spec *spec; |
| 10563 | int board_config; |
| 10564 | int err; |
| 10565 | |
| 10566 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10567 | if (spec == NULL) |
| 10568 | return -ENOMEM; |
| 10569 | |
| 10570 | codec->spec = spec; |
| 10571 | |
| 10572 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10573 | alc269_models, |
| 10574 | alc269_cfg_tbl); |
| 10575 | |
| 10576 | if (board_config < 0) { |
| 10577 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10578 | "trying auto-probe from BIOS...\n"); |
| 10579 | board_config = ALC269_AUTO; |
| 10580 | } |
| 10581 | |
| 10582 | if (board_config == ALC269_AUTO) { |
| 10583 | /* automatic parse from the BIOS config */ |
| 10584 | err = alc269_parse_auto_config(codec); |
| 10585 | if (err < 0) { |
| 10586 | alc_free(codec); |
| 10587 | return err; |
| 10588 | } else if (!err) { |
| 10589 | printk(KERN_INFO |
| 10590 | "hda_codec: Cannot set up configuration " |
| 10591 | "from BIOS. Using base mode...\n"); |
| 10592 | board_config = ALC269_BASIC; |
| 10593 | } |
| 10594 | } |
| 10595 | |
| 10596 | if (board_config != ALC269_AUTO) |
| 10597 | setup_preset(spec, &alc269_presets[board_config]); |
| 10598 | |
| 10599 | spec->stream_name_analog = "ALC269 Analog"; |
| 10600 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10601 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10602 | |
| 10603 | spec->stream_name_digital = "ALC269 Digital"; |
| 10604 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10605 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10606 | |
| 10607 | spec->adc_nids = alc269_adc_nids; |
| 10608 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10609 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10610 | spec->num_mixers++; |
| 10611 | |
| 10612 | codec->patch_ops = alc_patch_ops; |
| 10613 | if (board_config == ALC269_AUTO) |
| 10614 | spec->init_hook = alc269_auto_init; |
| 10615 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10616 | if (!spec->loopback.amplist) |
| 10617 | spec->loopback.amplist = alc269_loopbacks; |
| 10618 | #endif |
| 10619 | |
| 10620 | return 0; |
| 10621 | } |
| 10622 | |
| 10623 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10624 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10625 | */ |
| 10626 | |
| 10627 | /* |
| 10628 | * set the path ways for 2 channel output |
| 10629 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10630 | */ |
| 10631 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10632 | /* set pin widget 1Ah (line in) for input */ |
| 10633 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10634 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10635 | * the vref |
| 10636 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10637 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10638 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10639 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10640 | #if 0 |
| 10641 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10642 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10643 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10644 | { } /* end */ |
| 10645 | }; |
| 10646 | /* |
| 10647 | * 6ch mode |
| 10648 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10649 | */ |
| 10650 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10651 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10652 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10653 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10654 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10655 | |
| 10656 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10657 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10658 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10659 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10660 | #if 0 |
| 10661 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10662 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10663 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10664 | { } /* end */ |
| 10665 | }; |
| 10666 | |
| 10667 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10668 | { 2, alc861_threestack_ch2_init }, |
| 10669 | { 6, alc861_threestack_ch6_init }, |
| 10670 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10671 | /* Set mic1 as input and unmute the mixer */ |
| 10672 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10673 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10674 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10675 | { } /* end */ |
| 10676 | }; |
| 10677 | /* Set mic1 as output and mute mixer */ |
| 10678 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10679 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10680 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10681 | { } /* end */ |
| 10682 | }; |
| 10683 | |
| 10684 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10685 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10686 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10687 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10688 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10689 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10690 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10691 | /* set pin widget 1Ah (line in) for input */ |
| 10692 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10693 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10694 | * the vref |
| 10695 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10696 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10697 | |
| 10698 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10699 | #if 0 |
| 10700 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10701 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10702 | #endif |
| 10703 | { } /* end */ |
| 10704 | }; |
| 10705 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10706 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10707 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10708 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10709 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10710 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10711 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10712 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10713 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10714 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10715 | |
| 10716 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10717 | #if 0 |
| 10718 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10719 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10720 | #endif |
| 10721 | { } /* end */ |
| 10722 | }; |
| 10723 | |
| 10724 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10725 | { 2, alc861_asus_ch2_init }, |
| 10726 | { 6, alc861_asus_ch6_init }, |
| 10727 | }; |
| 10728 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10729 | /* patch-ALC861 */ |
| 10730 | |
| 10731 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10732 | /* output mixer control */ |
| 10733 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10734 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10735 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10736 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10737 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10738 | |
| 10739 | /*Input mixer control */ |
| 10740 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10741 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10742 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10743 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10744 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10745 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10748 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10749 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10750 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10751 | /* Capture mixer control */ |
| 10752 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10753 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10754 | { |
| 10755 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10756 | .name = "Capture Source", |
| 10757 | .count = 1, |
| 10758 | .info = alc_mux_enum_info, |
| 10759 | .get = alc_mux_enum_get, |
| 10760 | .put = alc_mux_enum_put, |
| 10761 | }, |
| 10762 | { } /* end */ |
| 10763 | }; |
| 10764 | |
| 10765 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10766 | /* output mixer control */ |
| 10767 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10768 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10769 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10770 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10771 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10772 | |
| 10773 | /* Input mixer control */ |
| 10774 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10775 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10776 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10777 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10778 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10779 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10780 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10781 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10782 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10783 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10784 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10785 | /* Capture mixer control */ |
| 10786 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10787 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10788 | { |
| 10789 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10790 | .name = "Capture Source", |
| 10791 | .count = 1, |
| 10792 | .info = alc_mux_enum_info, |
| 10793 | .get = alc_mux_enum_get, |
| 10794 | .put = alc_mux_enum_put, |
| 10795 | }, |
| 10796 | { |
| 10797 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10798 | .name = "Channel Mode", |
| 10799 | .info = alc_ch_mode_info, |
| 10800 | .get = alc_ch_mode_get, |
| 10801 | .put = alc_ch_mode_put, |
| 10802 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10803 | }, |
| 10804 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10805 | }; |
| 10806 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10807 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10808 | /* output mixer control */ |
| 10809 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10810 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10811 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10812 | |
| 10813 | /*Capture mixer control */ |
| 10814 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10815 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10816 | { |
| 10817 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10818 | .name = "Capture Source", |
| 10819 | .count = 1, |
| 10820 | .info = alc_mux_enum_info, |
| 10821 | .get = alc_mux_enum_get, |
| 10822 | .put = alc_mux_enum_put, |
| 10823 | }, |
| 10824 | |
| 10825 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10826 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10827 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10828 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10829 | /* output mixer control */ |
| 10830 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10831 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10832 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10833 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10834 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10835 | |
| 10836 | /* Input mixer control */ |
| 10837 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10838 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10840 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10841 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10842 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10843 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10844 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10845 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10846 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10847 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10848 | /* Capture mixer control */ |
| 10849 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10850 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10851 | { |
| 10852 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10853 | .name = "Capture Source", |
| 10854 | .count = 1, |
| 10855 | .info = alc_mux_enum_info, |
| 10856 | .get = alc_mux_enum_get, |
| 10857 | .put = alc_mux_enum_put, |
| 10858 | }, |
| 10859 | { |
| 10860 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10861 | .name = "Channel Mode", |
| 10862 | .info = alc_ch_mode_info, |
| 10863 | .get = alc_ch_mode_get, |
| 10864 | .put = alc_ch_mode_put, |
| 10865 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10866 | }, |
| 10867 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10868 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10869 | |
| 10870 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10871 | /* output mixer control */ |
| 10872 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10873 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10874 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10875 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10876 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10877 | |
| 10878 | /* Input mixer control */ |
| 10879 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10880 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10881 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10882 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10883 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10884 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10885 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10886 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10887 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10888 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10889 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10890 | /* Capture mixer control */ |
| 10891 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10892 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10893 | { |
| 10894 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10895 | .name = "Capture Source", |
| 10896 | .count = 1, |
| 10897 | .info = alc_mux_enum_info, |
| 10898 | .get = alc_mux_enum_get, |
| 10899 | .put = alc_mux_enum_put, |
| 10900 | }, |
| 10901 | { |
| 10902 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10903 | .name = "Channel Mode", |
| 10904 | .info = alc_ch_mode_info, |
| 10905 | .get = alc_ch_mode_get, |
| 10906 | .put = alc_ch_mode_put, |
| 10907 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10908 | }, |
| 10909 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10910 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10911 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10912 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10913 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10914 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10915 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10916 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10917 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10918 | { } |
| 10919 | }; |
| 10920 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10921 | /* |
| 10922 | * generic initialization of ADC, input mixers and output mixers |
| 10923 | */ |
| 10924 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10925 | /* |
| 10926 | * Unmute ADC0 and set the default input to mic-in |
| 10927 | */ |
| 10928 | /* port-A for surround (rear panel) */ |
| 10929 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10930 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10931 | /* port-B for mic-in (rear panel) with vref */ |
| 10932 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10933 | /* port-C for line-in (rear panel) */ |
| 10934 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10935 | /* port-D for Front */ |
| 10936 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10937 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10938 | /* port-E for HP out (front panel) */ |
| 10939 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10940 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10941 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10942 | /* port-F for mic-in (front panel) with vref */ |
| 10943 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10944 | /* port-G for CLFE (rear panel) */ |
| 10945 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10946 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10947 | /* port-H for side (rear panel) */ |
| 10948 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10949 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10950 | /* CD-in */ |
| 10951 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10952 | /* route front mic to ADC1*/ |
| 10953 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10954 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10955 | |
| 10956 | /* Unmute DAC0~3 & spdif out*/ |
| 10957 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10958 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10959 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10960 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10961 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10962 | |
| 10963 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10964 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10965 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10966 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10967 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10968 | |
| 10969 | /* Unmute Stereo Mixer 15 */ |
| 10970 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10971 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10972 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10973 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10974 | |
| 10975 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10976 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10977 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10978 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10979 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10980 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10981 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10982 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10983 | /* hp used DAC 3 (Front) */ |
| 10984 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10985 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10986 | |
| 10987 | { } |
| 10988 | }; |
| 10989 | |
| 10990 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 10991 | /* |
| 10992 | * Unmute ADC0 and set the default input to mic-in |
| 10993 | */ |
| 10994 | /* port-A for surround (rear panel) */ |
| 10995 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10996 | /* port-B for mic-in (rear panel) with vref */ |
| 10997 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10998 | /* port-C for line-in (rear panel) */ |
| 10999 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11000 | /* port-D for Front */ |
| 11001 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11002 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11003 | /* port-E for HP out (front panel) */ |
| 11004 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11005 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11006 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11007 | /* port-F for mic-in (front panel) with vref */ |
| 11008 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11009 | /* port-G for CLFE (rear panel) */ |
| 11010 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11011 | /* port-H for side (rear panel) */ |
| 11012 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11013 | /* CD-in */ |
| 11014 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11015 | /* route front mic to ADC1*/ |
| 11016 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11017 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11018 | /* Unmute DAC0~3 & spdif out*/ |
| 11019 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11020 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11021 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11022 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11023 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11024 | |
| 11025 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11026 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11027 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11028 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11029 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11030 | |
| 11031 | /* Unmute Stereo Mixer 15 */ |
| 11032 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11033 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11034 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11036 | |
| 11037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11038 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11039 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11040 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11041 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11043 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11045 | /* hp used DAC 3 (Front) */ |
| 11046 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11047 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11048 | { } |
| 11049 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11050 | |
| 11051 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11052 | /* |
| 11053 | * Unmute ADC0 and set the default input to mic-in |
| 11054 | */ |
| 11055 | /* port-A for surround (rear panel) */ |
| 11056 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11057 | /* port-B for mic-in (rear panel) with vref */ |
| 11058 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11059 | /* port-C for line-in (rear panel) */ |
| 11060 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11061 | /* port-D for Front */ |
| 11062 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11063 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11064 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11065 | /* this has to be set to VREF80 */ |
| 11066 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11067 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11068 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11069 | /* port-F for mic-in (front panel) with vref */ |
| 11070 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11071 | /* port-G for CLFE (rear panel) */ |
| 11072 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11073 | /* port-H for side (rear panel) */ |
| 11074 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11075 | /* CD-in */ |
| 11076 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11077 | /* route front mic to ADC1*/ |
| 11078 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11079 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11080 | /* Unmute DAC0~3 & spdif out*/ |
| 11081 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11082 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11083 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11084 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11085 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11086 | |
| 11087 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11088 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11089 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11090 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11091 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11092 | |
| 11093 | /* Unmute Stereo Mixer 15 */ |
| 11094 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11095 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11096 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11097 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11098 | |
| 11099 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11100 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11101 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11102 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11103 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11104 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11105 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11106 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11107 | /* hp used DAC 3 (Front) */ |
| 11108 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11109 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11110 | { } |
| 11111 | }; |
| 11112 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11113 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11114 | /* |
| 11115 | * Unmute ADC0 and set the default input to mic-in |
| 11116 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11117 | /* port-A for surround (rear panel) |
| 11118 | * according to codec#0 this is the HP jack |
| 11119 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11120 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11121 | /* route front PCM to HP */ |
| 11122 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11123 | /* port-B for mic-in (rear panel) with vref */ |
| 11124 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11125 | /* port-C for line-in (rear panel) */ |
| 11126 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11127 | /* port-D for Front */ |
| 11128 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11129 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11130 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11131 | /* this has to be set to VREF80 */ |
| 11132 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11133 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11134 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11135 | /* port-F for mic-in (front panel) with vref */ |
| 11136 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11137 | /* port-G for CLFE (rear panel) */ |
| 11138 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11139 | /* port-H for side (rear panel) */ |
| 11140 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11141 | /* CD-in */ |
| 11142 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11143 | /* route front mic to ADC1*/ |
| 11144 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11145 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11146 | /* Unmute DAC0~3 & spdif out*/ |
| 11147 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11148 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11149 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11150 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11151 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11152 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11153 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11154 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11155 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11156 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11157 | |
| 11158 | /* Unmute Stereo Mixer 15 */ |
| 11159 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11160 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11161 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11162 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11163 | |
| 11164 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11165 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11166 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11167 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11168 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11169 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11170 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11171 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11172 | /* hp used DAC 3 (Front) */ |
| 11173 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11174 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11175 | { } |
| 11176 | }; |
| 11177 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11178 | /* additional init verbs for ASUS laptops */ |
| 11179 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11180 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11181 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11182 | { } |
| 11183 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11184 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11185 | /* |
| 11186 | * generic initialization of ADC, input mixers and output mixers |
| 11187 | */ |
| 11188 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11189 | /* |
| 11190 | * Unmute ADC0 and set the default input to mic-in |
| 11191 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11192 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11193 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11194 | |
| 11195 | /* Unmute DAC0~3 & spdif out*/ |
| 11196 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11197 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11198 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11199 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11200 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11201 | |
| 11202 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11203 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11204 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11205 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11206 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11207 | |
| 11208 | /* Unmute Stereo Mixer 15 */ |
| 11209 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11211 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11212 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11213 | |
| 11214 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11215 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11216 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11217 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11218 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11219 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11220 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11221 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11222 | |
| 11223 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11224 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11225 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11226 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11227 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11228 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11229 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11230 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11231 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11232 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11233 | |
| 11234 | { } |
| 11235 | }; |
| 11236 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11237 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11238 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11239 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11240 | { } |
| 11241 | }; |
| 11242 | |
| 11243 | /* toggle speaker-output according to the hp-jack state */ |
| 11244 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11245 | { |
| 11246 | unsigned int present; |
| 11247 | |
| 11248 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11249 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11250 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11251 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11252 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11253 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11254 | } |
| 11255 | |
| 11256 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11257 | unsigned int res) |
| 11258 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11259 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11260 | alc861_toshiba_automute(codec); |
| 11261 | } |
| 11262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11263 | /* pcm configuration: identiacal with ALC880 */ |
| 11264 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11265 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11266 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11267 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11268 | |
| 11269 | |
| 11270 | #define ALC861_DIGOUT_NID 0x07 |
| 11271 | |
| 11272 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11273 | { 8, NULL } |
| 11274 | }; |
| 11275 | |
| 11276 | static hda_nid_t alc861_dac_nids[4] = { |
| 11277 | /* front, surround, clfe, side */ |
| 11278 | 0x03, 0x06, 0x05, 0x04 |
| 11279 | }; |
| 11280 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11281 | static hda_nid_t alc660_dac_nids[3] = { |
| 11282 | /* front, clfe, surround */ |
| 11283 | 0x03, 0x05, 0x06 |
| 11284 | }; |
| 11285 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11286 | static hda_nid_t alc861_adc_nids[1] = { |
| 11287 | /* ADC0-2 */ |
| 11288 | 0x08, |
| 11289 | }; |
| 11290 | |
| 11291 | static struct hda_input_mux alc861_capture_source = { |
| 11292 | .num_items = 5, |
| 11293 | .items = { |
| 11294 | { "Mic", 0x0 }, |
| 11295 | { "Front Mic", 0x3 }, |
| 11296 | { "Line", 0x1 }, |
| 11297 | { "CD", 0x4 }, |
| 11298 | { "Mixer", 0x5 }, |
| 11299 | }, |
| 11300 | }; |
| 11301 | |
| 11302 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11303 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11304 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11305 | { |
| 11306 | int i; |
| 11307 | hda_nid_t nid; |
| 11308 | |
| 11309 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11310 | for (i = 0; i < cfg->line_outs; i++) { |
| 11311 | nid = cfg->line_out_pins[i]; |
| 11312 | if (nid) { |
| 11313 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11314 | continue; |
| 11315 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11316 | } |
| 11317 | } |
| 11318 | spec->multiout.num_dacs = cfg->line_outs; |
| 11319 | return 0; |
| 11320 | } |
| 11321 | |
| 11322 | /* add playback controls from the parsed DAC table */ |
| 11323 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11324 | const struct auto_pin_cfg *cfg) |
| 11325 | { |
| 11326 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11327 | static const char *chname[4] = { |
| 11328 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11329 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11330 | hda_nid_t nid; |
| 11331 | int i, idx, err; |
| 11332 | |
| 11333 | for (i = 0; i < cfg->line_outs; i++) { |
| 11334 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11335 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11336 | continue; |
| 11337 | if (nid == 0x05) { |
| 11338 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11339 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11340 | "Center Playback Switch", |
| 11341 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11342 | HDA_OUTPUT)); |
| 11343 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11344 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11345 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11346 | "LFE Playback Switch", |
| 11347 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11348 | HDA_OUTPUT)); |
| 11349 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11350 | return err; |
| 11351 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11352 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11353 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11354 | if (nid == alc861_dac_nids[idx]) |
| 11355 | break; |
| 11356 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11357 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11358 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11359 | HDA_OUTPUT)); |
| 11360 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11361 | return err; |
| 11362 | } |
| 11363 | } |
| 11364 | return 0; |
| 11365 | } |
| 11366 | |
| 11367 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11368 | { |
| 11369 | int err; |
| 11370 | hda_nid_t nid; |
| 11371 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11372 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11373 | return 0; |
| 11374 | |
| 11375 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11376 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11377 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11378 | "Headphone Playback Switch", |
| 11379 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11380 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11381 | return err; |
| 11382 | spec->multiout.hp_nid = nid; |
| 11383 | } |
| 11384 | return 0; |
| 11385 | } |
| 11386 | |
| 11387 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11388 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11389 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11390 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11391 | struct hda_input_mux *imux = &spec->private_imux; |
| 11392 | int i, err, idx, idx1; |
| 11393 | |
| 11394 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11395 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11396 | case 0x0c: |
| 11397 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11398 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11399 | break; |
| 11400 | case 0x0f: |
| 11401 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11402 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11403 | break; |
| 11404 | case 0x0d: |
| 11405 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11406 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11407 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11408 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11409 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11410 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11411 | break; |
| 11412 | case 0x11: |
| 11413 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11414 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11415 | break; |
| 11416 | default: |
| 11417 | continue; |
| 11418 | } |
| 11419 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11420 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11421 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11422 | if (err < 0) |
| 11423 | return err; |
| 11424 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11425 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11426 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11427 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11428 | } |
| 11429 | return 0; |
| 11430 | } |
| 11431 | |
| 11432 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11433 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11434 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11435 | |
| 11436 | { |
| 11437 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11438 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11439 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11440 | */ |
| 11441 | /* .name = "Capture Source", */ |
| 11442 | .name = "Input Source", |
| 11443 | .count = 1, |
| 11444 | .info = alc_mux_enum_info, |
| 11445 | .get = alc_mux_enum_get, |
| 11446 | .put = alc_mux_enum_put, |
| 11447 | }, |
| 11448 | { } /* end */ |
| 11449 | }; |
| 11450 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11451 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11452 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11453 | int pin_type, int dac_idx) |
| 11454 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11455 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11456 | } |
| 11457 | |
| 11458 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11459 | { |
| 11460 | struct alc_spec *spec = codec->spec; |
| 11461 | int i; |
| 11462 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11463 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11464 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11465 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11466 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11467 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11468 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11469 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11470 | } |
| 11471 | } |
| 11472 | |
| 11473 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11474 | { |
| 11475 | struct alc_spec *spec = codec->spec; |
| 11476 | hda_nid_t pin; |
| 11477 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11478 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11479 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11480 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11481 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11482 | pin = spec->autocfg.speaker_pins[0]; |
| 11483 | if (pin) |
| 11484 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11485 | } |
| 11486 | |
| 11487 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11488 | { |
| 11489 | struct alc_spec *spec = codec->spec; |
| 11490 | int i; |
| 11491 | |
| 11492 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11493 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11494 | if (nid >= 0x0c && nid <= 0x11) { |
| 11495 | snd_hda_codec_write(codec, nid, 0, |
| 11496 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11497 | i <= AUTO_PIN_FRONT_MIC ? |
| 11498 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11499 | } |
| 11500 | } |
| 11501 | } |
| 11502 | |
| 11503 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11504 | /* return 1 if successful, 0 if the proper config is not found, |
| 11505 | * or a negative error code |
| 11506 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11507 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11508 | { |
| 11509 | struct alc_spec *spec = codec->spec; |
| 11510 | int err; |
| 11511 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11512 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11513 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11514 | alc861_ignore); |
| 11515 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11516 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11517 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11518 | return 0; /* can't find valid BIOS pin config */ |
| 11519 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11520 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11521 | if (err < 0) |
| 11522 | return err; |
| 11523 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11524 | if (err < 0) |
| 11525 | return err; |
| 11526 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11527 | if (err < 0) |
| 11528 | return err; |
| 11529 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11530 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11531 | return err; |
| 11532 | |
| 11533 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11534 | |
| 11535 | if (spec->autocfg.dig_out_pin) |
| 11536 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11537 | |
| 11538 | if (spec->kctl_alloc) |
| 11539 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11540 | |
| 11541 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11542 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11543 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11544 | spec->input_mux = &spec->private_imux; |
| 11545 | |
| 11546 | spec->adc_nids = alc861_adc_nids; |
| 11547 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11548 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11549 | spec->num_mixers++; |
| 11550 | |
| 11551 | return 1; |
| 11552 | } |
| 11553 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11554 | /* additional initialization for auto-configuration model */ |
| 11555 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11556 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11557 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11558 | alc861_auto_init_multi_out(codec); |
| 11559 | alc861_auto_init_hp_out(codec); |
| 11560 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11561 | if (spec->unsol_event) |
| 11562 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11563 | } |
| 11564 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11565 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11566 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11567 | { 0x15, HDA_INPUT, 0 }, |
| 11568 | { 0x15, HDA_INPUT, 1 }, |
| 11569 | { 0x15, HDA_INPUT, 2 }, |
| 11570 | { 0x15, HDA_INPUT, 3 }, |
| 11571 | { } /* end */ |
| 11572 | }; |
| 11573 | #endif |
| 11574 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11575 | |
| 11576 | /* |
| 11577 | * configuration and preset |
| 11578 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11579 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11580 | [ALC861_3ST] = "3stack", |
| 11581 | [ALC660_3ST] = "3stack-660", |
| 11582 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11583 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11584 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11585 | [ALC861_TOSHIBA] = "toshiba", |
| 11586 | [ALC861_ASUS] = "asus", |
| 11587 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11588 | [ALC861_AUTO] = "auto", |
| 11589 | }; |
| 11590 | |
| 11591 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11592 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11593 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11594 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11595 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11596 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11597 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11598 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11599 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11600 | * Any other models that need this preset? |
| 11601 | */ |
| 11602 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11603 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11604 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11605 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11606 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11607 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11608 | /* FIXME: the below seems conflict */ |
| 11609 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11610 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11611 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11612 | {} |
| 11613 | }; |
| 11614 | |
| 11615 | static struct alc_config_preset alc861_presets[] = { |
| 11616 | [ALC861_3ST] = { |
| 11617 | .mixers = { alc861_3ST_mixer }, |
| 11618 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11619 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11620 | .dac_nids = alc861_dac_nids, |
| 11621 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11622 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11623 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11624 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11625 | .adc_nids = alc861_adc_nids, |
| 11626 | .input_mux = &alc861_capture_source, |
| 11627 | }, |
| 11628 | [ALC861_3ST_DIG] = { |
| 11629 | .mixers = { alc861_base_mixer }, |
| 11630 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11631 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11632 | .dac_nids = alc861_dac_nids, |
| 11633 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11634 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11635 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11636 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11637 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11638 | .adc_nids = alc861_adc_nids, |
| 11639 | .input_mux = &alc861_capture_source, |
| 11640 | }, |
| 11641 | [ALC861_6ST_DIG] = { |
| 11642 | .mixers = { alc861_base_mixer }, |
| 11643 | .init_verbs = { alc861_base_init_verbs }, |
| 11644 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11645 | .dac_nids = alc861_dac_nids, |
| 11646 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11647 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11648 | .channel_mode = alc861_8ch_modes, |
| 11649 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11650 | .adc_nids = alc861_adc_nids, |
| 11651 | .input_mux = &alc861_capture_source, |
| 11652 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11653 | [ALC660_3ST] = { |
| 11654 | .mixers = { alc861_3ST_mixer }, |
| 11655 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11656 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11657 | .dac_nids = alc660_dac_nids, |
| 11658 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11659 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11660 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11661 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11662 | .adc_nids = alc861_adc_nids, |
| 11663 | .input_mux = &alc861_capture_source, |
| 11664 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11665 | [ALC861_UNIWILL_M31] = { |
| 11666 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11667 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11668 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11669 | .dac_nids = alc861_dac_nids, |
| 11670 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11671 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11672 | .channel_mode = alc861_uniwill_m31_modes, |
| 11673 | .need_dac_fix = 1, |
| 11674 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11675 | .adc_nids = alc861_adc_nids, |
| 11676 | .input_mux = &alc861_capture_source, |
| 11677 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11678 | [ALC861_TOSHIBA] = { |
| 11679 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11680 | .init_verbs = { alc861_base_init_verbs, |
| 11681 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11682 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11683 | .dac_nids = alc861_dac_nids, |
| 11684 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11685 | .channel_mode = alc883_3ST_2ch_modes, |
| 11686 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11687 | .adc_nids = alc861_adc_nids, |
| 11688 | .input_mux = &alc861_capture_source, |
| 11689 | .unsol_event = alc861_toshiba_unsol_event, |
| 11690 | .init_hook = alc861_toshiba_automute, |
| 11691 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11692 | [ALC861_ASUS] = { |
| 11693 | .mixers = { alc861_asus_mixer }, |
| 11694 | .init_verbs = { alc861_asus_init_verbs }, |
| 11695 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11696 | .dac_nids = alc861_dac_nids, |
| 11697 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11698 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11699 | .channel_mode = alc861_asus_modes, |
| 11700 | .need_dac_fix = 1, |
| 11701 | .hp_nid = 0x06, |
| 11702 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11703 | .adc_nids = alc861_adc_nids, |
| 11704 | .input_mux = &alc861_capture_source, |
| 11705 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11706 | [ALC861_ASUS_LAPTOP] = { |
| 11707 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11708 | .init_verbs = { alc861_asus_init_verbs, |
| 11709 | alc861_asus_laptop_init_verbs }, |
| 11710 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11711 | .dac_nids = alc861_dac_nids, |
| 11712 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11713 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11714 | .channel_mode = alc883_3ST_2ch_modes, |
| 11715 | .need_dac_fix = 1, |
| 11716 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11717 | .adc_nids = alc861_adc_nids, |
| 11718 | .input_mux = &alc861_capture_source, |
| 11719 | }, |
| 11720 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11721 | |
| 11722 | |
| 11723 | static int patch_alc861(struct hda_codec *codec) |
| 11724 | { |
| 11725 | struct alc_spec *spec; |
| 11726 | int board_config; |
| 11727 | int err; |
| 11728 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11730 | if (spec == NULL) |
| 11731 | return -ENOMEM; |
| 11732 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11733 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11734 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11735 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11736 | alc861_models, |
| 11737 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11738 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11739 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11740 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11741 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11742 | board_config = ALC861_AUTO; |
| 11743 | } |
| 11744 | |
| 11745 | if (board_config == ALC861_AUTO) { |
| 11746 | /* automatic parse from the BIOS config */ |
| 11747 | err = alc861_parse_auto_config(codec); |
| 11748 | if (err < 0) { |
| 11749 | alc_free(codec); |
| 11750 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11751 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11752 | printk(KERN_INFO |
| 11753 | "hda_codec: Cannot set up configuration " |
| 11754 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11755 | board_config = ALC861_3ST_DIG; |
| 11756 | } |
| 11757 | } |
| 11758 | |
| 11759 | if (board_config != ALC861_AUTO) |
| 11760 | setup_preset(spec, &alc861_presets[board_config]); |
| 11761 | |
| 11762 | spec->stream_name_analog = "ALC861 Analog"; |
| 11763 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11764 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11765 | |
| 11766 | spec->stream_name_digital = "ALC861 Digital"; |
| 11767 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11768 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11769 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11770 | spec->vmaster_nid = 0x03; |
| 11771 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11772 | codec->patch_ops = alc_patch_ops; |
| 11773 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11774 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11775 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11776 | if (!spec->loopback.amplist) |
| 11777 | spec->loopback.amplist = alc861_loopbacks; |
| 11778 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11779 | |
| 11780 | return 0; |
| 11781 | } |
| 11782 | |
| 11783 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11784 | * ALC861-VD support |
| 11785 | * |
| 11786 | * Based on ALC882 |
| 11787 | * |
| 11788 | * In addition, an independent DAC |
| 11789 | */ |
| 11790 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11791 | |
| 11792 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11793 | /* front, surr, clfe, side surr */ |
| 11794 | 0x02, 0x03, 0x04, 0x05 |
| 11795 | }; |
| 11796 | |
| 11797 | /* dac_nids for ALC660vd are in a different order - according to |
| 11798 | * Realtek's driver. |
| 11799 | * This should probably tesult in a different mixer for 6stack models |
| 11800 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11801 | * - and it is the same as in 861vd. |
| 11802 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11803 | */ |
| 11804 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11805 | /* front, rear, clfe, rear_surr */ |
| 11806 | 0x02, 0x04, 0x03 |
| 11807 | }; |
| 11808 | |
| 11809 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11810 | /* ADC0 */ |
| 11811 | 0x09, |
| 11812 | }; |
| 11813 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11814 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 11815 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11816 | /* input MUX */ |
| 11817 | /* FIXME: should be a matrix-type input source selection */ |
| 11818 | static struct hda_input_mux alc861vd_capture_source = { |
| 11819 | .num_items = 4, |
| 11820 | .items = { |
| 11821 | { "Mic", 0x0 }, |
| 11822 | { "Front Mic", 0x1 }, |
| 11823 | { "Line", 0x2 }, |
| 11824 | { "CD", 0x4 }, |
| 11825 | }, |
| 11826 | }; |
| 11827 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11828 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11829 | .num_items = 3, |
| 11830 | .items = { |
| 11831 | { "Front Mic", 0x0 }, |
| 11832 | { "ATAPI Mic", 0x1 }, |
| 11833 | { "Line In", 0x5 }, |
| 11834 | }, |
| 11835 | }; |
| 11836 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11837 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11838 | .num_items = 2, |
| 11839 | .items = { |
| 11840 | { "Front Mic", 0x0 }, |
| 11841 | { "ATAPI Mic", 0x1 }, |
| 11842 | }, |
| 11843 | }; |
| 11844 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11845 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11846 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11847 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 11848 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11849 | |
| 11850 | /* |
| 11851 | * 2ch mode |
| 11852 | */ |
| 11853 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11854 | { 2, NULL } |
| 11855 | }; |
| 11856 | |
| 11857 | /* |
| 11858 | * 6ch mode |
| 11859 | */ |
| 11860 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11861 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11862 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11863 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11864 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11865 | { } /* end */ |
| 11866 | }; |
| 11867 | |
| 11868 | /* |
| 11869 | * 8ch mode |
| 11870 | */ |
| 11871 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11872 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11873 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11874 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11875 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11876 | { } /* end */ |
| 11877 | }; |
| 11878 | |
| 11879 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11880 | { 6, alc861vd_6stack_ch6_init }, |
| 11881 | { 8, alc861vd_6stack_ch8_init }, |
| 11882 | }; |
| 11883 | |
| 11884 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11885 | { |
| 11886 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11887 | .name = "Channel Mode", |
| 11888 | .info = alc_ch_mode_info, |
| 11889 | .get = alc_ch_mode_get, |
| 11890 | .put = alc_ch_mode_put, |
| 11891 | }, |
| 11892 | { } /* end */ |
| 11893 | }; |
| 11894 | |
| 11895 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11896 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11897 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11898 | |
| 11899 | { |
| 11900 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11901 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11902 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11903 | */ |
| 11904 | /* .name = "Capture Source", */ |
| 11905 | .name = "Input Source", |
| 11906 | .count = 1, |
| 11907 | .info = alc861vd_mux_enum_info, |
| 11908 | .get = alc861vd_mux_enum_get, |
| 11909 | .put = alc861vd_mux_enum_put, |
| 11910 | }, |
| 11911 | { } /* end */ |
| 11912 | }; |
| 11913 | |
| 11914 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11915 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11916 | */ |
| 11917 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11919 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11920 | |
| 11921 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11922 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11923 | |
| 11924 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11925 | HDA_OUTPUT), |
| 11926 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11927 | HDA_OUTPUT), |
| 11928 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11929 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11930 | |
| 11931 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11932 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11933 | |
| 11934 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11935 | |
| 11936 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11937 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11938 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11939 | |
| 11940 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11941 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11942 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11943 | |
| 11944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11945 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11946 | |
| 11947 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11948 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11949 | |
| 11950 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11951 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11952 | |
| 11953 | { } /* end */ |
| 11954 | }; |
| 11955 | |
| 11956 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11957 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11958 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11959 | |
| 11960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11961 | |
| 11962 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11965 | |
| 11966 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11967 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11968 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11969 | |
| 11970 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11971 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11972 | |
| 11973 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11974 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11975 | |
| 11976 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11977 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11978 | |
| 11979 | { } /* end */ |
| 11980 | }; |
| 11981 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11982 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 11983 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11984 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 11985 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11986 | |
| 11987 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11988 | |
| 11989 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11990 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11991 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11992 | |
| 11993 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11996 | |
| 11997 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11998 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11999 | |
| 12000 | { } /* end */ |
| 12001 | }; |
| 12002 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12003 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 12004 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 12005 | */ |
| 12006 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 12007 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12008 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12009 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12010 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12011 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12012 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12013 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12014 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12015 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12016 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12017 | { } /* end */ |
| 12018 | }; |
| 12019 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12020 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12021 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12022 | */ |
| 12023 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12024 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12025 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12026 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12027 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12028 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12029 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12030 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12031 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12032 | |
| 12033 | { } /* end */ |
| 12034 | }; |
| 12035 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12036 | /* |
| 12037 | * generic initialization of ADC, input mixers and output mixers |
| 12038 | */ |
| 12039 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12040 | /* |
| 12041 | * Unmute ADC0 and set the default input to mic-in |
| 12042 | */ |
| 12043 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12044 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12045 | |
| 12046 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12047 | * the analog-loopback mixer widget |
| 12048 | */ |
| 12049 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12050 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12051 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12052 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12053 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12054 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12055 | |
| 12056 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12057 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12058 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12059 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12060 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12061 | |
| 12062 | /* |
| 12063 | * Set up output mixers (0x02 - 0x05) |
| 12064 | */ |
| 12065 | /* set vol=0 to output mixers */ |
| 12066 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12067 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12068 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12069 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12070 | |
| 12071 | /* set up input amps for analog loopback */ |
| 12072 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12073 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12074 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12075 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12076 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12077 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12078 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12079 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12080 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12081 | |
| 12082 | { } |
| 12083 | }; |
| 12084 | |
| 12085 | /* |
| 12086 | * 3-stack pin configuration: |
| 12087 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12088 | */ |
| 12089 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12090 | /* |
| 12091 | * Set pin mode and muting |
| 12092 | */ |
| 12093 | /* set front pin widgets 0x14 for output */ |
| 12094 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12095 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12096 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12097 | |
| 12098 | /* Mic (rear) pin: input vref at 80% */ |
| 12099 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12100 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12101 | /* Front Mic pin: input vref at 80% */ |
| 12102 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12103 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12104 | /* Line In pin: input */ |
| 12105 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12106 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12107 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12108 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12109 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12110 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12111 | /* CD pin widget for input */ |
| 12112 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12113 | |
| 12114 | { } |
| 12115 | }; |
| 12116 | |
| 12117 | /* |
| 12118 | * 6-stack pin configuration: |
| 12119 | */ |
| 12120 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12121 | /* |
| 12122 | * Set pin mode and muting |
| 12123 | */ |
| 12124 | /* set front pin widgets 0x14 for output */ |
| 12125 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12126 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12127 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12128 | |
| 12129 | /* Rear Pin: output 1 (0x0d) */ |
| 12130 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12132 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12133 | /* CLFE Pin: output 2 (0x0e) */ |
| 12134 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12135 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12136 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12137 | /* Side Pin: output 3 (0x0f) */ |
| 12138 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12140 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12141 | |
| 12142 | /* Mic (rear) pin: input vref at 80% */ |
| 12143 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12144 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12145 | /* Front Mic pin: input vref at 80% */ |
| 12146 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12147 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12148 | /* Line In pin: input */ |
| 12149 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12150 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12151 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12152 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12153 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12154 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12155 | /* CD pin widget for input */ |
| 12156 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12157 | |
| 12158 | { } |
| 12159 | }; |
| 12160 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12161 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12162 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12163 | { } |
| 12164 | }; |
| 12165 | |
| 12166 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12167 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12168 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12169 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12170 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12171 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12172 | {} |
| 12173 | }; |
| 12174 | |
| 12175 | /* toggle speaker-output according to the hp-jack state */ |
| 12176 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12177 | { |
| 12178 | unsigned int present; |
| 12179 | unsigned char bits; |
| 12180 | |
| 12181 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12182 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12183 | bits = present ? HDA_AMP_MUTE : 0; |
| 12184 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12185 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12186 | } |
| 12187 | |
| 12188 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12189 | { |
| 12190 | unsigned int present; |
| 12191 | unsigned char bits; |
| 12192 | |
| 12193 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12194 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12195 | bits = present ? HDA_AMP_MUTE : 0; |
| 12196 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12197 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12198 | } |
| 12199 | |
| 12200 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12201 | { |
| 12202 | alc861vd_lenovo_hp_automute(codec); |
| 12203 | alc861vd_lenovo_mic_automute(codec); |
| 12204 | } |
| 12205 | |
| 12206 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12207 | unsigned int res) |
| 12208 | { |
| 12209 | switch (res >> 26) { |
| 12210 | case ALC880_HP_EVENT: |
| 12211 | alc861vd_lenovo_hp_automute(codec); |
| 12212 | break; |
| 12213 | case ALC880_MIC_EVENT: |
| 12214 | alc861vd_lenovo_mic_automute(codec); |
| 12215 | break; |
| 12216 | } |
| 12217 | } |
| 12218 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12219 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12220 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12221 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12222 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12223 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12224 | |
| 12225 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12226 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12227 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12228 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12229 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12230 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12231 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12232 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12233 | |
| 12234 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12235 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12236 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12237 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12238 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12239 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12240 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12241 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12242 | |
| 12243 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12244 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12245 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12246 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12247 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12248 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12249 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12250 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12251 | |
| 12252 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12253 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12254 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12255 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12256 | |
| 12257 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12258 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12259 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12260 | |
| 12261 | { } /* end */ |
| 12262 | }; |
| 12263 | |
| 12264 | /* toggle speaker-output according to the hp-jack state */ |
| 12265 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12266 | { |
| 12267 | unsigned int present; |
| 12268 | |
| 12269 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12270 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12271 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12272 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12273 | } |
| 12274 | |
| 12275 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12276 | { |
| 12277 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12278 | alc861vd_dallas_automute(codec); |
| 12279 | } |
| 12280 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12281 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12282 | #define alc861vd_loopbacks alc880_loopbacks |
| 12283 | #endif |
| 12284 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12285 | /* pcm configuration: identiacal with ALC880 */ |
| 12286 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12287 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12288 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12289 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12290 | |
| 12291 | /* |
| 12292 | * configuration and preset |
| 12293 | */ |
| 12294 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12295 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12296 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12297 | [ALC861VD_3ST] = "3stack", |
| 12298 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12299 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12300 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12301 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12302 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12303 | [ALC861VD_AUTO] = "auto", |
| 12304 | }; |
| 12305 | |
| 12306 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12307 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12308 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12309 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12310 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12311 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12312 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12313 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12314 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12315 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12316 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12317 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12318 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12319 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12320 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12321 | {} |
| 12322 | }; |
| 12323 | |
| 12324 | static struct alc_config_preset alc861vd_presets[] = { |
| 12325 | [ALC660VD_3ST] = { |
| 12326 | .mixers = { alc861vd_3st_mixer }, |
| 12327 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12328 | alc861vd_3stack_init_verbs }, |
| 12329 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12330 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12331 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12332 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12333 | .input_mux = &alc861vd_capture_source, |
| 12334 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12335 | [ALC660VD_3ST_DIG] = { |
| 12336 | .mixers = { alc861vd_3st_mixer }, |
| 12337 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12338 | alc861vd_3stack_init_verbs }, |
| 12339 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12340 | .dac_nids = alc660vd_dac_nids, |
| 12341 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12342 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12343 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12344 | .input_mux = &alc861vd_capture_source, |
| 12345 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12346 | [ALC861VD_3ST] = { |
| 12347 | .mixers = { alc861vd_3st_mixer }, |
| 12348 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12349 | alc861vd_3stack_init_verbs }, |
| 12350 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12351 | .dac_nids = alc861vd_dac_nids, |
| 12352 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12353 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12354 | .input_mux = &alc861vd_capture_source, |
| 12355 | }, |
| 12356 | [ALC861VD_3ST_DIG] = { |
| 12357 | .mixers = { alc861vd_3st_mixer }, |
| 12358 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12359 | alc861vd_3stack_init_verbs }, |
| 12360 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12361 | .dac_nids = alc861vd_dac_nids, |
| 12362 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12363 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12364 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12365 | .input_mux = &alc861vd_capture_source, |
| 12366 | }, |
| 12367 | [ALC861VD_6ST_DIG] = { |
| 12368 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12369 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12370 | alc861vd_6stack_init_verbs }, |
| 12371 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12372 | .dac_nids = alc861vd_dac_nids, |
| 12373 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12374 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12375 | .channel_mode = alc861vd_6stack_modes, |
| 12376 | .input_mux = &alc861vd_capture_source, |
| 12377 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12378 | [ALC861VD_LENOVO] = { |
| 12379 | .mixers = { alc861vd_lenovo_mixer }, |
| 12380 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12381 | alc861vd_3stack_init_verbs, |
| 12382 | alc861vd_eapd_verbs, |
| 12383 | alc861vd_lenovo_unsol_verbs }, |
| 12384 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12385 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12386 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12387 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12388 | .input_mux = &alc861vd_capture_source, |
| 12389 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12390 | .init_hook = alc861vd_lenovo_automute, |
| 12391 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12392 | [ALC861VD_DALLAS] = { |
| 12393 | .mixers = { alc861vd_dallas_mixer }, |
| 12394 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12395 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12396 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12397 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12398 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12399 | .input_mux = &alc861vd_dallas_capture_source, |
| 12400 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12401 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12402 | }, |
| 12403 | [ALC861VD_HP] = { |
| 12404 | .mixers = { alc861vd_hp_mixer }, |
| 12405 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12406 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12407 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12408 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12409 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12410 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12411 | .input_mux = &alc861vd_hp_capture_source, |
| 12412 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12413 | .init_hook = alc861vd_dallas_automute, |
| 12414 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12415 | }; |
| 12416 | |
| 12417 | /* |
| 12418 | * BIOS auto configuration |
| 12419 | */ |
| 12420 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12421 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12422 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12423 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12424 | } |
| 12425 | |
| 12426 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12427 | { |
| 12428 | struct alc_spec *spec = codec->spec; |
| 12429 | int i; |
| 12430 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12431 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12432 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12433 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12434 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12435 | if (nid) |
| 12436 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12437 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12438 | } |
| 12439 | } |
| 12440 | |
| 12441 | |
| 12442 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12443 | { |
| 12444 | struct alc_spec *spec = codec->spec; |
| 12445 | hda_nid_t pin; |
| 12446 | |
| 12447 | pin = spec->autocfg.hp_pins[0]; |
| 12448 | if (pin) /* connect to front and use dac 0 */ |
| 12449 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12450 | pin = spec->autocfg.speaker_pins[0]; |
| 12451 | if (pin) |
| 12452 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12453 | } |
| 12454 | |
| 12455 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12456 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12457 | |
| 12458 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12459 | { |
| 12460 | struct alc_spec *spec = codec->spec; |
| 12461 | int i; |
| 12462 | |
| 12463 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12464 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12465 | if (alc861vd_is_input_pin(nid)) { |
| 12466 | snd_hda_codec_write(codec, nid, 0, |
| 12467 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12468 | i <= AUTO_PIN_FRONT_MIC ? |
| 12469 | PIN_VREF80 : PIN_IN); |
| 12470 | if (nid != ALC861VD_PIN_CD_NID) |
| 12471 | snd_hda_codec_write(codec, nid, 0, |
| 12472 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12473 | AMP_OUT_MUTE); |
| 12474 | } |
| 12475 | } |
| 12476 | } |
| 12477 | |
| 12478 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12479 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12480 | |
| 12481 | /* add playback controls from the parsed DAC table */ |
| 12482 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12483 | * different NIDs for mute/unmute switch and volume control */ |
| 12484 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12485 | const struct auto_pin_cfg *cfg) |
| 12486 | { |
| 12487 | char name[32]; |
| 12488 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12489 | hda_nid_t nid_v, nid_s; |
| 12490 | int i, err; |
| 12491 | |
| 12492 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12493 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12494 | continue; |
| 12495 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12496 | alc880_dac_to_idx( |
| 12497 | spec->multiout.dac_nids[i])); |
| 12498 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12499 | alc880_dac_to_idx( |
| 12500 | spec->multiout.dac_nids[i])); |
| 12501 | |
| 12502 | if (i == 2) { |
| 12503 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12504 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12505 | "Center Playback Volume", |
| 12506 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12507 | HDA_OUTPUT)); |
| 12508 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12509 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12510 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12511 | "LFE Playback Volume", |
| 12512 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12513 | HDA_OUTPUT)); |
| 12514 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12515 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12516 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12517 | "Center Playback Switch", |
| 12518 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12519 | HDA_INPUT)); |
| 12520 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12521 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12522 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12523 | "LFE Playback Switch", |
| 12524 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12525 | HDA_INPUT)); |
| 12526 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12527 | return err; |
| 12528 | } else { |
| 12529 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12530 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12531 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12532 | HDA_OUTPUT)); |
| 12533 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12534 | return err; |
| 12535 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12536 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12537 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12538 | HDA_INPUT)); |
| 12539 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12540 | return err; |
| 12541 | } |
| 12542 | } |
| 12543 | return 0; |
| 12544 | } |
| 12545 | |
| 12546 | /* add playback controls for speaker and HP outputs */ |
| 12547 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12548 | * different NIDs for mute/unmute switch and volume control */ |
| 12549 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12550 | hda_nid_t pin, const char *pfx) |
| 12551 | { |
| 12552 | hda_nid_t nid_v, nid_s; |
| 12553 | int err; |
| 12554 | char name[32]; |
| 12555 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12556 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12557 | return 0; |
| 12558 | |
| 12559 | if (alc880_is_fixed_pin(pin)) { |
| 12560 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12561 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12562 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12563 | spec->multiout.hp_nid = nid_v; |
| 12564 | else |
| 12565 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12566 | /* control HP volume/switch on the output mixer amp */ |
| 12567 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12568 | alc880_fixed_pin_idx(pin)); |
| 12569 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12570 | alc880_fixed_pin_idx(pin)); |
| 12571 | |
| 12572 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12573 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12574 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12575 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12576 | return err; |
| 12577 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12578 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12579 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12580 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12581 | return err; |
| 12582 | } else if (alc880_is_multi_pin(pin)) { |
| 12583 | /* set manual connection */ |
| 12584 | /* we have only a switch on HP-out PIN */ |
| 12585 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12586 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12587 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12588 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12589 | return err; |
| 12590 | } |
| 12591 | return 0; |
| 12592 | } |
| 12593 | |
| 12594 | /* parse the BIOS configuration and set up the alc_spec |
| 12595 | * return 1 if successful, 0 if the proper config is not found, |
| 12596 | * or a negative error code |
| 12597 | * Based on ALC880 version - had to change it to override |
| 12598 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12599 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12600 | { |
| 12601 | struct alc_spec *spec = codec->spec; |
| 12602 | int err; |
| 12603 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12604 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12605 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12606 | alc861vd_ignore); |
| 12607 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12608 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12609 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12610 | return 0; /* can't find valid BIOS pin config */ |
| 12611 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12612 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12613 | if (err < 0) |
| 12614 | return err; |
| 12615 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12616 | if (err < 0) |
| 12617 | return err; |
| 12618 | err = alc861vd_auto_create_extra_out(spec, |
| 12619 | spec->autocfg.speaker_pins[0], |
| 12620 | "Speaker"); |
| 12621 | if (err < 0) |
| 12622 | return err; |
| 12623 | err = alc861vd_auto_create_extra_out(spec, |
| 12624 | spec->autocfg.hp_pins[0], |
| 12625 | "Headphone"); |
| 12626 | if (err < 0) |
| 12627 | return err; |
| 12628 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12629 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12630 | return err; |
| 12631 | |
| 12632 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12633 | |
| 12634 | if (spec->autocfg.dig_out_pin) |
| 12635 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12636 | |
| 12637 | if (spec->kctl_alloc) |
| 12638 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12639 | |
| 12640 | spec->init_verbs[spec->num_init_verbs++] |
| 12641 | = alc861vd_volume_init_verbs; |
| 12642 | |
| 12643 | spec->num_mux_defs = 1; |
| 12644 | spec->input_mux = &spec->private_imux; |
| 12645 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12646 | err = alc_auto_add_mic_boost(codec); |
| 12647 | if (err < 0) |
| 12648 | return err; |
| 12649 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12650 | return 1; |
| 12651 | } |
| 12652 | |
| 12653 | /* additional initialization for auto-configuration model */ |
| 12654 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12655 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12656 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12657 | alc861vd_auto_init_multi_out(codec); |
| 12658 | alc861vd_auto_init_hp_out(codec); |
| 12659 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12660 | if (spec->unsol_event) |
| 12661 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12662 | } |
| 12663 | |
| 12664 | static int patch_alc861vd(struct hda_codec *codec) |
| 12665 | { |
| 12666 | struct alc_spec *spec; |
| 12667 | int err, board_config; |
| 12668 | |
| 12669 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12670 | if (spec == NULL) |
| 12671 | return -ENOMEM; |
| 12672 | |
| 12673 | codec->spec = spec; |
| 12674 | |
| 12675 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12676 | alc861vd_models, |
| 12677 | alc861vd_cfg_tbl); |
| 12678 | |
| 12679 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12680 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12681 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12682 | board_config = ALC861VD_AUTO; |
| 12683 | } |
| 12684 | |
| 12685 | if (board_config == ALC861VD_AUTO) { |
| 12686 | /* automatic parse from the BIOS config */ |
| 12687 | err = alc861vd_parse_auto_config(codec); |
| 12688 | if (err < 0) { |
| 12689 | alc_free(codec); |
| 12690 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12691 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12692 | printk(KERN_INFO |
| 12693 | "hda_codec: Cannot set up configuration " |
| 12694 | "from BIOS. Using base mode...\n"); |
| 12695 | board_config = ALC861VD_3ST; |
| 12696 | } |
| 12697 | } |
| 12698 | |
| 12699 | if (board_config != ALC861VD_AUTO) |
| 12700 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12701 | |
| 12702 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12703 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12704 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12705 | |
| 12706 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12707 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12708 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12709 | |
| 12710 | spec->adc_nids = alc861vd_adc_nids; |
| 12711 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12712 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12713 | |
| 12714 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12715 | spec->num_mixers++; |
| 12716 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12717 | spec->vmaster_nid = 0x02; |
| 12718 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12719 | codec->patch_ops = alc_patch_ops; |
| 12720 | |
| 12721 | if (board_config == ALC861VD_AUTO) |
| 12722 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12723 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12724 | if (!spec->loopback.amplist) |
| 12725 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12726 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12727 | |
| 12728 | return 0; |
| 12729 | } |
| 12730 | |
| 12731 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12732 | * ALC662 support |
| 12733 | * |
| 12734 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12735 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12736 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12737 | * 6-channel independent captures. |
| 12738 | * |
| 12739 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12740 | * driver yet). |
| 12741 | */ |
| 12742 | #define ALC662_DIGOUT_NID 0x06 |
| 12743 | #define ALC662_DIGIN_NID 0x0a |
| 12744 | |
| 12745 | static hda_nid_t alc662_dac_nids[4] = { |
| 12746 | /* front, rear, clfe, rear_surr */ |
| 12747 | 0x02, 0x03, 0x04 |
| 12748 | }; |
| 12749 | |
| 12750 | static hda_nid_t alc662_adc_nids[1] = { |
| 12751 | /* ADC1-2 */ |
| 12752 | 0x09, |
| 12753 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12754 | |
| 12755 | static hda_nid_t alc662_capsrc_nids[1] = { 0x23 }; |
| 12756 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12757 | /* input MUX */ |
| 12758 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12759 | static struct hda_input_mux alc662_capture_source = { |
| 12760 | .num_items = 4, |
| 12761 | .items = { |
| 12762 | { "Mic", 0x0 }, |
| 12763 | { "Front Mic", 0x1 }, |
| 12764 | { "Line", 0x2 }, |
| 12765 | { "CD", 0x4 }, |
| 12766 | }, |
| 12767 | }; |
| 12768 | |
| 12769 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12770 | .num_items = 2, |
| 12771 | .items = { |
| 12772 | { "Mic", 0x1 }, |
| 12773 | { "Line", 0x2 }, |
| 12774 | }, |
| 12775 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12776 | |
| 12777 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12778 | .num_items = 2, |
| 12779 | .items = { |
| 12780 | { "i-Mic", 0x1 }, |
| 12781 | { "e-Mic", 0x0 }, |
| 12782 | }, |
| 12783 | }; |
| 12784 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12785 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12786 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12787 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12788 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12789 | /* |
| 12790 | * 2ch mode |
| 12791 | */ |
| 12792 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12793 | { 2, NULL } |
| 12794 | }; |
| 12795 | |
| 12796 | /* |
| 12797 | * 2ch mode |
| 12798 | */ |
| 12799 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12800 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12801 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12802 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12803 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12804 | { } /* end */ |
| 12805 | }; |
| 12806 | |
| 12807 | /* |
| 12808 | * 6ch mode |
| 12809 | */ |
| 12810 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12811 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12812 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12813 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12814 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12815 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12816 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12817 | { } /* end */ |
| 12818 | }; |
| 12819 | |
| 12820 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12821 | { 2, alc662_3ST_ch2_init }, |
| 12822 | { 6, alc662_3ST_ch6_init }, |
| 12823 | }; |
| 12824 | |
| 12825 | /* |
| 12826 | * 2ch mode |
| 12827 | */ |
| 12828 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12829 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12830 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12831 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12832 | { } /* end */ |
| 12833 | }; |
| 12834 | |
| 12835 | /* |
| 12836 | * 6ch mode |
| 12837 | */ |
| 12838 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12839 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12840 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12841 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12842 | { } /* end */ |
| 12843 | }; |
| 12844 | |
| 12845 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12846 | { 2, alc662_sixstack_ch6_init }, |
| 12847 | { 6, alc662_sixstack_ch8_init }, |
| 12848 | }; |
| 12849 | |
| 12850 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12851 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12852 | */ |
| 12853 | |
| 12854 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12855 | /* output mixer control */ |
| 12856 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12857 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12858 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12859 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12860 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12861 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12862 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12863 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12864 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12865 | |
| 12866 | /*Input mixer control */ |
| 12867 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12868 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12869 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12870 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12871 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12872 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12873 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12874 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12875 | { } /* end */ |
| 12876 | }; |
| 12877 | |
| 12878 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12879 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12880 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12881 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12882 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12883 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12884 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12885 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12886 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12887 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12888 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12889 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12890 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12891 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12892 | { } /* end */ |
| 12893 | }; |
| 12894 | |
| 12895 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12897 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12898 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12899 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12900 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12901 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12902 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12903 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12904 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12905 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12906 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12907 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12908 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12909 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12910 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12911 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12912 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12913 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12914 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12915 | { } /* end */ |
| 12916 | }; |
| 12917 | |
| 12918 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12919 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12920 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12921 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12922 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12923 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12924 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12925 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12926 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12927 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12928 | { } /* end */ |
| 12929 | }; |
| 12930 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12931 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12932 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12933 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 12934 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12935 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12936 | |
| 12937 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12938 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12939 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12940 | |
| 12941 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12942 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12943 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12944 | { } /* end */ |
| 12945 | }; |
| 12946 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12947 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 12948 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12949 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12950 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12951 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12952 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12953 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12954 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12955 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12956 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12957 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12958 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12959 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12960 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12961 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12962 | { } /* end */ |
| 12963 | }; |
| 12964 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12965 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 12966 | { |
| 12967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12968 | .name = "Channel Mode", |
| 12969 | .info = alc_ch_mode_info, |
| 12970 | .get = alc_ch_mode_get, |
| 12971 | .put = alc_ch_mode_put, |
| 12972 | }, |
| 12973 | { } /* end */ |
| 12974 | }; |
| 12975 | |
| 12976 | static struct hda_verb alc662_init_verbs[] = { |
| 12977 | /* ADC: mute amp left and right */ |
| 12978 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12979 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12980 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 12981 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12982 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12983 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12984 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12985 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12986 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12987 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12988 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12990 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12991 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12992 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12993 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12994 | |
| 12995 | /* Front Pin: output 0 (0x0c) */ |
| 12996 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12997 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12998 | |
| 12999 | /* Rear Pin: output 1 (0x0d) */ |
| 13000 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13001 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13002 | |
| 13003 | /* CLFE Pin: output 2 (0x0e) */ |
| 13004 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13005 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13006 | |
| 13007 | /* Mic (rear) pin: input vref at 80% */ |
| 13008 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13009 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13010 | /* Front Mic pin: input vref at 80% */ |
| 13011 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13012 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13013 | /* Line In pin: input */ |
| 13014 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13015 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13016 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13017 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13018 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13019 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13020 | /* CD pin widget for input */ |
| 13021 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13022 | |
| 13023 | /* FIXME: use matrix-type input source selection */ |
| 13024 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13025 | /* Input mixer */ |
| 13026 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13027 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13030 | |
| 13031 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13032 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13033 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13034 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13035 | { } |
| 13036 | }; |
| 13037 | |
| 13038 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13039 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13040 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13041 | {} |
| 13042 | }; |
| 13043 | |
| 13044 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13045 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13046 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13047 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13048 | }; |
| 13049 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13050 | /* Set Unsolicited Event*/ |
| 13051 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13052 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13053 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13054 | {} |
| 13055 | }; |
| 13056 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13057 | /* |
| 13058 | * generic initialization of ADC, input mixers and output mixers |
| 13059 | */ |
| 13060 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13061 | /* |
| 13062 | * Unmute ADC and set the default input to mic-in |
| 13063 | */ |
| 13064 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13065 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13066 | |
| 13067 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13068 | * mixer widget |
| 13069 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13070 | * panel mic (mic 2) |
| 13071 | */ |
| 13072 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13073 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13074 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13075 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13076 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13077 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13078 | |
| 13079 | /* |
| 13080 | * Set up output mixers (0x0c - 0x0f) |
| 13081 | */ |
| 13082 | /* set vol=0 to output mixers */ |
| 13083 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13084 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13085 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13086 | |
| 13087 | /* set up input amps for analog loopback */ |
| 13088 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13091 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13092 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13093 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13094 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13095 | |
| 13096 | |
| 13097 | /* FIXME: use matrix-type input source selection */ |
| 13098 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13099 | /* Input mixer */ |
| 13100 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13101 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13102 | { } |
| 13103 | }; |
| 13104 | |
| 13105 | /* capture mixer elements */ |
| 13106 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13107 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13108 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13109 | { |
| 13110 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13111 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13112 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13113 | */ |
| 13114 | /* .name = "Capture Source", */ |
| 13115 | .name = "Input Source", |
| 13116 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13117 | .info = alc662_mux_enum_info, |
| 13118 | .get = alc662_mux_enum_get, |
| 13119 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13120 | }, |
| 13121 | { } /* end */ |
| 13122 | }; |
| 13123 | |
| 13124 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13125 | { |
| 13126 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13128 | |
| 13129 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13130 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13131 | bits = present ? HDA_AMP_MUTE : 0; |
| 13132 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13133 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13134 | } |
| 13135 | |
| 13136 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13137 | { |
| 13138 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13139 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13140 | |
| 13141 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13142 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13143 | bits = present ? HDA_AMP_MUTE : 0; |
| 13144 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13145 | HDA_AMP_MUTE, bits); |
| 13146 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13147 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13148 | } |
| 13149 | |
| 13150 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13151 | unsigned int res) |
| 13152 | { |
| 13153 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13154 | alc662_lenovo_101e_all_automute(codec); |
| 13155 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13156 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13157 | } |
| 13158 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13159 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13160 | { |
| 13161 | unsigned int present; |
| 13162 | |
| 13163 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13164 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13165 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13166 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13167 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13168 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13169 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13170 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13171 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13172 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13173 | } |
| 13174 | |
| 13175 | /* unsolicited event for HP jack sensing */ |
| 13176 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13177 | unsigned int res) |
| 13178 | { |
| 13179 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13180 | alc262_hippo1_automute( codec ); |
| 13181 | |
| 13182 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13183 | alc662_eeepc_mic_automute(codec); |
| 13184 | } |
| 13185 | |
| 13186 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13187 | { |
| 13188 | alc262_hippo1_automute( codec ); |
| 13189 | alc662_eeepc_mic_automute(codec); |
| 13190 | } |
| 13191 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13192 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13193 | { |
| 13194 | unsigned int mute; |
| 13195 | unsigned int present; |
| 13196 | |
| 13197 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13198 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13199 | AC_VERB_GET_PIN_SENSE, 0); |
| 13200 | present = (present & 0x80000000) != 0; |
| 13201 | if (present) { |
| 13202 | /* mute internal speaker */ |
| 13203 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13204 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13205 | } else { |
| 13206 | /* unmute internal speaker if necessary */ |
| 13207 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13208 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13209 | HDA_AMP_MUTE, mute); |
| 13210 | } |
| 13211 | } |
| 13212 | |
| 13213 | /* unsolicited event for HP jack sensing */ |
| 13214 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13215 | unsigned int res) |
| 13216 | { |
| 13217 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13218 | alc662_eeepc_ep20_automute(codec); |
| 13219 | } |
| 13220 | |
| 13221 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13222 | { |
| 13223 | alc662_eeepc_ep20_automute(codec); |
| 13224 | } |
| 13225 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13226 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13227 | #define alc662_loopbacks alc880_loopbacks |
| 13228 | #endif |
| 13229 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13230 | |
| 13231 | /* pcm configuration: identiacal with ALC880 */ |
| 13232 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13233 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13234 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13235 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13236 | |
| 13237 | /* |
| 13238 | * configuration and preset |
| 13239 | */ |
| 13240 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13241 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13242 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13243 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13244 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13245 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13246 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13247 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13248 | [ALC662_AUTO] = "auto", |
| 13249 | }; |
| 13250 | |
| 13251 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13252 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13253 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13254 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13255 | {} |
| 13256 | }; |
| 13257 | |
| 13258 | static struct alc_config_preset alc662_presets[] = { |
| 13259 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13260 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13261 | .init_verbs = { alc662_init_verbs }, |
| 13262 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13263 | .dac_nids = alc662_dac_nids, |
| 13264 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13265 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13266 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13267 | .channel_mode = alc662_3ST_2ch_modes, |
| 13268 | .input_mux = &alc662_capture_source, |
| 13269 | }, |
| 13270 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13271 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13272 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13273 | .init_verbs = { alc662_init_verbs }, |
| 13274 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13275 | .dac_nids = alc662_dac_nids, |
| 13276 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13277 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13278 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13279 | .channel_mode = alc662_3ST_6ch_modes, |
| 13280 | .need_dac_fix = 1, |
| 13281 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13282 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13283 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13284 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13285 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13286 | .init_verbs = { alc662_init_verbs }, |
| 13287 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13288 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13289 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13290 | .channel_mode = alc662_3ST_6ch_modes, |
| 13291 | .need_dac_fix = 1, |
| 13292 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13293 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13294 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13295 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13296 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13297 | .init_verbs = { alc662_init_verbs }, |
| 13298 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13299 | .dac_nids = alc662_dac_nids, |
| 13300 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13301 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13302 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13303 | .channel_mode = alc662_5stack_modes, |
| 13304 | .input_mux = &alc662_capture_source, |
| 13305 | }, |
| 13306 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13307 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13308 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13309 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13310 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13311 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13312 | .channel_mode = alc662_3ST_2ch_modes, |
| 13313 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13314 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13315 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13316 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13317 | [ALC662_ASUS_EEEPC_P701] = { |
| 13318 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13319 | .init_verbs = { alc662_init_verbs, |
| 13320 | alc662_eeepc_sue_init_verbs }, |
| 13321 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13322 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13323 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13324 | .channel_mode = alc662_3ST_2ch_modes, |
| 13325 | .input_mux = &alc662_eeepc_capture_source, |
| 13326 | .unsol_event = alc662_eeepc_unsol_event, |
| 13327 | .init_hook = alc662_eeepc_inithook, |
| 13328 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13329 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13330 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13331 | alc662_chmode_mixer }, |
| 13332 | .init_verbs = { alc662_init_verbs, |
| 13333 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13334 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13335 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13336 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13337 | .channel_mode = alc662_3ST_6ch_modes, |
| 13338 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13339 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13340 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13341 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13342 | |
| 13343 | }; |
| 13344 | |
| 13345 | |
| 13346 | /* |
| 13347 | * BIOS auto configuration |
| 13348 | */ |
| 13349 | |
| 13350 | /* add playback controls from the parsed DAC table */ |
| 13351 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13352 | const struct auto_pin_cfg *cfg) |
| 13353 | { |
| 13354 | char name[32]; |
| 13355 | static const char *chname[4] = { |
| 13356 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13357 | }; |
| 13358 | hda_nid_t nid; |
| 13359 | int i, err; |
| 13360 | |
| 13361 | for (i = 0; i < cfg->line_outs; i++) { |
| 13362 | if (!spec->multiout.dac_nids[i]) |
| 13363 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13364 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13365 | if (i == 2) { |
| 13366 | /* Center/LFE */ |
| 13367 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13368 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13369 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13370 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13371 | if (err < 0) |
| 13372 | return err; |
| 13373 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13374 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13375 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13376 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13377 | if (err < 0) |
| 13378 | return err; |
| 13379 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13380 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13381 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13382 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13383 | if (err < 0) |
| 13384 | return err; |
| 13385 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13386 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13387 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13388 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13389 | if (err < 0) |
| 13390 | return err; |
| 13391 | } else { |
| 13392 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13393 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13394 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13395 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13396 | if (err < 0) |
| 13397 | return err; |
| 13398 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13399 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13400 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13401 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13402 | if (err < 0) |
| 13403 | return err; |
| 13404 | } |
| 13405 | } |
| 13406 | return 0; |
| 13407 | } |
| 13408 | |
| 13409 | /* add playback controls for speaker and HP outputs */ |
| 13410 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13411 | const char *pfx) |
| 13412 | { |
| 13413 | hda_nid_t nid; |
| 13414 | int err; |
| 13415 | char name[32]; |
| 13416 | |
| 13417 | if (!pin) |
| 13418 | return 0; |
| 13419 | |
| 13420 | if (alc880_is_fixed_pin(pin)) { |
| 13421 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13422 | /* printk("DAC nid=%x\n",nid); */ |
| 13423 | /* specify the DAC as the extra output */ |
| 13424 | if (!spec->multiout.hp_nid) |
| 13425 | spec->multiout.hp_nid = nid; |
| 13426 | else |
| 13427 | spec->multiout.extra_out_nid[0] = nid; |
| 13428 | /* control HP volume/switch on the output mixer amp */ |
| 13429 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13430 | sprintf(name, "%s Playback Volume", pfx); |
| 13431 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13432 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13433 | if (err < 0) |
| 13434 | return err; |
| 13435 | sprintf(name, "%s Playback Switch", pfx); |
| 13436 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13437 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13438 | if (err < 0) |
| 13439 | return err; |
| 13440 | } else if (alc880_is_multi_pin(pin)) { |
| 13441 | /* set manual connection */ |
| 13442 | /* we have only a switch on HP-out PIN */ |
| 13443 | sprintf(name, "%s Playback Switch", pfx); |
| 13444 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13445 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13446 | if (err < 0) |
| 13447 | return err; |
| 13448 | } |
| 13449 | return 0; |
| 13450 | } |
| 13451 | |
| 13452 | /* create playback/capture controls for input pins */ |
| 13453 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13454 | const struct auto_pin_cfg *cfg) |
| 13455 | { |
| 13456 | struct hda_input_mux *imux = &spec->private_imux; |
| 13457 | int i, err, idx; |
| 13458 | |
| 13459 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13460 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13461 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13462 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13463 | auto_pin_cfg_labels[i], |
| 13464 | idx, 0x0b); |
| 13465 | if (err < 0) |
| 13466 | return err; |
| 13467 | imux->items[imux->num_items].label = |
| 13468 | auto_pin_cfg_labels[i]; |
| 13469 | imux->items[imux->num_items].index = |
| 13470 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13471 | imux->num_items++; |
| 13472 | } |
| 13473 | } |
| 13474 | return 0; |
| 13475 | } |
| 13476 | |
| 13477 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13478 | hda_nid_t nid, int pin_type, |
| 13479 | int dac_idx) |
| 13480 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13481 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13482 | /* need the manual connection? */ |
| 13483 | if (alc880_is_multi_pin(nid)) { |
| 13484 | struct alc_spec *spec = codec->spec; |
| 13485 | int idx = alc880_multi_pin_idx(nid); |
| 13486 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13487 | AC_VERB_SET_CONNECT_SEL, |
| 13488 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13489 | } |
| 13490 | } |
| 13491 | |
| 13492 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13493 | { |
| 13494 | struct alc_spec *spec = codec->spec; |
| 13495 | int i; |
| 13496 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13497 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13498 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13499 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13500 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13501 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13502 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13503 | i); |
| 13504 | } |
| 13505 | } |
| 13506 | |
| 13507 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13508 | { |
| 13509 | struct alc_spec *spec = codec->spec; |
| 13510 | hda_nid_t pin; |
| 13511 | |
| 13512 | pin = spec->autocfg.hp_pins[0]; |
| 13513 | if (pin) /* connect to front */ |
| 13514 | /* use dac 0 */ |
| 13515 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13516 | pin = spec->autocfg.speaker_pins[0]; |
| 13517 | if (pin) |
| 13518 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13519 | } |
| 13520 | |
| 13521 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13522 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13523 | |
| 13524 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13525 | { |
| 13526 | struct alc_spec *spec = codec->spec; |
| 13527 | int i; |
| 13528 | |
| 13529 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13530 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13531 | if (alc662_is_input_pin(nid)) { |
| 13532 | snd_hda_codec_write(codec, nid, 0, |
| 13533 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13534 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13535 | PIN_VREF80 : PIN_IN)); |
| 13536 | if (nid != ALC662_PIN_CD_NID) |
| 13537 | snd_hda_codec_write(codec, nid, 0, |
| 13538 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13539 | AMP_OUT_MUTE); |
| 13540 | } |
| 13541 | } |
| 13542 | } |
| 13543 | |
| 13544 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13545 | { |
| 13546 | struct alc_spec *spec = codec->spec; |
| 13547 | int err; |
| 13548 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13549 | |
| 13550 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13551 | alc662_ignore); |
| 13552 | if (err < 0) |
| 13553 | return err; |
| 13554 | if (!spec->autocfg.line_outs) |
| 13555 | return 0; /* can't find valid BIOS pin config */ |
| 13556 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13557 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13558 | if (err < 0) |
| 13559 | return err; |
| 13560 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13561 | if (err < 0) |
| 13562 | return err; |
| 13563 | err = alc662_auto_create_extra_out(spec, |
| 13564 | spec->autocfg.speaker_pins[0], |
| 13565 | "Speaker"); |
| 13566 | if (err < 0) |
| 13567 | return err; |
| 13568 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13569 | "Headphone"); |
| 13570 | if (err < 0) |
| 13571 | return err; |
| 13572 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13573 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13574 | return err; |
| 13575 | |
| 13576 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13577 | |
| 13578 | if (spec->autocfg.dig_out_pin) |
| 13579 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13580 | |
| 13581 | if (spec->kctl_alloc) |
| 13582 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13583 | |
| 13584 | spec->num_mux_defs = 1; |
| 13585 | spec->input_mux = &spec->private_imux; |
| 13586 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13587 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13588 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13589 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13590 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13591 | } |
| 13592 | |
| 13593 | /* additional initialization for auto-configuration model */ |
| 13594 | static void alc662_auto_init(struct hda_codec *codec) |
| 13595 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13596 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13597 | alc662_auto_init_multi_out(codec); |
| 13598 | alc662_auto_init_hp_out(codec); |
| 13599 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13600 | if (spec->unsol_event) |
| 13601 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13602 | } |
| 13603 | |
| 13604 | static int patch_alc662(struct hda_codec *codec) |
| 13605 | { |
| 13606 | struct alc_spec *spec; |
| 13607 | int err, board_config; |
| 13608 | |
| 13609 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13610 | if (!spec) |
| 13611 | return -ENOMEM; |
| 13612 | |
| 13613 | codec->spec = spec; |
| 13614 | |
| 13615 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13616 | alc662_models, |
| 13617 | alc662_cfg_tbl); |
| 13618 | if (board_config < 0) { |
| 13619 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13620 | "trying auto-probe from BIOS...\n"); |
| 13621 | board_config = ALC662_AUTO; |
| 13622 | } |
| 13623 | |
| 13624 | if (board_config == ALC662_AUTO) { |
| 13625 | /* automatic parse from the BIOS config */ |
| 13626 | err = alc662_parse_auto_config(codec); |
| 13627 | if (err < 0) { |
| 13628 | alc_free(codec); |
| 13629 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13630 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13631 | printk(KERN_INFO |
| 13632 | "hda_codec: Cannot set up configuration " |
| 13633 | "from BIOS. Using base mode...\n"); |
| 13634 | board_config = ALC662_3ST_2ch_DIG; |
| 13635 | } |
| 13636 | } |
| 13637 | |
| 13638 | if (board_config != ALC662_AUTO) |
| 13639 | setup_preset(spec, &alc662_presets[board_config]); |
| 13640 | |
| 13641 | spec->stream_name_analog = "ALC662 Analog"; |
| 13642 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13643 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13644 | |
| 13645 | spec->stream_name_digital = "ALC662 Digital"; |
| 13646 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13647 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13648 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13649 | spec->adc_nids = alc662_adc_nids; |
| 13650 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13651 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13652 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13653 | spec->vmaster_nid = 0x02; |
| 13654 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13655 | codec->patch_ops = alc_patch_ops; |
| 13656 | if (board_config == ALC662_AUTO) |
| 13657 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13658 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13659 | if (!spec->loopback.amplist) |
| 13660 | spec->loopback.amplist = alc662_loopbacks; |
| 13661 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13662 | |
| 13663 | return 0; |
| 13664 | } |
| 13665 | |
| 13666 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13667 | * patch entries |
| 13668 | */ |
| 13669 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13670 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13671 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13672 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13673 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13674 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13675 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13676 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13677 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13678 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13679 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13680 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13681 | .patch = patch_alc883 }, |
| 13682 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13683 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13684 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13685 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13686 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13687 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13688 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13689 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13690 | {} /* terminator */ |
| 13691 | }; |