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 | 7cf51e4 | 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 | 7cf51e4 | 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 | bab282b | 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 | c8b6bf9b | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | c8b6bf9b | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | 7cf51e4 | 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 | c8b6bf9b | 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 | 96fe7cc | 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 | 96fe7cc | 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 | 96fe7cc | 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 | bab282b | 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 | bab282b | 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 | bab282b | 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 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 9510 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 9511 | static struct hda_bind_ctls alc268_bind_beep_sw = { |
| 9512 | .ops = &snd_hda_bind_sw, |
| 9513 | .values = { |
| 9514 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 9515 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 9516 | 0 |
| 9517 | }, |
| 9518 | }; |
| 9519 | |
| 9520 | static struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 9521 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 9522 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 9523 | { } |
| 9524 | }; |
| 9525 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9526 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9527 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9528 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9529 | { } |
| 9530 | }; |
| 9531 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9532 | /* Toshiba specific */ |
| 9533 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9534 | |
| 9535 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9536 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9537 | { } /* end */ |
| 9538 | }; |
| 9539 | |
| 9540 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9541 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9542 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9543 | .ops = &snd_hda_bind_vol, |
| 9544 | .values = { |
| 9545 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9546 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9547 | 0 |
| 9548 | }, |
| 9549 | }; |
| 9550 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9551 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9552 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9553 | { |
| 9554 | struct alc_spec *spec = codec->spec; |
| 9555 | unsigned int mute; |
| 9556 | |
| 9557 | if (force || !spec->sense_updated) { |
| 9558 | unsigned int present; |
| 9559 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9560 | AC_VERB_GET_PIN_SENSE, 0); |
| 9561 | spec->jack_present = (present & 0x80000000) != 0; |
| 9562 | spec->sense_updated = 1; |
| 9563 | } |
| 9564 | if (spec->jack_present) |
| 9565 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9566 | else /* unmute internal speaker if necessary */ |
| 9567 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9568 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9569 | HDA_AMP_MUTE, mute); |
| 9570 | } |
| 9571 | |
| 9572 | |
| 9573 | /* bind hp and internal speaker mute (with plug check) */ |
| 9574 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9575 | struct snd_ctl_elem_value *ucontrol) |
| 9576 | { |
| 9577 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9578 | long *valp = ucontrol->value.integer.value; |
| 9579 | int change; |
| 9580 | |
| 9581 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9582 | HDA_AMP_MUTE, |
| 9583 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9584 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9585 | HDA_AMP_MUTE, |
| 9586 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9587 | if (change) |
| 9588 | alc268_acer_automute(codec, 0); |
| 9589 | return change; |
| 9590 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9591 | |
| 9592 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9593 | /* output mixer control */ |
| 9594 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9595 | { |
| 9596 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9597 | .name = "Master Playback Switch", |
| 9598 | .info = snd_hda_mixer_amp_switch_info, |
| 9599 | .get = snd_hda_mixer_amp_switch_get, |
| 9600 | .put = alc268_acer_master_sw_put, |
| 9601 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9602 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9603 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9604 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9605 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9606 | { } |
| 9607 | }; |
| 9608 | |
| 9609 | static struct hda_verb alc268_acer_verbs[] = { |
| 9610 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9611 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9612 | |
| 9613 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9614 | { } |
| 9615 | }; |
| 9616 | |
| 9617 | /* unsolicited event for HP jack sensing */ |
| 9618 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9619 | unsigned int res) |
| 9620 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9621 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9622 | return; |
| 9623 | alc268_toshiba_automute(codec); |
| 9624 | } |
| 9625 | |
| 9626 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9627 | unsigned int res) |
| 9628 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9629 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9630 | return; |
| 9631 | alc268_acer_automute(codec, 1); |
| 9632 | } |
| 9633 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9634 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9635 | { |
| 9636 | alc268_acer_automute(codec, 1); |
| 9637 | } |
| 9638 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9639 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9640 | /* output mixer control */ |
| 9641 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9642 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9643 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9644 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9645 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9646 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9647 | { } |
| 9648 | }; |
| 9649 | |
| 9650 | static struct hda_verb alc268_dell_verbs[] = { |
| 9651 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9652 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9653 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9654 | { } |
| 9655 | }; |
| 9656 | |
| 9657 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9658 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9659 | { |
| 9660 | unsigned int present; |
| 9661 | unsigned int mute; |
| 9662 | |
| 9663 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9664 | if (present & 0x80000000) |
| 9665 | mute = HDA_AMP_MUTE; |
| 9666 | else |
| 9667 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9668 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9669 | HDA_AMP_MUTE, mute); |
| 9670 | } |
| 9671 | |
| 9672 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9673 | unsigned int res) |
| 9674 | { |
| 9675 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9676 | return; |
| 9677 | alc268_dell_automute(codec); |
| 9678 | } |
| 9679 | |
| 9680 | #define alc268_dell_init_hook alc268_dell_automute |
| 9681 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9682 | /* |
| 9683 | * generic initialization of ADC, input mixers and output mixers |
| 9684 | */ |
| 9685 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9686 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9687 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9688 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9689 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9690 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9691 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9692 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9693 | |
| 9694 | /* |
| 9695 | * Set up output mixers (0x0c - 0x0e) |
| 9696 | */ |
| 9697 | /* set vol=0 to output mixers */ |
| 9698 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9699 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9700 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9701 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9702 | |
| 9703 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9704 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9705 | |
| 9706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9707 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9708 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9709 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9710 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9711 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9712 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9713 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9714 | |
| 9715 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9716 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9717 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9718 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9719 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9720 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9721 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 9722 | |
| 9723 | /* set PCBEEP vol = 0, mute connections */ |
| 9724 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9725 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9726 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9727 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9728 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9729 | |
| 9730 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9731 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9732 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9733 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9734 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9735 | { } |
| 9736 | }; |
| 9737 | |
| 9738 | /* |
| 9739 | * generic initialization of ADC, input mixers and output mixers |
| 9740 | */ |
| 9741 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9742 | /* set output DAC */ |
| 9743 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9744 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9745 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9746 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9747 | |
| 9748 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9749 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9750 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9751 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9752 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9753 | |
| 9754 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9755 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9756 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9757 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9758 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9759 | |
| 9760 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9761 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9762 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9763 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9764 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 9765 | /* set PCBEEP vol = 0, mute connections */ |
| 9766 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9767 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 9768 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9769 | |
| 9770 | { } |
| 9771 | }; |
| 9772 | |
| 9773 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9774 | #define alc268_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 9775 | #define alc268_mux_enum_put alc_mux_enum_put |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9776 | |
| 9777 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9778 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9779 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9780 | { |
| 9781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9782 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9783 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9784 | */ |
| 9785 | /* .name = "Capture Source", */ |
| 9786 | .name = "Input Source", |
| 9787 | .count = 1, |
| 9788 | .info = alc268_mux_enum_info, |
| 9789 | .get = alc268_mux_enum_get, |
| 9790 | .put = alc268_mux_enum_put, |
| 9791 | }, |
| 9792 | { } /* end */ |
| 9793 | }; |
| 9794 | |
| 9795 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9796 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9797 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9798 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9799 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9800 | { |
| 9801 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9802 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9803 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9804 | */ |
| 9805 | /* .name = "Capture Source", */ |
| 9806 | .name = "Input Source", |
| 9807 | .count = 2, |
| 9808 | .info = alc268_mux_enum_info, |
| 9809 | .get = alc268_mux_enum_get, |
| 9810 | .put = alc268_mux_enum_put, |
| 9811 | }, |
| 9812 | { } /* end */ |
| 9813 | }; |
| 9814 | |
| 9815 | static struct hda_input_mux alc268_capture_source = { |
| 9816 | .num_items = 4, |
| 9817 | .items = { |
| 9818 | { "Mic", 0x0 }, |
| 9819 | { "Front Mic", 0x1 }, |
| 9820 | { "Line", 0x2 }, |
| 9821 | { "CD", 0x3 }, |
| 9822 | }, |
| 9823 | }; |
| 9824 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9825 | #ifdef CONFIG_SND_DEBUG |
| 9826 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9827 | /* Volume widgets */ |
| 9828 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9829 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9830 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9831 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9832 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9833 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9834 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9835 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9836 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9837 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9838 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9839 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9840 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 9841 | /* The below appears problematic on some hardwares */ |
| 9842 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9843 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9844 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9845 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9846 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9847 | |
| 9848 | /* Modes for retasking pin widgets */ |
| 9849 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9850 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9851 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9852 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9853 | |
| 9854 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9855 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9856 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9857 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9858 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9859 | |
| 9860 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9861 | * The ALC268 does not have an SPDIF input. |
| 9862 | */ |
| 9863 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9864 | |
| 9865 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9866 | * this output to turn on an external amplifier. |
| 9867 | */ |
| 9868 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9869 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9870 | |
| 9871 | { } /* end */ |
| 9872 | }; |
| 9873 | #endif |
| 9874 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9875 | /* create input playback/capture controls for the given pin */ |
| 9876 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9877 | const char *ctlname, int idx) |
| 9878 | { |
| 9879 | char name[32]; |
| 9880 | int err; |
| 9881 | |
| 9882 | sprintf(name, "%s Playback Volume", ctlname); |
| 9883 | if (nid == 0x14) { |
| 9884 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9885 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9886 | HDA_OUTPUT)); |
| 9887 | if (err < 0) |
| 9888 | return err; |
| 9889 | } else if (nid == 0x15) { |
| 9890 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9891 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9892 | HDA_OUTPUT)); |
| 9893 | if (err < 0) |
| 9894 | return err; |
| 9895 | } else |
| 9896 | return -1; |
| 9897 | sprintf(name, "%s Playback Switch", ctlname); |
| 9898 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9899 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9900 | if (err < 0) |
| 9901 | return err; |
| 9902 | return 0; |
| 9903 | } |
| 9904 | |
| 9905 | /* add playback controls from the parsed DAC table */ |
| 9906 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9907 | const struct auto_pin_cfg *cfg) |
| 9908 | { |
| 9909 | hda_nid_t nid; |
| 9910 | int err; |
| 9911 | |
| 9912 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9913 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9914 | spec->multiout.dac_nids[0] = 2; |
| 9915 | spec->multiout.dac_nids[1] = 3; |
| 9916 | |
| 9917 | nid = cfg->line_out_pins[0]; |
| 9918 | if (nid) |
| 9919 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9920 | |
| 9921 | nid = cfg->speaker_pins[0]; |
| 9922 | if (nid == 0x1d) { |
| 9923 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9924 | "Speaker Playback Volume", |
| 9925 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9926 | if (err < 0) |
| 9927 | return err; |
| 9928 | } |
| 9929 | nid = cfg->hp_pins[0]; |
| 9930 | if (nid) |
| 9931 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9932 | |
| 9933 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9934 | if (nid == 0x16) { |
| 9935 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9936 | "Mono Playback Switch", |
| 9937 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9938 | if (err < 0) |
| 9939 | return err; |
| 9940 | } |
| 9941 | return 0; |
| 9942 | } |
| 9943 | |
| 9944 | /* create playback/capture controls for input pins */ |
| 9945 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9946 | const struct auto_pin_cfg *cfg) |
| 9947 | { |
| 9948 | struct hda_input_mux *imux = &spec->private_imux; |
| 9949 | int i, idx1; |
| 9950 | |
| 9951 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9952 | switch(cfg->input_pins[i]) { |
| 9953 | case 0x18: |
| 9954 | idx1 = 0; /* Mic 1 */ |
| 9955 | break; |
| 9956 | case 0x19: |
| 9957 | idx1 = 1; /* Mic 2 */ |
| 9958 | break; |
| 9959 | case 0x1a: |
| 9960 | idx1 = 2; /* Line In */ |
| 9961 | break; |
| 9962 | case 0x1c: |
| 9963 | idx1 = 3; /* CD */ |
| 9964 | break; |
| 9965 | default: |
| 9966 | continue; |
| 9967 | } |
| 9968 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9969 | imux->items[imux->num_items].index = idx1; |
| 9970 | imux->num_items++; |
| 9971 | } |
| 9972 | return 0; |
| 9973 | } |
| 9974 | |
| 9975 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9976 | { |
| 9977 | struct alc_spec *spec = codec->spec; |
| 9978 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9979 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9980 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9981 | unsigned int dac_vol1, dac_vol2; |
| 9982 | |
| 9983 | if (speaker_nid) { |
| 9984 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9985 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9986 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9987 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9988 | AMP_IN_UNMUTE(1)); |
| 9989 | snd_hda_codec_write(codec, 0x10, 0, |
| 9990 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9991 | AMP_IN_UNMUTE(1)); |
| 9992 | } else { |
| 9993 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9994 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9995 | snd_hda_codec_write(codec, 0x10, 0, |
| 9996 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9997 | } |
| 9998 | |
| 9999 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 10000 | if (line_nid == 0x14) |
| 10001 | dac_vol2 = AMP_OUT_ZERO; |
| 10002 | else if (line_nid == 0x15) |
| 10003 | dac_vol1 = AMP_OUT_ZERO; |
| 10004 | if (hp_nid == 0x14) |
| 10005 | dac_vol2 = AMP_OUT_ZERO; |
| 10006 | else if (hp_nid == 0x15) |
| 10007 | dac_vol1 = AMP_OUT_ZERO; |
| 10008 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 10009 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 10010 | spec->autocfg.line_out_pins[2] != 0x16) |
| 10011 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 10012 | |
| 10013 | snd_hda_codec_write(codec, 0x02, 0, |
| 10014 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 10015 | snd_hda_codec_write(codec, 0x03, 0, |
| 10016 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 10017 | } |
| 10018 | |
| 10019 | /* pcm configuration: identiacal with ALC880 */ |
| 10020 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 10021 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10022 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10023 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 10024 | |
| 10025 | /* |
| 10026 | * BIOS auto configuration |
| 10027 | */ |
| 10028 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 10029 | { |
| 10030 | struct alc_spec *spec = codec->spec; |
| 10031 | int err; |
| 10032 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 10033 | |
| 10034 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10035 | alc268_ignore); |
| 10036 | if (err < 0) |
| 10037 | return err; |
| 10038 | if (!spec->autocfg.line_outs) |
| 10039 | return 0; /* can't find valid BIOS pin config */ |
| 10040 | |
| 10041 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10042 | if (err < 0) |
| 10043 | return err; |
| 10044 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10045 | if (err < 0) |
| 10046 | return err; |
| 10047 | |
| 10048 | spec->multiout.max_channels = 2; |
| 10049 | |
| 10050 | /* digital only support output */ |
| 10051 | if (spec->autocfg.dig_out_pin) |
| 10052 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 10053 | |
| 10054 | if (spec->kctl_alloc) |
| 10055 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10056 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10057 | if (spec->autocfg.speaker_pins[0] != 0x1d) |
| 10058 | spec->mixers[spec->num_mixers++] = alc268_beep_mixer; |
| 10059 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10060 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 10061 | spec->num_mux_defs = 1; |
| 10062 | spec->input_mux = &spec->private_imux; |
| 10063 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 10064 | err = alc_auto_add_mic_boost(codec); |
| 10065 | if (err < 0) |
| 10066 | return err; |
| 10067 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10068 | return 1; |
| 10069 | } |
| 10070 | |
| 10071 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 10072 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 10073 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 10074 | |
| 10075 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10076 | static void alc268_auto_init(struct hda_codec *codec) |
| 10077 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10078 | struct alc_spec *spec = codec->spec; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10079 | alc268_auto_init_multi_out(codec); |
| 10080 | alc268_auto_init_hp_out(codec); |
| 10081 | alc268_auto_init_mono_speaker_out(codec); |
| 10082 | alc268_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10083 | if (spec->unsol_event) |
| 10084 | alc_sku_automute(codec); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10085 | } |
| 10086 | |
| 10087 | /* |
| 10088 | * configuration and preset |
| 10089 | */ |
| 10090 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 10091 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 10092 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10093 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10094 | [ALC268_DELL] = "dell", |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10095 | [ALC268_ZEPTO] = "zepto", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10096 | #ifdef CONFIG_SND_DEBUG |
| 10097 | [ALC268_TEST] = "test", |
| 10098 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10099 | [ALC268_AUTO] = "auto", |
| 10100 | }; |
| 10101 | |
| 10102 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10103 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 10104 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10105 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 10106 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10107 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 10108 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10109 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10110 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 10111 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 10112 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10113 | SND_PCI_QUIRK(0x1170, 0x0040, "ZEPTO", ALC268_ZEPTO), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10114 | {} |
| 10115 | }; |
| 10116 | |
| 10117 | static struct alc_config_preset alc268_presets[] = { |
| 10118 | [ALC268_3ST] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10119 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10120 | alc268_beep_mixer }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10121 | .init_verbs = { alc268_base_init_verbs }, |
| 10122 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10123 | .dac_nids = alc268_dac_nids, |
| 10124 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10125 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10126 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10127 | .hp_nid = 0x03, |
| 10128 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10129 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10130 | .channel_mode = alc268_modes, |
| 10131 | .input_mux = &alc268_capture_source, |
| 10132 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10133 | [ALC268_TOSHIBA] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10134 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10135 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10136 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10137 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10138 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10139 | .dac_nids = alc268_dac_nids, |
| 10140 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10141 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10142 | .capsrc_nids = alc268_capsrc_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10143 | .hp_nid = 0x03, |
| 10144 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10145 | .channel_mode = alc268_modes, |
| 10146 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10147 | .unsol_event = alc268_toshiba_unsol_event, |
| 10148 | .init_hook = alc268_toshiba_automute, |
| 10149 | }, |
| 10150 | [ALC268_ACER] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10151 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, |
| 10152 | alc268_beep_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10153 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10154 | alc268_acer_verbs }, |
| 10155 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10156 | .dac_nids = alc268_dac_nids, |
| 10157 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10158 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10159 | .capsrc_nids = alc268_capsrc_nids, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 10160 | .hp_nid = 0x02, |
| 10161 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10162 | .channel_mode = alc268_modes, |
| 10163 | .input_mux = &alc268_capture_source, |
| 10164 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 10165 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 10166 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10167 | [ALC268_DELL] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10168 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10169 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10170 | alc268_dell_verbs }, |
| 10171 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10172 | .dac_nids = alc268_dac_nids, |
| 10173 | .hp_nid = 0x02, |
| 10174 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10175 | .channel_mode = alc268_modes, |
| 10176 | .unsol_event = alc268_dell_unsol_event, |
| 10177 | .init_hook = alc268_dell_init_hook, |
| 10178 | .input_mux = &alc268_capture_source, |
| 10179 | }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10180 | [ALC268_ZEPTO] = { |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10181 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer, |
| 10182 | alc268_beep_mixer }, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10183 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10184 | alc268_toshiba_verbs }, |
| 10185 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10186 | .dac_nids = alc268_dac_nids, |
| 10187 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10188 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10189 | .capsrc_nids = alc268_capsrc_nids, |
Mirco Tischler | f12462c | 2008-02-04 12:33:59 +0100 | [diff] [blame] | 10190 | .hp_nid = 0x03, |
| 10191 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10192 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10193 | .channel_mode = alc268_modes, |
| 10194 | .input_mux = &alc268_capture_source, |
| 10195 | .unsol_event = alc268_toshiba_unsol_event, |
| 10196 | .init_hook = alc268_toshiba_automute |
| 10197 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10198 | #ifdef CONFIG_SND_DEBUG |
| 10199 | [ALC268_TEST] = { |
| 10200 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 10201 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 10202 | alc268_volume_init_verbs }, |
| 10203 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 10204 | .dac_nids = alc268_dac_nids, |
| 10205 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 10206 | .adc_nids = alc268_adc_nids_alt, |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10207 | .capsrc_nids = alc268_capsrc_nids, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 10208 | .hp_nid = 0x03, |
| 10209 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 10210 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 10211 | .channel_mode = alc268_modes, |
| 10212 | .input_mux = &alc268_capture_source, |
| 10213 | }, |
| 10214 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10215 | }; |
| 10216 | |
| 10217 | static int patch_alc268(struct hda_codec *codec) |
| 10218 | { |
| 10219 | struct alc_spec *spec; |
| 10220 | int board_config; |
| 10221 | int err; |
| 10222 | |
| 10223 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 10224 | if (spec == NULL) |
| 10225 | return -ENOMEM; |
| 10226 | |
| 10227 | codec->spec = spec; |
| 10228 | |
| 10229 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 10230 | alc268_models, |
| 10231 | alc268_cfg_tbl); |
| 10232 | |
| 10233 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 10234 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 10235 | "trying auto-probe from BIOS...\n"); |
| 10236 | board_config = ALC268_AUTO; |
| 10237 | } |
| 10238 | |
| 10239 | if (board_config == ALC268_AUTO) { |
| 10240 | /* automatic parse from the BIOS config */ |
| 10241 | err = alc268_parse_auto_config(codec); |
| 10242 | if (err < 0) { |
| 10243 | alc_free(codec); |
| 10244 | return err; |
| 10245 | } else if (!err) { |
| 10246 | printk(KERN_INFO |
| 10247 | "hda_codec: Cannot set up configuration " |
| 10248 | "from BIOS. Using base mode...\n"); |
| 10249 | board_config = ALC268_3ST; |
| 10250 | } |
| 10251 | } |
| 10252 | |
| 10253 | if (board_config != ALC268_AUTO) |
| 10254 | setup_preset(spec, &alc268_presets[board_config]); |
| 10255 | |
| 10256 | spec->stream_name_analog = "ALC268 Analog"; |
| 10257 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10258 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10259 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10260 | |
| 10261 | spec->stream_name_digital = "ALC268 Digital"; |
| 10262 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10263 | |
Takashi Iwai | aef9d31 | 2008-02-19 13:16:41 +0100 | [diff] [blame^] | 10264 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 10265 | /* override the amp caps for beep generator */ |
| 10266 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 10267 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 10268 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 10269 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 10270 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 10271 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10272 | if (!spec->adc_nids && spec->input_mux) { |
| 10273 | /* check whether NID 0x07 is valid */ |
| 10274 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10275 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10276 | /* get type */ |
| 10277 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 10278 | if (wcap != AC_WID_AUD_IN) { |
| 10279 | spec->adc_nids = alc268_adc_nids_alt; |
| 10280 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10281 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10282 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10283 | spec->num_mixers++; |
| 10284 | } else { |
| 10285 | spec->adc_nids = alc268_adc_nids; |
| 10286 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10287 | spec->mixers[spec->num_mixers] = |
| 10288 | alc268_capture_mixer; |
| 10289 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10290 | } |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 10291 | spec->capsrc_nids = alc268_capsrc_nids; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10292 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10293 | |
| 10294 | spec->vmaster_nid = 0x02; |
| 10295 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10296 | codec->patch_ops = alc_patch_ops; |
| 10297 | if (board_config == ALC268_AUTO) |
| 10298 | spec->init_hook = alc268_auto_init; |
| 10299 | |
| 10300 | return 0; |
| 10301 | } |
| 10302 | |
| 10303 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10304 | * ALC269 channel source setting (2 channel) |
| 10305 | */ |
| 10306 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10307 | |
| 10308 | #define alc269_dac_nids alc260_dac_nids |
| 10309 | |
| 10310 | static hda_nid_t alc269_adc_nids[1] = { |
| 10311 | /* ADC1 */ |
| 10312 | 0x07, |
| 10313 | }; |
| 10314 | |
| 10315 | #define alc269_modes alc260_modes |
| 10316 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10317 | |
| 10318 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10319 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10320 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10321 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10322 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10323 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10324 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10325 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10326 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10327 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10328 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10329 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10330 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10331 | { } /* end */ |
| 10332 | }; |
| 10333 | |
| 10334 | /* capture mixer elements */ |
| 10335 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10336 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10337 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10338 | { |
| 10339 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10340 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10341 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10342 | */ |
| 10343 | /* .name = "Capture Source", */ |
| 10344 | .name = "Input Source", |
| 10345 | .count = 1, |
| 10346 | .info = alc_mux_enum_info, |
| 10347 | .get = alc_mux_enum_get, |
| 10348 | .put = alc_mux_enum_put, |
| 10349 | }, |
| 10350 | { } /* end */ |
| 10351 | }; |
| 10352 | |
| 10353 | /* |
| 10354 | * generic initialization of ADC, input mixers and output mixers |
| 10355 | */ |
| 10356 | static struct hda_verb alc269_init_verbs[] = { |
| 10357 | /* |
| 10358 | * Unmute ADC0 and set the default input to mic-in |
| 10359 | */ |
| 10360 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10361 | |
| 10362 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10363 | * analog-loopback mixer widget |
| 10364 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10365 | * front panel mic (mic 2) |
| 10366 | */ |
| 10367 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10370 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10371 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10372 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10373 | |
| 10374 | /* |
| 10375 | * Set up output mixers (0x0c - 0x0e) |
| 10376 | */ |
| 10377 | /* set vol=0 to output mixers */ |
| 10378 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10379 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10380 | |
| 10381 | /* set up input amps for analog loopback */ |
| 10382 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10383 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10384 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10385 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10386 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10387 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10388 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10389 | |
| 10390 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10391 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10392 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10393 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10394 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10395 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10396 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10397 | |
| 10398 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10399 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10400 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10401 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10402 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10403 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10404 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10405 | |
| 10406 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10407 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10408 | |
| 10409 | /* FIXME: use matrix-type input source selection */ |
| 10410 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10411 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10412 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10413 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10414 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10415 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10416 | |
| 10417 | /* set EAPD */ |
| 10418 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10419 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10420 | { } |
| 10421 | }; |
| 10422 | |
| 10423 | /* add playback controls from the parsed DAC table */ |
| 10424 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10425 | const struct auto_pin_cfg *cfg) |
| 10426 | { |
| 10427 | hda_nid_t nid; |
| 10428 | int err; |
| 10429 | |
| 10430 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10431 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10432 | spec->multiout.dac_nids[0] = 2; |
| 10433 | |
| 10434 | nid = cfg->line_out_pins[0]; |
| 10435 | if (nid) { |
| 10436 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10437 | "Front Playback Volume", |
| 10438 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10439 | if (err < 0) |
| 10440 | return err; |
| 10441 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10442 | "Front Playback Switch", |
| 10443 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10444 | if (err < 0) |
| 10445 | return err; |
| 10446 | } |
| 10447 | |
| 10448 | nid = cfg->speaker_pins[0]; |
| 10449 | if (nid) { |
| 10450 | if (!cfg->line_out_pins[0]) { |
| 10451 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10452 | "Speaker Playback Volume", |
| 10453 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10454 | HDA_OUTPUT)); |
| 10455 | if (err < 0) |
| 10456 | return err; |
| 10457 | } |
| 10458 | if (nid == 0x16) { |
| 10459 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10460 | "Speaker Playback Switch", |
| 10461 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10462 | HDA_OUTPUT)); |
| 10463 | if (err < 0) |
| 10464 | return err; |
| 10465 | } else { |
| 10466 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10467 | "Speaker Playback Switch", |
| 10468 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10469 | HDA_OUTPUT)); |
| 10470 | if (err < 0) |
| 10471 | return err; |
| 10472 | } |
| 10473 | } |
| 10474 | nid = cfg->hp_pins[0]; |
| 10475 | if (nid) { |
| 10476 | /* spec->multiout.hp_nid = 2; */ |
| 10477 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10478 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10479 | "Headphone Playback Volume", |
| 10480 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10481 | HDA_OUTPUT)); |
| 10482 | if (err < 0) |
| 10483 | return err; |
| 10484 | } |
| 10485 | if (nid == 0x16) { |
| 10486 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10487 | "Headphone Playback Switch", |
| 10488 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10489 | HDA_OUTPUT)); |
| 10490 | if (err < 0) |
| 10491 | return err; |
| 10492 | } else { |
| 10493 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10494 | "Headphone Playback Switch", |
| 10495 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10496 | HDA_OUTPUT)); |
| 10497 | if (err < 0) |
| 10498 | return err; |
| 10499 | } |
| 10500 | } |
| 10501 | return 0; |
| 10502 | } |
| 10503 | |
| 10504 | #define alc269_auto_create_analog_input_ctls \ |
| 10505 | alc880_auto_create_analog_input_ctls |
| 10506 | |
| 10507 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10508 | #define alc269_loopbacks alc880_loopbacks |
| 10509 | #endif |
| 10510 | |
| 10511 | /* pcm configuration: identiacal with ALC880 */ |
| 10512 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10513 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10514 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10515 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10516 | |
| 10517 | /* |
| 10518 | * BIOS auto configuration |
| 10519 | */ |
| 10520 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10521 | { |
| 10522 | struct alc_spec *spec = codec->spec; |
| 10523 | int err; |
| 10524 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10525 | |
| 10526 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10527 | alc269_ignore); |
| 10528 | if (err < 0) |
| 10529 | return err; |
| 10530 | |
| 10531 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10532 | if (err < 0) |
| 10533 | return err; |
| 10534 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10535 | if (err < 0) |
| 10536 | return err; |
| 10537 | |
| 10538 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10539 | |
| 10540 | if (spec->autocfg.dig_out_pin) |
| 10541 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10542 | |
| 10543 | if (spec->kctl_alloc) |
| 10544 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10545 | |
| 10546 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10547 | spec->num_mux_defs = 1; |
| 10548 | spec->input_mux = &spec->private_imux; |
| 10549 | |
| 10550 | err = alc_auto_add_mic_boost(codec); |
| 10551 | if (err < 0) |
| 10552 | return err; |
| 10553 | |
| 10554 | return 1; |
| 10555 | } |
| 10556 | |
| 10557 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10558 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10559 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10560 | |
| 10561 | |
| 10562 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10563 | static void alc269_auto_init(struct hda_codec *codec) |
| 10564 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10565 | struct alc_spec *spec = codec->spec; |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10566 | alc269_auto_init_multi_out(codec); |
| 10567 | alc269_auto_init_hp_out(codec); |
| 10568 | alc269_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 10569 | if (spec->unsol_event) |
| 10570 | alc_sku_automute(codec); |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10571 | } |
| 10572 | |
| 10573 | /* |
| 10574 | * configuration and preset |
| 10575 | */ |
| 10576 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10577 | [ALC269_BASIC] = "basic", |
| 10578 | }; |
| 10579 | |
| 10580 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10581 | {} |
| 10582 | }; |
| 10583 | |
| 10584 | static struct alc_config_preset alc269_presets[] = { |
| 10585 | [ALC269_BASIC] = { |
| 10586 | .mixers = { alc269_base_mixer }, |
| 10587 | .init_verbs = { alc269_init_verbs }, |
| 10588 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10589 | .dac_nids = alc269_dac_nids, |
| 10590 | .hp_nid = 0x03, |
| 10591 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10592 | .channel_mode = alc269_modes, |
| 10593 | .input_mux = &alc269_capture_source, |
| 10594 | }, |
| 10595 | }; |
| 10596 | |
| 10597 | static int patch_alc269(struct hda_codec *codec) |
| 10598 | { |
| 10599 | struct alc_spec *spec; |
| 10600 | int board_config; |
| 10601 | int err; |
| 10602 | |
| 10603 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10604 | if (spec == NULL) |
| 10605 | return -ENOMEM; |
| 10606 | |
| 10607 | codec->spec = spec; |
| 10608 | |
| 10609 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10610 | alc269_models, |
| 10611 | alc269_cfg_tbl); |
| 10612 | |
| 10613 | if (board_config < 0) { |
| 10614 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10615 | "trying auto-probe from BIOS...\n"); |
| 10616 | board_config = ALC269_AUTO; |
| 10617 | } |
| 10618 | |
| 10619 | if (board_config == ALC269_AUTO) { |
| 10620 | /* automatic parse from the BIOS config */ |
| 10621 | err = alc269_parse_auto_config(codec); |
| 10622 | if (err < 0) { |
| 10623 | alc_free(codec); |
| 10624 | return err; |
| 10625 | } else if (!err) { |
| 10626 | printk(KERN_INFO |
| 10627 | "hda_codec: Cannot set up configuration " |
| 10628 | "from BIOS. Using base mode...\n"); |
| 10629 | board_config = ALC269_BASIC; |
| 10630 | } |
| 10631 | } |
| 10632 | |
| 10633 | if (board_config != ALC269_AUTO) |
| 10634 | setup_preset(spec, &alc269_presets[board_config]); |
| 10635 | |
| 10636 | spec->stream_name_analog = "ALC269 Analog"; |
| 10637 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10638 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10639 | |
| 10640 | spec->stream_name_digital = "ALC269 Digital"; |
| 10641 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10642 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10643 | |
| 10644 | spec->adc_nids = alc269_adc_nids; |
| 10645 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10646 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10647 | spec->num_mixers++; |
| 10648 | |
| 10649 | codec->patch_ops = alc_patch_ops; |
| 10650 | if (board_config == ALC269_AUTO) |
| 10651 | spec->init_hook = alc269_auto_init; |
| 10652 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10653 | if (!spec->loopback.amplist) |
| 10654 | spec->loopback.amplist = alc269_loopbacks; |
| 10655 | #endif |
| 10656 | |
| 10657 | return 0; |
| 10658 | } |
| 10659 | |
| 10660 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10661 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10662 | */ |
| 10663 | |
| 10664 | /* |
| 10665 | * set the path ways for 2 channel output |
| 10666 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10667 | */ |
| 10668 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10669 | /* set pin widget 1Ah (line in) for input */ |
| 10670 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10671 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10672 | * the vref |
| 10673 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10674 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10675 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10676 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10677 | #if 0 |
| 10678 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10679 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10680 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10681 | { } /* end */ |
| 10682 | }; |
| 10683 | /* |
| 10684 | * 6ch mode |
| 10685 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10686 | */ |
| 10687 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10688 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10689 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10690 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10691 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10692 | |
| 10693 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10694 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10695 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10696 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10697 | #if 0 |
| 10698 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10699 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10700 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10701 | { } /* end */ |
| 10702 | }; |
| 10703 | |
| 10704 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10705 | { 2, alc861_threestack_ch2_init }, |
| 10706 | { 6, alc861_threestack_ch6_init }, |
| 10707 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10708 | /* Set mic1 as input and unmute the mixer */ |
| 10709 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10710 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10711 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10712 | { } /* end */ |
| 10713 | }; |
| 10714 | /* Set mic1 as output and mute mixer */ |
| 10715 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10716 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10717 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10718 | { } /* end */ |
| 10719 | }; |
| 10720 | |
| 10721 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10722 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10723 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10724 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10725 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10726 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10727 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10728 | /* set pin widget 1Ah (line in) for input */ |
| 10729 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10730 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10731 | * the vref |
| 10732 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10733 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10734 | |
| 10735 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10736 | #if 0 |
| 10737 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10738 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10739 | #endif |
| 10740 | { } /* end */ |
| 10741 | }; |
| 10742 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10743 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10744 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10745 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10746 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10747 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10748 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10749 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10750 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10751 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10752 | |
| 10753 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10754 | #if 0 |
| 10755 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10756 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10757 | #endif |
| 10758 | { } /* end */ |
| 10759 | }; |
| 10760 | |
| 10761 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10762 | { 2, alc861_asus_ch2_init }, |
| 10763 | { 6, alc861_asus_ch6_init }, |
| 10764 | }; |
| 10765 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10766 | /* patch-ALC861 */ |
| 10767 | |
| 10768 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10769 | /* output mixer control */ |
| 10770 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10771 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10772 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10773 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10774 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10775 | |
| 10776 | /*Input mixer control */ |
| 10777 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10778 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10779 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10780 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10781 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10782 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10783 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10784 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10785 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10786 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10787 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10788 | /* Capture mixer control */ |
| 10789 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10790 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10791 | { |
| 10792 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10793 | .name = "Capture Source", |
| 10794 | .count = 1, |
| 10795 | .info = alc_mux_enum_info, |
| 10796 | .get = alc_mux_enum_get, |
| 10797 | .put = alc_mux_enum_put, |
| 10798 | }, |
| 10799 | { } /* end */ |
| 10800 | }; |
| 10801 | |
| 10802 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10803 | /* output mixer control */ |
| 10804 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10805 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10806 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10807 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10808 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10809 | |
| 10810 | /* Input mixer control */ |
| 10811 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10812 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10813 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10814 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10815 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10816 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10817 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10818 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10819 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10820 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10821 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10822 | /* Capture mixer control */ |
| 10823 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10824 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10825 | { |
| 10826 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10827 | .name = "Capture Source", |
| 10828 | .count = 1, |
| 10829 | .info = alc_mux_enum_info, |
| 10830 | .get = alc_mux_enum_get, |
| 10831 | .put = alc_mux_enum_put, |
| 10832 | }, |
| 10833 | { |
| 10834 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10835 | .name = "Channel Mode", |
| 10836 | .info = alc_ch_mode_info, |
| 10837 | .get = alc_ch_mode_get, |
| 10838 | .put = alc_ch_mode_put, |
| 10839 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10840 | }, |
| 10841 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10842 | }; |
| 10843 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10844 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10845 | /* output mixer control */ |
| 10846 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10847 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10849 | |
| 10850 | /*Capture mixer control */ |
| 10851 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10852 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10853 | { |
| 10854 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10855 | .name = "Capture Source", |
| 10856 | .count = 1, |
| 10857 | .info = alc_mux_enum_info, |
| 10858 | .get = alc_mux_enum_get, |
| 10859 | .put = alc_mux_enum_put, |
| 10860 | }, |
| 10861 | |
| 10862 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10863 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10864 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10865 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10866 | /* output mixer control */ |
| 10867 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10868 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10869 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10870 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10871 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10872 | |
| 10873 | /* Input mixer control */ |
| 10874 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10875 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10876 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10877 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10878 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10879 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10880 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10881 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10882 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10883 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10884 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10885 | /* Capture mixer control */ |
| 10886 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10887 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10888 | { |
| 10889 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10890 | .name = "Capture Source", |
| 10891 | .count = 1, |
| 10892 | .info = alc_mux_enum_info, |
| 10893 | .get = alc_mux_enum_get, |
| 10894 | .put = alc_mux_enum_put, |
| 10895 | }, |
| 10896 | { |
| 10897 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10898 | .name = "Channel Mode", |
| 10899 | .info = alc_ch_mode_info, |
| 10900 | .get = alc_ch_mode_get, |
| 10901 | .put = alc_ch_mode_put, |
| 10902 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10903 | }, |
| 10904 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10905 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10906 | |
| 10907 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10908 | /* output mixer control */ |
| 10909 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10910 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10911 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10912 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10913 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10914 | |
| 10915 | /* Input mixer control */ |
| 10916 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10917 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10919 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10920 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10921 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10922 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10924 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10925 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10926 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10927 | /* Capture mixer control */ |
| 10928 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10929 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10930 | { |
| 10931 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10932 | .name = "Capture Source", |
| 10933 | .count = 1, |
| 10934 | .info = alc_mux_enum_info, |
| 10935 | .get = alc_mux_enum_get, |
| 10936 | .put = alc_mux_enum_put, |
| 10937 | }, |
| 10938 | { |
| 10939 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10940 | .name = "Channel Mode", |
| 10941 | .info = alc_ch_mode_info, |
| 10942 | .get = alc_ch_mode_get, |
| 10943 | .put = alc_ch_mode_put, |
| 10944 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10945 | }, |
| 10946 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10947 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10948 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10949 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10950 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10951 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10952 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10953 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10954 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10955 | { } |
| 10956 | }; |
| 10957 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10958 | /* |
| 10959 | * generic initialization of ADC, input mixers and output mixers |
| 10960 | */ |
| 10961 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10962 | /* |
| 10963 | * Unmute ADC0 and set the default input to mic-in |
| 10964 | */ |
| 10965 | /* port-A for surround (rear panel) */ |
| 10966 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10967 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10968 | /* port-B for mic-in (rear panel) with vref */ |
| 10969 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10970 | /* port-C for line-in (rear panel) */ |
| 10971 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10972 | /* port-D for Front */ |
| 10973 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10974 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10975 | /* port-E for HP out (front panel) */ |
| 10976 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10977 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10978 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10979 | /* port-F for mic-in (front panel) with vref */ |
| 10980 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10981 | /* port-G for CLFE (rear panel) */ |
| 10982 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10983 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10984 | /* port-H for side (rear panel) */ |
| 10985 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10986 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10987 | /* CD-in */ |
| 10988 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10989 | /* route front mic to ADC1*/ |
| 10990 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10991 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10992 | |
| 10993 | /* Unmute DAC0~3 & spdif out*/ |
| 10994 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10995 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10996 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10997 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10998 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10999 | |
| 11000 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11001 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11002 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11003 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11004 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11005 | |
| 11006 | /* Unmute Stereo Mixer 15 */ |
| 11007 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11008 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11009 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11010 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11011 | |
| 11012 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11013 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11014 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11015 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11016 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11017 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11018 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11019 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11020 | /* hp used DAC 3 (Front) */ |
| 11021 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11022 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11023 | |
| 11024 | { } |
| 11025 | }; |
| 11026 | |
| 11027 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 11028 | /* |
| 11029 | * Unmute ADC0 and set the default input to mic-in |
| 11030 | */ |
| 11031 | /* port-A for surround (rear panel) */ |
| 11032 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11033 | /* port-B for mic-in (rear panel) with vref */ |
| 11034 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11035 | /* port-C for line-in (rear panel) */ |
| 11036 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11037 | /* port-D for Front */ |
| 11038 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11039 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11040 | /* port-E for HP out (front panel) */ |
| 11041 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 11042 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11043 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11044 | /* port-F for mic-in (front panel) with vref */ |
| 11045 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11046 | /* port-G for CLFE (rear panel) */ |
| 11047 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11048 | /* port-H for side (rear panel) */ |
| 11049 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11050 | /* CD-in */ |
| 11051 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11052 | /* route front mic to ADC1*/ |
| 11053 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11054 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11055 | /* Unmute DAC0~3 & spdif out*/ |
| 11056 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11057 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11058 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11059 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11060 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11061 | |
| 11062 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11063 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11064 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11065 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11066 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11067 | |
| 11068 | /* Unmute Stereo Mixer 15 */ |
| 11069 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11071 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11072 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11073 | |
| 11074 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11075 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11076 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11077 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11078 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11079 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11080 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11081 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11082 | /* hp used DAC 3 (Front) */ |
| 11083 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11084 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11085 | { } |
| 11086 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11087 | |
| 11088 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 11089 | /* |
| 11090 | * Unmute ADC0 and set the default input to mic-in |
| 11091 | */ |
| 11092 | /* port-A for surround (rear panel) */ |
| 11093 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11094 | /* port-B for mic-in (rear panel) with vref */ |
| 11095 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11096 | /* port-C for line-in (rear panel) */ |
| 11097 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11098 | /* port-D for Front */ |
| 11099 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11100 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11101 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11102 | /* this has to be set to VREF80 */ |
| 11103 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11104 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11105 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11106 | /* port-F for mic-in (front panel) with vref */ |
| 11107 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11108 | /* port-G for CLFE (rear panel) */ |
| 11109 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11110 | /* port-H for side (rear panel) */ |
| 11111 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11112 | /* CD-in */ |
| 11113 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11114 | /* route front mic to ADC1*/ |
| 11115 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11116 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11117 | /* Unmute DAC0~3 & spdif out*/ |
| 11118 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11119 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11120 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11121 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11122 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11123 | |
| 11124 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11125 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11126 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11127 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11128 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11129 | |
| 11130 | /* Unmute Stereo Mixer 15 */ |
| 11131 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11132 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11133 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11134 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11135 | |
| 11136 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11137 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11138 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11139 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11140 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11141 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11142 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11143 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11144 | /* hp used DAC 3 (Front) */ |
| 11145 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11146 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11147 | { } |
| 11148 | }; |
| 11149 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11150 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 11151 | /* |
| 11152 | * Unmute ADC0 and set the default input to mic-in |
| 11153 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11154 | /* port-A for surround (rear panel) |
| 11155 | * according to codec#0 this is the HP jack |
| 11156 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11157 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 11158 | /* route front PCM to HP */ |
| 11159 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 11160 | /* port-B for mic-in (rear panel) with vref */ |
| 11161 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11162 | /* port-C for line-in (rear panel) */ |
| 11163 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11164 | /* port-D for Front */ |
| 11165 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11166 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 11167 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11168 | /* this has to be set to VREF80 */ |
| 11169 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11170 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 11171 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11172 | /* port-F for mic-in (front panel) with vref */ |
| 11173 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 11174 | /* port-G for CLFE (rear panel) */ |
| 11175 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11176 | /* port-H for side (rear panel) */ |
| 11177 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 11178 | /* CD-in */ |
| 11179 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 11180 | /* route front mic to ADC1*/ |
| 11181 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11182 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11183 | /* Unmute DAC0~3 & spdif out*/ |
| 11184 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11185 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11186 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11187 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11188 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11189 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11190 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11191 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11192 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11193 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11194 | |
| 11195 | /* Unmute Stereo Mixer 15 */ |
| 11196 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11197 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11198 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11199 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11200 | |
| 11201 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11202 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11203 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11204 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11205 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11206 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11207 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11208 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11209 | /* hp used DAC 3 (Front) */ |
| 11210 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11211 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11212 | { } |
| 11213 | }; |
| 11214 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11215 | /* additional init verbs for ASUS laptops */ |
| 11216 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 11217 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 11218 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 11219 | { } |
| 11220 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11221 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11222 | /* |
| 11223 | * generic initialization of ADC, input mixers and output mixers |
| 11224 | */ |
| 11225 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 11226 | /* |
| 11227 | * Unmute ADC0 and set the default input to mic-in |
| 11228 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11229 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11230 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11231 | |
| 11232 | /* Unmute DAC0~3 & spdif out*/ |
| 11233 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11234 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11235 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11236 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11237 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11238 | |
| 11239 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 11240 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11241 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11242 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11243 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11244 | |
| 11245 | /* Unmute Stereo Mixer 15 */ |
| 11246 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11247 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11248 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11249 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 11250 | |
| 11251 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11252 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11253 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11254 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11255 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11256 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11257 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11258 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11259 | |
| 11260 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11261 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11262 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11263 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11264 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11265 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11266 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11267 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11268 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11269 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11270 | |
| 11271 | { } |
| 11272 | }; |
| 11273 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11274 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11275 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11276 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11277 | { } |
| 11278 | }; |
| 11279 | |
| 11280 | /* toggle speaker-output according to the hp-jack state */ |
| 11281 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11282 | { |
| 11283 | unsigned int present; |
| 11284 | |
| 11285 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11286 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11287 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11288 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11289 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11290 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11291 | } |
| 11292 | |
| 11293 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11294 | unsigned int res) |
| 11295 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11296 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11297 | alc861_toshiba_automute(codec); |
| 11298 | } |
| 11299 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11300 | /* pcm configuration: identiacal with ALC880 */ |
| 11301 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11302 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11303 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11304 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11305 | |
| 11306 | |
| 11307 | #define ALC861_DIGOUT_NID 0x07 |
| 11308 | |
| 11309 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11310 | { 8, NULL } |
| 11311 | }; |
| 11312 | |
| 11313 | static hda_nid_t alc861_dac_nids[4] = { |
| 11314 | /* front, surround, clfe, side */ |
| 11315 | 0x03, 0x06, 0x05, 0x04 |
| 11316 | }; |
| 11317 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11318 | static hda_nid_t alc660_dac_nids[3] = { |
| 11319 | /* front, clfe, surround */ |
| 11320 | 0x03, 0x05, 0x06 |
| 11321 | }; |
| 11322 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11323 | static hda_nid_t alc861_adc_nids[1] = { |
| 11324 | /* ADC0-2 */ |
| 11325 | 0x08, |
| 11326 | }; |
| 11327 | |
| 11328 | static struct hda_input_mux alc861_capture_source = { |
| 11329 | .num_items = 5, |
| 11330 | .items = { |
| 11331 | { "Mic", 0x0 }, |
| 11332 | { "Front Mic", 0x3 }, |
| 11333 | { "Line", 0x1 }, |
| 11334 | { "CD", 0x4 }, |
| 11335 | { "Mixer", 0x5 }, |
| 11336 | }, |
| 11337 | }; |
| 11338 | |
| 11339 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11340 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11341 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11342 | { |
| 11343 | int i; |
| 11344 | hda_nid_t nid; |
| 11345 | |
| 11346 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11347 | for (i = 0; i < cfg->line_outs; i++) { |
| 11348 | nid = cfg->line_out_pins[i]; |
| 11349 | if (nid) { |
| 11350 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11351 | continue; |
| 11352 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11353 | } |
| 11354 | } |
| 11355 | spec->multiout.num_dacs = cfg->line_outs; |
| 11356 | return 0; |
| 11357 | } |
| 11358 | |
| 11359 | /* add playback controls from the parsed DAC table */ |
| 11360 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11361 | const struct auto_pin_cfg *cfg) |
| 11362 | { |
| 11363 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11364 | static const char *chname[4] = { |
| 11365 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11366 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11367 | hda_nid_t nid; |
| 11368 | int i, idx, err; |
| 11369 | |
| 11370 | for (i = 0; i < cfg->line_outs; i++) { |
| 11371 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11372 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11373 | continue; |
| 11374 | if (nid == 0x05) { |
| 11375 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11376 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11377 | "Center Playback Switch", |
| 11378 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11379 | HDA_OUTPUT)); |
| 11380 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11381 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11382 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11383 | "LFE Playback Switch", |
| 11384 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11385 | HDA_OUTPUT)); |
| 11386 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11387 | return err; |
| 11388 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11389 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11390 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11391 | if (nid == alc861_dac_nids[idx]) |
| 11392 | break; |
| 11393 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11394 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11395 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11396 | HDA_OUTPUT)); |
| 11397 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11398 | return err; |
| 11399 | } |
| 11400 | } |
| 11401 | return 0; |
| 11402 | } |
| 11403 | |
| 11404 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11405 | { |
| 11406 | int err; |
| 11407 | hda_nid_t nid; |
| 11408 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11409 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11410 | return 0; |
| 11411 | |
| 11412 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11413 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11414 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11415 | "Headphone Playback Switch", |
| 11416 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11417 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11418 | return err; |
| 11419 | spec->multiout.hp_nid = nid; |
| 11420 | } |
| 11421 | return 0; |
| 11422 | } |
| 11423 | |
| 11424 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11425 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11426 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11427 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11428 | struct hda_input_mux *imux = &spec->private_imux; |
| 11429 | int i, err, idx, idx1; |
| 11430 | |
| 11431 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11432 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11433 | case 0x0c: |
| 11434 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11435 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11436 | break; |
| 11437 | case 0x0f: |
| 11438 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11439 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11440 | break; |
| 11441 | case 0x0d: |
| 11442 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11443 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11444 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11445 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11446 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11447 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11448 | break; |
| 11449 | case 0x11: |
| 11450 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11451 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11452 | break; |
| 11453 | default: |
| 11454 | continue; |
| 11455 | } |
| 11456 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11457 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11458 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11459 | if (err < 0) |
| 11460 | return err; |
| 11461 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11462 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11463 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11464 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11465 | } |
| 11466 | return 0; |
| 11467 | } |
| 11468 | |
| 11469 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11470 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11471 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11472 | |
| 11473 | { |
| 11474 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11475 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11476 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11477 | */ |
| 11478 | /* .name = "Capture Source", */ |
| 11479 | .name = "Input Source", |
| 11480 | .count = 1, |
| 11481 | .info = alc_mux_enum_info, |
| 11482 | .get = alc_mux_enum_get, |
| 11483 | .put = alc_mux_enum_put, |
| 11484 | }, |
| 11485 | { } /* end */ |
| 11486 | }; |
| 11487 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11488 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11489 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11490 | int pin_type, int dac_idx) |
| 11491 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11492 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11493 | } |
| 11494 | |
| 11495 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11496 | { |
| 11497 | struct alc_spec *spec = codec->spec; |
| 11498 | int i; |
| 11499 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11500 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11501 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11502 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11503 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11504 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11505 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11506 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11507 | } |
| 11508 | } |
| 11509 | |
| 11510 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11511 | { |
| 11512 | struct alc_spec *spec = codec->spec; |
| 11513 | hda_nid_t pin; |
| 11514 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11515 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11516 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11517 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11518 | spec->multiout.dac_nids[0]); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11519 | pin = spec->autocfg.speaker_pins[0]; |
| 11520 | if (pin) |
| 11521 | alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11522 | } |
| 11523 | |
| 11524 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11525 | { |
| 11526 | struct alc_spec *spec = codec->spec; |
| 11527 | int i; |
| 11528 | |
| 11529 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11530 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11531 | if (nid >= 0x0c && nid <= 0x11) { |
| 11532 | snd_hda_codec_write(codec, nid, 0, |
| 11533 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11534 | i <= AUTO_PIN_FRONT_MIC ? |
| 11535 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11536 | } |
| 11537 | } |
| 11538 | } |
| 11539 | |
| 11540 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11541 | /* return 1 if successful, 0 if the proper config is not found, |
| 11542 | * or a negative error code |
| 11543 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11544 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11545 | { |
| 11546 | struct alc_spec *spec = codec->spec; |
| 11547 | int err; |
| 11548 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11549 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11550 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11551 | alc861_ignore); |
| 11552 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11553 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11554 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11555 | return 0; /* can't find valid BIOS pin config */ |
| 11556 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11557 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11558 | if (err < 0) |
| 11559 | return err; |
| 11560 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11561 | if (err < 0) |
| 11562 | return err; |
| 11563 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11564 | if (err < 0) |
| 11565 | return err; |
| 11566 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11567 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11568 | return err; |
| 11569 | |
| 11570 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11571 | |
| 11572 | if (spec->autocfg.dig_out_pin) |
| 11573 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11574 | |
| 11575 | if (spec->kctl_alloc) |
| 11576 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11577 | |
| 11578 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11579 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11580 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11581 | spec->input_mux = &spec->private_imux; |
| 11582 | |
| 11583 | spec->adc_nids = alc861_adc_nids; |
| 11584 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11585 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11586 | spec->num_mixers++; |
| 11587 | |
| 11588 | return 1; |
| 11589 | } |
| 11590 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11591 | /* additional initialization for auto-configuration model */ |
| 11592 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11593 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11594 | struct alc_spec *spec = codec->spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11595 | alc861_auto_init_multi_out(codec); |
| 11596 | alc861_auto_init_hp_out(codec); |
| 11597 | alc861_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 11598 | if (spec->unsol_event) |
| 11599 | alc_sku_automute(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11600 | } |
| 11601 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11602 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11603 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11604 | { 0x15, HDA_INPUT, 0 }, |
| 11605 | { 0x15, HDA_INPUT, 1 }, |
| 11606 | { 0x15, HDA_INPUT, 2 }, |
| 11607 | { 0x15, HDA_INPUT, 3 }, |
| 11608 | { } /* end */ |
| 11609 | }; |
| 11610 | #endif |
| 11611 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11612 | |
| 11613 | /* |
| 11614 | * configuration and preset |
| 11615 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11616 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11617 | [ALC861_3ST] = "3stack", |
| 11618 | [ALC660_3ST] = "3stack-660", |
| 11619 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11620 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11621 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11622 | [ALC861_TOSHIBA] = "toshiba", |
| 11623 | [ALC861_ASUS] = "asus", |
| 11624 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11625 | [ALC861_AUTO] = "auto", |
| 11626 | }; |
| 11627 | |
| 11628 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11629 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11630 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11631 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11632 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11633 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11634 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11635 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11636 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11637 | * Any other models that need this preset? |
| 11638 | */ |
| 11639 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11640 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11641 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11642 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11643 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11644 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11645 | /* FIXME: the below seems conflict */ |
| 11646 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11647 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11648 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11649 | {} |
| 11650 | }; |
| 11651 | |
| 11652 | static struct alc_config_preset alc861_presets[] = { |
| 11653 | [ALC861_3ST] = { |
| 11654 | .mixers = { alc861_3ST_mixer }, |
| 11655 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11656 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11657 | .dac_nids = alc861_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, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11661 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11662 | .adc_nids = alc861_adc_nids, |
| 11663 | .input_mux = &alc861_capture_source, |
| 11664 | }, |
| 11665 | [ALC861_3ST_DIG] = { |
| 11666 | .mixers = { alc861_base_mixer }, |
| 11667 | .init_verbs = { alc861_threestack_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_threestack_modes), |
| 11672 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11673 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11674 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11675 | .adc_nids = alc861_adc_nids, |
| 11676 | .input_mux = &alc861_capture_source, |
| 11677 | }, |
| 11678 | [ALC861_6ST_DIG] = { |
| 11679 | .mixers = { alc861_base_mixer }, |
| 11680 | .init_verbs = { alc861_base_init_verbs }, |
| 11681 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11682 | .dac_nids = alc861_dac_nids, |
| 11683 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11684 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11685 | .channel_mode = alc861_8ch_modes, |
| 11686 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11687 | .adc_nids = alc861_adc_nids, |
| 11688 | .input_mux = &alc861_capture_source, |
| 11689 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11690 | [ALC660_3ST] = { |
| 11691 | .mixers = { alc861_3ST_mixer }, |
| 11692 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11693 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11694 | .dac_nids = alc660_dac_nids, |
| 11695 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11696 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11697 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11698 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11699 | .adc_nids = alc861_adc_nids, |
| 11700 | .input_mux = &alc861_capture_source, |
| 11701 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11702 | [ALC861_UNIWILL_M31] = { |
| 11703 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11704 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11705 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11706 | .dac_nids = alc861_dac_nids, |
| 11707 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11708 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11709 | .channel_mode = alc861_uniwill_m31_modes, |
| 11710 | .need_dac_fix = 1, |
| 11711 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11712 | .adc_nids = alc861_adc_nids, |
| 11713 | .input_mux = &alc861_capture_source, |
| 11714 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11715 | [ALC861_TOSHIBA] = { |
| 11716 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11717 | .init_verbs = { alc861_base_init_verbs, |
| 11718 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11719 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11720 | .dac_nids = alc861_dac_nids, |
| 11721 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11722 | .channel_mode = alc883_3ST_2ch_modes, |
| 11723 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11724 | .adc_nids = alc861_adc_nids, |
| 11725 | .input_mux = &alc861_capture_source, |
| 11726 | .unsol_event = alc861_toshiba_unsol_event, |
| 11727 | .init_hook = alc861_toshiba_automute, |
| 11728 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11729 | [ALC861_ASUS] = { |
| 11730 | .mixers = { alc861_asus_mixer }, |
| 11731 | .init_verbs = { alc861_asus_init_verbs }, |
| 11732 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11733 | .dac_nids = alc861_dac_nids, |
| 11734 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11735 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11736 | .channel_mode = alc861_asus_modes, |
| 11737 | .need_dac_fix = 1, |
| 11738 | .hp_nid = 0x06, |
| 11739 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11740 | .adc_nids = alc861_adc_nids, |
| 11741 | .input_mux = &alc861_capture_source, |
| 11742 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11743 | [ALC861_ASUS_LAPTOP] = { |
| 11744 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11745 | .init_verbs = { alc861_asus_init_verbs, |
| 11746 | alc861_asus_laptop_init_verbs }, |
| 11747 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11748 | .dac_nids = alc861_dac_nids, |
| 11749 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11750 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11751 | .channel_mode = alc883_3ST_2ch_modes, |
| 11752 | .need_dac_fix = 1, |
| 11753 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11754 | .adc_nids = alc861_adc_nids, |
| 11755 | .input_mux = &alc861_capture_source, |
| 11756 | }, |
| 11757 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11758 | |
| 11759 | |
| 11760 | static int patch_alc861(struct hda_codec *codec) |
| 11761 | { |
| 11762 | struct alc_spec *spec; |
| 11763 | int board_config; |
| 11764 | int err; |
| 11765 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11766 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11767 | if (spec == NULL) |
| 11768 | return -ENOMEM; |
| 11769 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11770 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11771 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11772 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11773 | alc861_models, |
| 11774 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11775 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11776 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11777 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11778 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11779 | board_config = ALC861_AUTO; |
| 11780 | } |
| 11781 | |
| 11782 | if (board_config == ALC861_AUTO) { |
| 11783 | /* automatic parse from the BIOS config */ |
| 11784 | err = alc861_parse_auto_config(codec); |
| 11785 | if (err < 0) { |
| 11786 | alc_free(codec); |
| 11787 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11788 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11789 | printk(KERN_INFO |
| 11790 | "hda_codec: Cannot set up configuration " |
| 11791 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11792 | board_config = ALC861_3ST_DIG; |
| 11793 | } |
| 11794 | } |
| 11795 | |
| 11796 | if (board_config != ALC861_AUTO) |
| 11797 | setup_preset(spec, &alc861_presets[board_config]); |
| 11798 | |
| 11799 | spec->stream_name_analog = "ALC861 Analog"; |
| 11800 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11801 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11802 | |
| 11803 | spec->stream_name_digital = "ALC861 Digital"; |
| 11804 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11805 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11806 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11807 | spec->vmaster_nid = 0x03; |
| 11808 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11809 | codec->patch_ops = alc_patch_ops; |
| 11810 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11811 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11812 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11813 | if (!spec->loopback.amplist) |
| 11814 | spec->loopback.amplist = alc861_loopbacks; |
| 11815 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11816 | |
| 11817 | return 0; |
| 11818 | } |
| 11819 | |
| 11820 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11821 | * ALC861-VD support |
| 11822 | * |
| 11823 | * Based on ALC882 |
| 11824 | * |
| 11825 | * In addition, an independent DAC |
| 11826 | */ |
| 11827 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11828 | |
| 11829 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11830 | /* front, surr, clfe, side surr */ |
| 11831 | 0x02, 0x03, 0x04, 0x05 |
| 11832 | }; |
| 11833 | |
| 11834 | /* dac_nids for ALC660vd are in a different order - according to |
| 11835 | * Realtek's driver. |
| 11836 | * This should probably tesult in a different mixer for 6stack models |
| 11837 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11838 | * - and it is the same as in 861vd. |
| 11839 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11840 | */ |
| 11841 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11842 | /* front, rear, clfe, rear_surr */ |
| 11843 | 0x02, 0x04, 0x03 |
| 11844 | }; |
| 11845 | |
| 11846 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11847 | /* ADC0 */ |
| 11848 | 0x09, |
| 11849 | }; |
| 11850 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11851 | static hda_nid_t alc861vd_capsrc_nids[1] = { 0x22 }; |
| 11852 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11853 | /* input MUX */ |
| 11854 | /* FIXME: should be a matrix-type input source selection */ |
| 11855 | static struct hda_input_mux alc861vd_capture_source = { |
| 11856 | .num_items = 4, |
| 11857 | .items = { |
| 11858 | { "Mic", 0x0 }, |
| 11859 | { "Front Mic", 0x1 }, |
| 11860 | { "Line", 0x2 }, |
| 11861 | { "CD", 0x4 }, |
| 11862 | }, |
| 11863 | }; |
| 11864 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11865 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11866 | .num_items = 3, |
| 11867 | .items = { |
| 11868 | { "Front Mic", 0x0 }, |
| 11869 | { "ATAPI Mic", 0x1 }, |
| 11870 | { "Line In", 0x5 }, |
| 11871 | }, |
| 11872 | }; |
| 11873 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11874 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11875 | .num_items = 2, |
| 11876 | .items = { |
| 11877 | { "Front Mic", 0x0 }, |
| 11878 | { "ATAPI Mic", 0x1 }, |
| 11879 | }, |
| 11880 | }; |
| 11881 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11882 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11883 | #define alc861vd_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 11884 | /* ALC861VD has the ALC882-type input selection (but has only one ADC) */ |
| 11885 | #define alc861vd_mux_enum_put alc882_mux_enum_put |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11886 | |
| 11887 | /* |
| 11888 | * 2ch mode |
| 11889 | */ |
| 11890 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11891 | { 2, NULL } |
| 11892 | }; |
| 11893 | |
| 11894 | /* |
| 11895 | * 6ch mode |
| 11896 | */ |
| 11897 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11898 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11899 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11900 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11901 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11902 | { } /* end */ |
| 11903 | }; |
| 11904 | |
| 11905 | /* |
| 11906 | * 8ch mode |
| 11907 | */ |
| 11908 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11909 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11910 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11911 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11912 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11913 | { } /* end */ |
| 11914 | }; |
| 11915 | |
| 11916 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11917 | { 6, alc861vd_6stack_ch6_init }, |
| 11918 | { 8, alc861vd_6stack_ch8_init }, |
| 11919 | }; |
| 11920 | |
| 11921 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11922 | { |
| 11923 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11924 | .name = "Channel Mode", |
| 11925 | .info = alc_ch_mode_info, |
| 11926 | .get = alc_ch_mode_get, |
| 11927 | .put = alc_ch_mode_put, |
| 11928 | }, |
| 11929 | { } /* end */ |
| 11930 | }; |
| 11931 | |
| 11932 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11933 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11934 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11935 | |
| 11936 | { |
| 11937 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11938 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11939 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11940 | */ |
| 11941 | /* .name = "Capture Source", */ |
| 11942 | .name = "Input Source", |
| 11943 | .count = 1, |
| 11944 | .info = alc861vd_mux_enum_info, |
| 11945 | .get = alc861vd_mux_enum_get, |
| 11946 | .put = alc861vd_mux_enum_put, |
| 11947 | }, |
| 11948 | { } /* end */ |
| 11949 | }; |
| 11950 | |
| 11951 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11952 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11953 | */ |
| 11954 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11955 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11956 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11957 | |
| 11958 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11959 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11960 | |
| 11961 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11962 | HDA_OUTPUT), |
| 11963 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11964 | HDA_OUTPUT), |
| 11965 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11966 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11967 | |
| 11968 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11969 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11970 | |
| 11971 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11972 | |
| 11973 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11974 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11975 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11976 | |
| 11977 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11978 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11979 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11980 | |
| 11981 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11982 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11983 | |
| 11984 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11985 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11986 | |
| 11987 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11988 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11989 | |
| 11990 | { } /* end */ |
| 11991 | }; |
| 11992 | |
| 11993 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11994 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11995 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11996 | |
| 11997 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11998 | |
| 11999 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12000 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12001 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12002 | |
| 12003 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12004 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12005 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12006 | |
| 12007 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12008 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12009 | |
| 12010 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12011 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12012 | |
| 12013 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12014 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 12015 | |
| 12016 | { } /* end */ |
| 12017 | }; |
| 12018 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12019 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 12020 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12021 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 12022 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12023 | |
| 12024 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12025 | |
| 12026 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 12027 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12028 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12029 | |
| 12030 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 12031 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12032 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12033 | |
| 12034 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12035 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12036 | |
| 12037 | { } /* end */ |
| 12038 | }; |
| 12039 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12040 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 12041 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 12042 | */ |
| 12043 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 12044 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12045 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12046 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12047 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12048 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12049 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12050 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12051 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12052 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12053 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12054 | { } /* end */ |
| 12055 | }; |
| 12056 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12057 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 12058 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 12059 | */ |
| 12060 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 12061 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12062 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12063 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12064 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 12065 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12066 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12067 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12068 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12069 | |
| 12070 | { } /* end */ |
| 12071 | }; |
| 12072 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12073 | /* |
| 12074 | * generic initialization of ADC, input mixers and output mixers |
| 12075 | */ |
| 12076 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 12077 | /* |
| 12078 | * Unmute ADC0 and set the default input to mic-in |
| 12079 | */ |
| 12080 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12081 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12082 | |
| 12083 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 12084 | * the analog-loopback mixer widget |
| 12085 | */ |
| 12086 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12089 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12090 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12091 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12092 | |
| 12093 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12095 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12096 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12097 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12098 | |
| 12099 | /* |
| 12100 | * Set up output mixers (0x02 - 0x05) |
| 12101 | */ |
| 12102 | /* set vol=0 to output mixers */ |
| 12103 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12104 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12105 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12106 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12107 | |
| 12108 | /* set up input amps for analog loopback */ |
| 12109 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 12110 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12111 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12112 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12113 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12114 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12115 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12116 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12117 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12118 | |
| 12119 | { } |
| 12120 | }; |
| 12121 | |
| 12122 | /* |
| 12123 | * 3-stack pin configuration: |
| 12124 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 12125 | */ |
| 12126 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 12127 | /* |
| 12128 | * Set pin mode and muting |
| 12129 | */ |
| 12130 | /* set front pin widgets 0x14 for output */ |
| 12131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12132 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12133 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12134 | |
| 12135 | /* Mic (rear) pin: input vref at 80% */ |
| 12136 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12137 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12138 | /* Front Mic pin: input vref at 80% */ |
| 12139 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12140 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12141 | /* Line In pin: input */ |
| 12142 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12143 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12144 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12145 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12146 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12147 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12148 | /* CD pin widget for input */ |
| 12149 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12150 | |
| 12151 | { } |
| 12152 | }; |
| 12153 | |
| 12154 | /* |
| 12155 | * 6-stack pin configuration: |
| 12156 | */ |
| 12157 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 12158 | /* |
| 12159 | * Set pin mode and muting |
| 12160 | */ |
| 12161 | /* set front pin widgets 0x14 for output */ |
| 12162 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12163 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12164 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12165 | |
| 12166 | /* Rear Pin: output 1 (0x0d) */ |
| 12167 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12169 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 12170 | /* CLFE Pin: output 2 (0x0e) */ |
| 12171 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12172 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12173 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 12174 | /* Side Pin: output 3 (0x0f) */ |
| 12175 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12176 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12177 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 12178 | |
| 12179 | /* Mic (rear) pin: input vref at 80% */ |
| 12180 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12181 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12182 | /* Front Mic pin: input vref at 80% */ |
| 12183 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12184 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12185 | /* Line In pin: input */ |
| 12186 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12187 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12188 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12189 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12190 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12191 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12192 | /* CD pin widget for input */ |
| 12193 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12194 | |
| 12195 | { } |
| 12196 | }; |
| 12197 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12198 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 12199 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 12200 | { } |
| 12201 | }; |
| 12202 | |
| 12203 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 12204 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12205 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12206 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 12207 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12208 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12209 | {} |
| 12210 | }; |
| 12211 | |
| 12212 | /* toggle speaker-output according to the hp-jack state */ |
| 12213 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 12214 | { |
| 12215 | unsigned int present; |
| 12216 | unsigned char bits; |
| 12217 | |
| 12218 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12219 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12220 | bits = present ? HDA_AMP_MUTE : 0; |
| 12221 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12222 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12223 | } |
| 12224 | |
| 12225 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 12226 | { |
| 12227 | unsigned int present; |
| 12228 | unsigned char bits; |
| 12229 | |
| 12230 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12231 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12232 | bits = present ? HDA_AMP_MUTE : 0; |
| 12233 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 12234 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12235 | } |
| 12236 | |
| 12237 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 12238 | { |
| 12239 | alc861vd_lenovo_hp_automute(codec); |
| 12240 | alc861vd_lenovo_mic_automute(codec); |
| 12241 | } |
| 12242 | |
| 12243 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12244 | unsigned int res) |
| 12245 | { |
| 12246 | switch (res >> 26) { |
| 12247 | case ALC880_HP_EVENT: |
| 12248 | alc861vd_lenovo_hp_automute(codec); |
| 12249 | break; |
| 12250 | case ALC880_MIC_EVENT: |
| 12251 | alc861vd_lenovo_mic_automute(codec); |
| 12252 | break; |
| 12253 | } |
| 12254 | } |
| 12255 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12256 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12257 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12258 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12259 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12260 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12261 | |
| 12262 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12263 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12264 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12265 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12266 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12267 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12268 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12269 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12270 | |
| 12271 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12272 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12273 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12274 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12275 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12276 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12277 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12278 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12279 | |
| 12280 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12281 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12282 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12283 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12284 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12286 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12287 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12288 | |
| 12289 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12290 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12291 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12292 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12293 | |
| 12294 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12295 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12296 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12297 | |
| 12298 | { } /* end */ |
| 12299 | }; |
| 12300 | |
| 12301 | /* toggle speaker-output according to the hp-jack state */ |
| 12302 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12303 | { |
| 12304 | unsigned int present; |
| 12305 | |
| 12306 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12307 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12308 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12309 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12310 | } |
| 12311 | |
| 12312 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12313 | { |
| 12314 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12315 | alc861vd_dallas_automute(codec); |
| 12316 | } |
| 12317 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12318 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12319 | #define alc861vd_loopbacks alc880_loopbacks |
| 12320 | #endif |
| 12321 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12322 | /* pcm configuration: identiacal with ALC880 */ |
| 12323 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12324 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12325 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12326 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12327 | |
| 12328 | /* |
| 12329 | * configuration and preset |
| 12330 | */ |
| 12331 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12332 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12333 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12334 | [ALC861VD_3ST] = "3stack", |
| 12335 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12336 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12337 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12338 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12339 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12340 | [ALC861VD_AUTO] = "auto", |
| 12341 | }; |
| 12342 | |
| 12343 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12344 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12345 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12346 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12347 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12348 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12349 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12350 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12351 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12352 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12353 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12354 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12355 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12356 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12357 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12358 | {} |
| 12359 | }; |
| 12360 | |
| 12361 | static struct alc_config_preset alc861vd_presets[] = { |
| 12362 | [ALC660VD_3ST] = { |
| 12363 | .mixers = { alc861vd_3st_mixer }, |
| 12364 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12365 | alc861vd_3stack_init_verbs }, |
| 12366 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12367 | .dac_nids = alc660vd_dac_nids, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12368 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12369 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12370 | .input_mux = &alc861vd_capture_source, |
| 12371 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12372 | [ALC660VD_3ST_DIG] = { |
| 12373 | .mixers = { alc861vd_3st_mixer }, |
| 12374 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12375 | alc861vd_3stack_init_verbs }, |
| 12376 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12377 | .dac_nids = alc660vd_dac_nids, |
| 12378 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12379 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12380 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12381 | .input_mux = &alc861vd_capture_source, |
| 12382 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12383 | [ALC861VD_3ST] = { |
| 12384 | .mixers = { alc861vd_3st_mixer }, |
| 12385 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12386 | alc861vd_3stack_init_verbs }, |
| 12387 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12388 | .dac_nids = alc861vd_dac_nids, |
| 12389 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12390 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12391 | .input_mux = &alc861vd_capture_source, |
| 12392 | }, |
| 12393 | [ALC861VD_3ST_DIG] = { |
| 12394 | .mixers = { alc861vd_3st_mixer }, |
| 12395 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12396 | alc861vd_3stack_init_verbs }, |
| 12397 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12398 | .dac_nids = alc861vd_dac_nids, |
| 12399 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12400 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12401 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12402 | .input_mux = &alc861vd_capture_source, |
| 12403 | }, |
| 12404 | [ALC861VD_6ST_DIG] = { |
| 12405 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12406 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12407 | alc861vd_6stack_init_verbs }, |
| 12408 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12409 | .dac_nids = alc861vd_dac_nids, |
| 12410 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12411 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12412 | .channel_mode = alc861vd_6stack_modes, |
| 12413 | .input_mux = &alc861vd_capture_source, |
| 12414 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12415 | [ALC861VD_LENOVO] = { |
| 12416 | .mixers = { alc861vd_lenovo_mixer }, |
| 12417 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12418 | alc861vd_3stack_init_verbs, |
| 12419 | alc861vd_eapd_verbs, |
| 12420 | alc861vd_lenovo_unsol_verbs }, |
| 12421 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12422 | .dac_nids = alc660vd_dac_nids, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12423 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12424 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12425 | .input_mux = &alc861vd_capture_source, |
| 12426 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12427 | .init_hook = alc861vd_lenovo_automute, |
| 12428 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12429 | [ALC861VD_DALLAS] = { |
| 12430 | .mixers = { alc861vd_dallas_mixer }, |
| 12431 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12432 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12433 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12434 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12435 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12436 | .input_mux = &alc861vd_dallas_capture_source, |
| 12437 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12438 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12439 | }, |
| 12440 | [ALC861VD_HP] = { |
| 12441 | .mixers = { alc861vd_hp_mixer }, |
| 12442 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12443 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12444 | .dac_nids = alc861vd_dac_nids, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12445 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12446 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12447 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12448 | .input_mux = &alc861vd_hp_capture_source, |
| 12449 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12450 | .init_hook = alc861vd_dallas_automute, |
| 12451 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12452 | }; |
| 12453 | |
| 12454 | /* |
| 12455 | * BIOS auto configuration |
| 12456 | */ |
| 12457 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12458 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12459 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12460 | alc_set_pin_output(codec, nid, pin_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12461 | } |
| 12462 | |
| 12463 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12464 | { |
| 12465 | struct alc_spec *spec = codec->spec; |
| 12466 | int i; |
| 12467 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12468 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12469 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12470 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12471 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12472 | if (nid) |
| 12473 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12474 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12475 | } |
| 12476 | } |
| 12477 | |
| 12478 | |
| 12479 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12480 | { |
| 12481 | struct alc_spec *spec = codec->spec; |
| 12482 | hda_nid_t pin; |
| 12483 | |
| 12484 | pin = spec->autocfg.hp_pins[0]; |
| 12485 | if (pin) /* connect to front and use dac 0 */ |
| 12486 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12487 | pin = spec->autocfg.speaker_pins[0]; |
| 12488 | if (pin) |
| 12489 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12490 | } |
| 12491 | |
| 12492 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12493 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12494 | |
| 12495 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12496 | { |
| 12497 | struct alc_spec *spec = codec->spec; |
| 12498 | int i; |
| 12499 | |
| 12500 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12501 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12502 | if (alc861vd_is_input_pin(nid)) { |
| 12503 | snd_hda_codec_write(codec, nid, 0, |
| 12504 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12505 | i <= AUTO_PIN_FRONT_MIC ? |
| 12506 | PIN_VREF80 : PIN_IN); |
| 12507 | if (nid != ALC861VD_PIN_CD_NID) |
| 12508 | snd_hda_codec_write(codec, nid, 0, |
| 12509 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12510 | AMP_OUT_MUTE); |
| 12511 | } |
| 12512 | } |
| 12513 | } |
| 12514 | |
| 12515 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12516 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12517 | |
| 12518 | /* add playback controls from the parsed DAC table */ |
| 12519 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12520 | * different NIDs for mute/unmute switch and volume control */ |
| 12521 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12522 | const struct auto_pin_cfg *cfg) |
| 12523 | { |
| 12524 | char name[32]; |
| 12525 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12526 | hda_nid_t nid_v, nid_s; |
| 12527 | int i, err; |
| 12528 | |
| 12529 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12530 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12531 | continue; |
| 12532 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12533 | alc880_dac_to_idx( |
| 12534 | spec->multiout.dac_nids[i])); |
| 12535 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12536 | alc880_dac_to_idx( |
| 12537 | spec->multiout.dac_nids[i])); |
| 12538 | |
| 12539 | if (i == 2) { |
| 12540 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12541 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12542 | "Center Playback Volume", |
| 12543 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12544 | HDA_OUTPUT)); |
| 12545 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12546 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12547 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12548 | "LFE Playback Volume", |
| 12549 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12550 | HDA_OUTPUT)); |
| 12551 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12552 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12553 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12554 | "Center Playback Switch", |
| 12555 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12556 | HDA_INPUT)); |
| 12557 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12558 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12559 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12560 | "LFE Playback Switch", |
| 12561 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12562 | HDA_INPUT)); |
| 12563 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12564 | return err; |
| 12565 | } else { |
| 12566 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12567 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12568 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12569 | HDA_OUTPUT)); |
| 12570 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12571 | return err; |
| 12572 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12573 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12574 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12575 | HDA_INPUT)); |
| 12576 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12577 | return err; |
| 12578 | } |
| 12579 | } |
| 12580 | return 0; |
| 12581 | } |
| 12582 | |
| 12583 | /* add playback controls for speaker and HP outputs */ |
| 12584 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12585 | * different NIDs for mute/unmute switch and volume control */ |
| 12586 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12587 | hda_nid_t pin, const char *pfx) |
| 12588 | { |
| 12589 | hda_nid_t nid_v, nid_s; |
| 12590 | int err; |
| 12591 | char name[32]; |
| 12592 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12593 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12594 | return 0; |
| 12595 | |
| 12596 | if (alc880_is_fixed_pin(pin)) { |
| 12597 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12598 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12599 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12600 | spec->multiout.hp_nid = nid_v; |
| 12601 | else |
| 12602 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12603 | /* control HP volume/switch on the output mixer amp */ |
| 12604 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12605 | alc880_fixed_pin_idx(pin)); |
| 12606 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12607 | alc880_fixed_pin_idx(pin)); |
| 12608 | |
| 12609 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12610 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12611 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12612 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12613 | return err; |
| 12614 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12615 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12616 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12617 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12618 | return err; |
| 12619 | } else if (alc880_is_multi_pin(pin)) { |
| 12620 | /* set manual connection */ |
| 12621 | /* we have only a switch on HP-out PIN */ |
| 12622 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12623 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12624 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12625 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12626 | return err; |
| 12627 | } |
| 12628 | return 0; |
| 12629 | } |
| 12630 | |
| 12631 | /* parse the BIOS configuration and set up the alc_spec |
| 12632 | * return 1 if successful, 0 if the proper config is not found, |
| 12633 | * or a negative error code |
| 12634 | * Based on ALC880 version - had to change it to override |
| 12635 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12636 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12637 | { |
| 12638 | struct alc_spec *spec = codec->spec; |
| 12639 | int err; |
| 12640 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12641 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12642 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12643 | alc861vd_ignore); |
| 12644 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12645 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12646 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12647 | return 0; /* can't find valid BIOS pin config */ |
| 12648 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12649 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12650 | if (err < 0) |
| 12651 | return err; |
| 12652 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12653 | if (err < 0) |
| 12654 | return err; |
| 12655 | err = alc861vd_auto_create_extra_out(spec, |
| 12656 | spec->autocfg.speaker_pins[0], |
| 12657 | "Speaker"); |
| 12658 | if (err < 0) |
| 12659 | return err; |
| 12660 | err = alc861vd_auto_create_extra_out(spec, |
| 12661 | spec->autocfg.hp_pins[0], |
| 12662 | "Headphone"); |
| 12663 | if (err < 0) |
| 12664 | return err; |
| 12665 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12666 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12667 | return err; |
| 12668 | |
| 12669 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12670 | |
| 12671 | if (spec->autocfg.dig_out_pin) |
| 12672 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12673 | |
| 12674 | if (spec->kctl_alloc) |
| 12675 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12676 | |
| 12677 | spec->init_verbs[spec->num_init_verbs++] |
| 12678 | = alc861vd_volume_init_verbs; |
| 12679 | |
| 12680 | spec->num_mux_defs = 1; |
| 12681 | spec->input_mux = &spec->private_imux; |
| 12682 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12683 | err = alc_auto_add_mic_boost(codec); |
| 12684 | if (err < 0) |
| 12685 | return err; |
| 12686 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12687 | return 1; |
| 12688 | } |
| 12689 | |
| 12690 | /* additional initialization for auto-configuration model */ |
| 12691 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12692 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12693 | struct alc_spec *spec = codec->spec; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12694 | alc861vd_auto_init_multi_out(codec); |
| 12695 | alc861vd_auto_init_hp_out(codec); |
| 12696 | alc861vd_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 12697 | if (spec->unsol_event) |
| 12698 | alc_sku_automute(codec); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12699 | } |
| 12700 | |
| 12701 | static int patch_alc861vd(struct hda_codec *codec) |
| 12702 | { |
| 12703 | struct alc_spec *spec; |
| 12704 | int err, board_config; |
| 12705 | |
| 12706 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12707 | if (spec == NULL) |
| 12708 | return -ENOMEM; |
| 12709 | |
| 12710 | codec->spec = spec; |
| 12711 | |
| 12712 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12713 | alc861vd_models, |
| 12714 | alc861vd_cfg_tbl); |
| 12715 | |
| 12716 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12717 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12718 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12719 | board_config = ALC861VD_AUTO; |
| 12720 | } |
| 12721 | |
| 12722 | if (board_config == ALC861VD_AUTO) { |
| 12723 | /* automatic parse from the BIOS config */ |
| 12724 | err = alc861vd_parse_auto_config(codec); |
| 12725 | if (err < 0) { |
| 12726 | alc_free(codec); |
| 12727 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12728 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12729 | printk(KERN_INFO |
| 12730 | "hda_codec: Cannot set up configuration " |
| 12731 | "from BIOS. Using base mode...\n"); |
| 12732 | board_config = ALC861VD_3ST; |
| 12733 | } |
| 12734 | } |
| 12735 | |
| 12736 | if (board_config != ALC861VD_AUTO) |
| 12737 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12738 | |
| 12739 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12740 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12741 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12742 | |
| 12743 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12744 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12745 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12746 | |
| 12747 | spec->adc_nids = alc861vd_adc_nids; |
| 12748 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12749 | spec->capsrc_nids = alc861vd_capsrc_nids; |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12750 | |
| 12751 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12752 | spec->num_mixers++; |
| 12753 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12754 | spec->vmaster_nid = 0x02; |
| 12755 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12756 | codec->patch_ops = alc_patch_ops; |
| 12757 | |
| 12758 | if (board_config == ALC861VD_AUTO) |
| 12759 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12760 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12761 | if (!spec->loopback.amplist) |
| 12762 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12763 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12764 | |
| 12765 | return 0; |
| 12766 | } |
| 12767 | |
| 12768 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12769 | * ALC662 support |
| 12770 | * |
| 12771 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12772 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12773 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12774 | * 6-channel independent captures. |
| 12775 | * |
| 12776 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12777 | * driver yet). |
| 12778 | */ |
| 12779 | #define ALC662_DIGOUT_NID 0x06 |
| 12780 | #define ALC662_DIGIN_NID 0x0a |
| 12781 | |
| 12782 | static hda_nid_t alc662_dac_nids[4] = { |
| 12783 | /* front, rear, clfe, rear_surr */ |
| 12784 | 0x02, 0x03, 0x04 |
| 12785 | }; |
| 12786 | |
| 12787 | static hda_nid_t alc662_adc_nids[1] = { |
| 12788 | /* ADC1-2 */ |
| 12789 | 0x09, |
| 12790 | }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12791 | |
Kailang Yang | 77a261b | 2008-02-19 11:38:05 +0100 | [diff] [blame] | 12792 | static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12793 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12794 | /* input MUX */ |
| 12795 | /* FIXME: should be a matrix-type input source selection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12796 | static struct hda_input_mux alc662_capture_source = { |
| 12797 | .num_items = 4, |
| 12798 | .items = { |
| 12799 | { "Mic", 0x0 }, |
| 12800 | { "Front Mic", 0x1 }, |
| 12801 | { "Line", 0x2 }, |
| 12802 | { "CD", 0x4 }, |
| 12803 | }, |
| 12804 | }; |
| 12805 | |
| 12806 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12807 | .num_items = 2, |
| 12808 | .items = { |
| 12809 | { "Mic", 0x1 }, |
| 12810 | { "Line", 0x2 }, |
| 12811 | }, |
| 12812 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12813 | |
| 12814 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12815 | .num_items = 2, |
| 12816 | .items = { |
| 12817 | { "i-Mic", 0x1 }, |
| 12818 | { "e-Mic", 0x0 }, |
| 12819 | }, |
| 12820 | }; |
| 12821 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12822 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12823 | #define alc662_mux_enum_get alc_mux_enum_get |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 12824 | #define alc662_mux_enum_put alc882_mux_enum_put |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12825 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12826 | /* |
| 12827 | * 2ch mode |
| 12828 | */ |
| 12829 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12830 | { 2, NULL } |
| 12831 | }; |
| 12832 | |
| 12833 | /* |
| 12834 | * 2ch mode |
| 12835 | */ |
| 12836 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12837 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12838 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12839 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12840 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12841 | { } /* end */ |
| 12842 | }; |
| 12843 | |
| 12844 | /* |
| 12845 | * 6ch mode |
| 12846 | */ |
| 12847 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12848 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12849 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12850 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12851 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12852 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12853 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12854 | { } /* end */ |
| 12855 | }; |
| 12856 | |
| 12857 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12858 | { 2, alc662_3ST_ch2_init }, |
| 12859 | { 6, alc662_3ST_ch6_init }, |
| 12860 | }; |
| 12861 | |
| 12862 | /* |
| 12863 | * 2ch mode |
| 12864 | */ |
| 12865 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12866 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12867 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12868 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12869 | { } /* end */ |
| 12870 | }; |
| 12871 | |
| 12872 | /* |
| 12873 | * 6ch mode |
| 12874 | */ |
| 12875 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12876 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12877 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12878 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12879 | { } /* end */ |
| 12880 | }; |
| 12881 | |
| 12882 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12883 | { 2, alc662_sixstack_ch6_init }, |
| 12884 | { 6, alc662_sixstack_ch8_init }, |
| 12885 | }; |
| 12886 | |
| 12887 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12888 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12889 | */ |
| 12890 | |
| 12891 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12892 | /* output mixer control */ |
| 12893 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12894 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12895 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12896 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12897 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12898 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12899 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12900 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12901 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12902 | |
| 12903 | /*Input mixer control */ |
| 12904 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12905 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12906 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12907 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12908 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12909 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12910 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12911 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12912 | { } /* end */ |
| 12913 | }; |
| 12914 | |
| 12915 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12916 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12917 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12918 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12919 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12920 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12921 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12922 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12923 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12924 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12925 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12926 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12927 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12928 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12929 | { } /* end */ |
| 12930 | }; |
| 12931 | |
| 12932 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12933 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12934 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12935 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12936 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12937 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12938 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12939 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12940 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12941 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12942 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12943 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12944 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12945 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12946 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12947 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12948 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12949 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12950 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12951 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12952 | { } /* end */ |
| 12953 | }; |
| 12954 | |
| 12955 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12956 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12957 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12958 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12959 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12960 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12961 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12962 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12963 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12964 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12965 | { } /* end */ |
| 12966 | }; |
| 12967 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12968 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12969 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12970 | |
Herton Ronaldo Krzesinski | b481849 | 2008-02-23 11:34:12 +0100 | [diff] [blame] | 12971 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12972 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12973 | |
| 12974 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12975 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12976 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12977 | |
| 12978 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12979 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12980 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12981 | { } /* end */ |
| 12982 | }; |
| 12983 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12984 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
Takashi Iwai | 31bffaa | 2008-02-27 16:10:44 +0100 | [diff] [blame] | 12985 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12986 | HDA_CODEC_MUTE("Line-Out Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12987 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12988 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12989 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12990 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12991 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12992 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12993 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12994 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12995 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12996 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12997 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12998 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12999 | { } /* end */ |
| 13000 | }; |
| 13001 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13002 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 13003 | { |
| 13004 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13005 | .name = "Channel Mode", |
| 13006 | .info = alc_ch_mode_info, |
| 13007 | .get = alc_ch_mode_get, |
| 13008 | .put = alc_ch_mode_put, |
| 13009 | }, |
| 13010 | { } /* end */ |
| 13011 | }; |
| 13012 | |
| 13013 | static struct hda_verb alc662_init_verbs[] = { |
| 13014 | /* ADC: mute amp left and right */ |
| 13015 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13016 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13017 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 13018 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13019 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13020 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13021 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13022 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13023 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13024 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13025 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13026 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13027 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13028 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13029 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13030 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13031 | |
| 13032 | /* Front Pin: output 0 (0x0c) */ |
| 13033 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13034 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13035 | |
| 13036 | /* Rear Pin: output 1 (0x0d) */ |
| 13037 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13038 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13039 | |
| 13040 | /* CLFE Pin: output 2 (0x0e) */ |
| 13041 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13042 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13043 | |
| 13044 | /* Mic (rear) pin: input vref at 80% */ |
| 13045 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13046 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13047 | /* Front Mic pin: input vref at 80% */ |
| 13048 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 13049 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13050 | /* Line In pin: input */ |
| 13051 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13052 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 13053 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 13054 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 13055 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 13056 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13057 | /* CD pin widget for input */ |
| 13058 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 13059 | |
| 13060 | /* FIXME: use matrix-type input source selection */ |
| 13061 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13062 | /* Input mixer */ |
| 13063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13064 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13065 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13066 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13067 | |
| 13068 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13069 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13070 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 13071 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13072 | { } |
| 13073 | }; |
| 13074 | |
| 13075 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 13076 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 13077 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13078 | {} |
| 13079 | }; |
| 13080 | |
| 13081 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 13082 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 13083 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13084 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13085 | }; |
| 13086 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13087 | /* Set Unsolicited Event*/ |
| 13088 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 13089 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 13090 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 13091 | {} |
| 13092 | }; |
| 13093 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13094 | /* |
| 13095 | * generic initialization of ADC, input mixers and output mixers |
| 13096 | */ |
| 13097 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 13098 | /* |
| 13099 | * Unmute ADC and set the default input to mic-in |
| 13100 | */ |
| 13101 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 13102 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13103 | |
| 13104 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 13105 | * mixer widget |
| 13106 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 13107 | * panel mic (mic 2) |
| 13108 | */ |
| 13109 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 13111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 13112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 13113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 13114 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13115 | |
| 13116 | /* |
| 13117 | * Set up output mixers (0x0c - 0x0f) |
| 13118 | */ |
| 13119 | /* set vol=0 to output mixers */ |
| 13120 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13121 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13122 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 13123 | |
| 13124 | /* set up input amps for analog loopback */ |
| 13125 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13126 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13127 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13128 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13129 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 13130 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 13131 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13132 | |
| 13133 | |
| 13134 | /* FIXME: use matrix-type input source selection */ |
| 13135 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 13136 | /* Input mixer */ |
| 13137 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 13138 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13139 | { } |
| 13140 | }; |
| 13141 | |
| 13142 | /* capture mixer elements */ |
| 13143 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 13144 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 13145 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 13146 | { |
| 13147 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 13148 | /* The multiple "Capture Source" controls confuse alsamixer |
| 13149 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13150 | */ |
| 13151 | /* .name = "Capture Source", */ |
| 13152 | .name = "Input Source", |
| 13153 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 13154 | .info = alc662_mux_enum_info, |
| 13155 | .get = alc662_mux_enum_get, |
| 13156 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13157 | }, |
| 13158 | { } /* end */ |
| 13159 | }; |
| 13160 | |
| 13161 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 13162 | { |
| 13163 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13164 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13165 | |
| 13166 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13167 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13168 | bits = present ? HDA_AMP_MUTE : 0; |
| 13169 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13170 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13171 | } |
| 13172 | |
| 13173 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 13174 | { |
| 13175 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13176 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13177 | |
| 13178 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 13179 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 13180 | bits = present ? HDA_AMP_MUTE : 0; |
| 13181 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 13182 | HDA_AMP_MUTE, bits); |
| 13183 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 13184 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13185 | } |
| 13186 | |
| 13187 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 13188 | unsigned int res) |
| 13189 | { |
| 13190 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13191 | alc662_lenovo_101e_all_automute(codec); |
| 13192 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 13193 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 13194 | } |
| 13195 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13196 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 13197 | { |
| 13198 | unsigned int present; |
| 13199 | |
| 13200 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 13201 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 13202 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13203 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13204 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13205 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 13206 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13207 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13208 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13209 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13210 | } |
| 13211 | |
| 13212 | /* unsolicited event for HP jack sensing */ |
| 13213 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13214 | unsigned int res) |
| 13215 | { |
| 13216 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13217 | alc262_hippo1_automute( codec ); |
| 13218 | |
| 13219 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13220 | alc662_eeepc_mic_automute(codec); |
| 13221 | } |
| 13222 | |
| 13223 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13224 | { |
| 13225 | alc262_hippo1_automute( codec ); |
| 13226 | alc662_eeepc_mic_automute(codec); |
| 13227 | } |
| 13228 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13229 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13230 | { |
| 13231 | unsigned int mute; |
| 13232 | unsigned int present; |
| 13233 | |
| 13234 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13235 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13236 | AC_VERB_GET_PIN_SENSE, 0); |
| 13237 | present = (present & 0x80000000) != 0; |
| 13238 | if (present) { |
| 13239 | /* mute internal speaker */ |
| 13240 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13241 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13242 | } else { |
| 13243 | /* unmute internal speaker if necessary */ |
| 13244 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13245 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13246 | HDA_AMP_MUTE, mute); |
| 13247 | } |
| 13248 | } |
| 13249 | |
| 13250 | /* unsolicited event for HP jack sensing */ |
| 13251 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13252 | unsigned int res) |
| 13253 | { |
| 13254 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13255 | alc662_eeepc_ep20_automute(codec); |
| 13256 | } |
| 13257 | |
| 13258 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13259 | { |
| 13260 | alc662_eeepc_ep20_automute(codec); |
| 13261 | } |
| 13262 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13263 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13264 | #define alc662_loopbacks alc880_loopbacks |
| 13265 | #endif |
| 13266 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13267 | |
| 13268 | /* pcm configuration: identiacal with ALC880 */ |
| 13269 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13270 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13271 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13272 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13273 | |
| 13274 | /* |
| 13275 | * configuration and preset |
| 13276 | */ |
| 13277 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13278 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13279 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13280 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13281 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13282 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13283 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13284 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13285 | [ALC662_AUTO] = "auto", |
| 13286 | }; |
| 13287 | |
| 13288 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13289 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13290 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13291 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13292 | {} |
| 13293 | }; |
| 13294 | |
| 13295 | static struct alc_config_preset alc662_presets[] = { |
| 13296 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13297 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13298 | .init_verbs = { alc662_init_verbs }, |
| 13299 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13300 | .dac_nids = alc662_dac_nids, |
| 13301 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13302 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13303 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13304 | .channel_mode = alc662_3ST_2ch_modes, |
| 13305 | .input_mux = &alc662_capture_source, |
| 13306 | }, |
| 13307 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13308 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13309 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13310 | .init_verbs = { alc662_init_verbs }, |
| 13311 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13312 | .dac_nids = alc662_dac_nids, |
| 13313 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13314 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13315 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13316 | .channel_mode = alc662_3ST_6ch_modes, |
| 13317 | .need_dac_fix = 1, |
| 13318 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13319 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13320 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13321 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13322 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13323 | .init_verbs = { alc662_init_verbs }, |
| 13324 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13325 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13326 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13327 | .channel_mode = alc662_3ST_6ch_modes, |
| 13328 | .need_dac_fix = 1, |
| 13329 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13330 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13331 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13332 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13333 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13334 | .init_verbs = { alc662_init_verbs }, |
| 13335 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13336 | .dac_nids = alc662_dac_nids, |
| 13337 | .dig_out_nid = ALC662_DIGOUT_NID, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13338 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13339 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13340 | .channel_mode = alc662_5stack_modes, |
| 13341 | .input_mux = &alc662_capture_source, |
| 13342 | }, |
| 13343 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13344 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13345 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13346 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13347 | .dac_nids = alc662_dac_nids, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13348 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13349 | .channel_mode = alc662_3ST_2ch_modes, |
| 13350 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13351 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13352 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13353 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13354 | [ALC662_ASUS_EEEPC_P701] = { |
| 13355 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13356 | .init_verbs = { alc662_init_verbs, |
| 13357 | alc662_eeepc_sue_init_verbs }, |
| 13358 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13359 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13360 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13361 | .channel_mode = alc662_3ST_2ch_modes, |
| 13362 | .input_mux = &alc662_eeepc_capture_source, |
| 13363 | .unsol_event = alc662_eeepc_unsol_event, |
| 13364 | .init_hook = alc662_eeepc_inithook, |
| 13365 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13366 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13367 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13368 | alc662_chmode_mixer }, |
| 13369 | .init_verbs = { alc662_init_verbs, |
| 13370 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13371 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13372 | .dac_nids = alc662_dac_nids, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13373 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13374 | .channel_mode = alc662_3ST_6ch_modes, |
| 13375 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13376 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13377 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13378 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13379 | |
| 13380 | }; |
| 13381 | |
| 13382 | |
| 13383 | /* |
| 13384 | * BIOS auto configuration |
| 13385 | */ |
| 13386 | |
| 13387 | /* add playback controls from the parsed DAC table */ |
| 13388 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13389 | const struct auto_pin_cfg *cfg) |
| 13390 | { |
| 13391 | char name[32]; |
| 13392 | static const char *chname[4] = { |
| 13393 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13394 | }; |
| 13395 | hda_nid_t nid; |
| 13396 | int i, err; |
| 13397 | |
| 13398 | for (i = 0; i < cfg->line_outs; i++) { |
| 13399 | if (!spec->multiout.dac_nids[i]) |
| 13400 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13401 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13402 | if (i == 2) { |
| 13403 | /* Center/LFE */ |
| 13404 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13405 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13406 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13407 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13408 | if (err < 0) |
| 13409 | return err; |
| 13410 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13411 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13412 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13413 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13414 | if (err < 0) |
| 13415 | return err; |
| 13416 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13417 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13418 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13419 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13420 | if (err < 0) |
| 13421 | return err; |
| 13422 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13423 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13424 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13425 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13426 | if (err < 0) |
| 13427 | return err; |
| 13428 | } else { |
| 13429 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13430 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13431 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13432 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13433 | if (err < 0) |
| 13434 | return err; |
| 13435 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13436 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13437 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13438 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13439 | if (err < 0) |
| 13440 | return err; |
| 13441 | } |
| 13442 | } |
| 13443 | return 0; |
| 13444 | } |
| 13445 | |
| 13446 | /* add playback controls for speaker and HP outputs */ |
| 13447 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13448 | const char *pfx) |
| 13449 | { |
| 13450 | hda_nid_t nid; |
| 13451 | int err; |
| 13452 | char name[32]; |
| 13453 | |
| 13454 | if (!pin) |
| 13455 | return 0; |
| 13456 | |
| 13457 | if (alc880_is_fixed_pin(pin)) { |
| 13458 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13459 | /* printk("DAC nid=%x\n",nid); */ |
| 13460 | /* specify the DAC as the extra output */ |
| 13461 | if (!spec->multiout.hp_nid) |
| 13462 | spec->multiout.hp_nid = nid; |
| 13463 | else |
| 13464 | spec->multiout.extra_out_nid[0] = nid; |
| 13465 | /* control HP volume/switch on the output mixer amp */ |
| 13466 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13467 | sprintf(name, "%s Playback Volume", pfx); |
| 13468 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13469 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13470 | if (err < 0) |
| 13471 | return err; |
| 13472 | sprintf(name, "%s Playback Switch", pfx); |
| 13473 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13474 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13475 | if (err < 0) |
| 13476 | return err; |
| 13477 | } else if (alc880_is_multi_pin(pin)) { |
| 13478 | /* set manual connection */ |
| 13479 | /* we have only a switch on HP-out PIN */ |
| 13480 | sprintf(name, "%s Playback Switch", pfx); |
| 13481 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13482 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13483 | if (err < 0) |
| 13484 | return err; |
| 13485 | } |
| 13486 | return 0; |
| 13487 | } |
| 13488 | |
| 13489 | /* create playback/capture controls for input pins */ |
| 13490 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13491 | const struct auto_pin_cfg *cfg) |
| 13492 | { |
| 13493 | struct hda_input_mux *imux = &spec->private_imux; |
| 13494 | int i, err, idx; |
| 13495 | |
| 13496 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13497 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13498 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13499 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13500 | auto_pin_cfg_labels[i], |
| 13501 | idx, 0x0b); |
| 13502 | if (err < 0) |
| 13503 | return err; |
| 13504 | imux->items[imux->num_items].label = |
| 13505 | auto_pin_cfg_labels[i]; |
| 13506 | imux->items[imux->num_items].index = |
| 13507 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13508 | imux->num_items++; |
| 13509 | } |
| 13510 | } |
| 13511 | return 0; |
| 13512 | } |
| 13513 | |
| 13514 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13515 | hda_nid_t nid, int pin_type, |
| 13516 | int dac_idx) |
| 13517 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13518 | alc_set_pin_output(codec, nid, pin_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13519 | /* need the manual connection? */ |
| 13520 | if (alc880_is_multi_pin(nid)) { |
| 13521 | struct alc_spec *spec = codec->spec; |
| 13522 | int idx = alc880_multi_pin_idx(nid); |
| 13523 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13524 | AC_VERB_SET_CONNECT_SEL, |
| 13525 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13526 | } |
| 13527 | } |
| 13528 | |
| 13529 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13530 | { |
| 13531 | struct alc_spec *spec = codec->spec; |
| 13532 | int i; |
| 13533 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13534 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13535 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13536 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13537 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13538 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13539 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13540 | i); |
| 13541 | } |
| 13542 | } |
| 13543 | |
| 13544 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13545 | { |
| 13546 | struct alc_spec *spec = codec->spec; |
| 13547 | hda_nid_t pin; |
| 13548 | |
| 13549 | pin = spec->autocfg.hp_pins[0]; |
| 13550 | if (pin) /* connect to front */ |
| 13551 | /* use dac 0 */ |
| 13552 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13553 | pin = spec->autocfg.speaker_pins[0]; |
| 13554 | if (pin) |
| 13555 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13556 | } |
| 13557 | |
| 13558 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13559 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13560 | |
| 13561 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13562 | { |
| 13563 | struct alc_spec *spec = codec->spec; |
| 13564 | int i; |
| 13565 | |
| 13566 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13567 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13568 | if (alc662_is_input_pin(nid)) { |
| 13569 | snd_hda_codec_write(codec, nid, 0, |
| 13570 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13571 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13572 | PIN_VREF80 : PIN_IN)); |
| 13573 | if (nid != ALC662_PIN_CD_NID) |
| 13574 | snd_hda_codec_write(codec, nid, 0, |
| 13575 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13576 | AMP_OUT_MUTE); |
| 13577 | } |
| 13578 | } |
| 13579 | } |
| 13580 | |
| 13581 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13582 | { |
| 13583 | struct alc_spec *spec = codec->spec; |
| 13584 | int err; |
| 13585 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13586 | |
| 13587 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13588 | alc662_ignore); |
| 13589 | if (err < 0) |
| 13590 | return err; |
| 13591 | if (!spec->autocfg.line_outs) |
| 13592 | return 0; /* can't find valid BIOS pin config */ |
| 13593 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13594 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13595 | if (err < 0) |
| 13596 | return err; |
| 13597 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13598 | if (err < 0) |
| 13599 | return err; |
| 13600 | err = alc662_auto_create_extra_out(spec, |
| 13601 | spec->autocfg.speaker_pins[0], |
| 13602 | "Speaker"); |
| 13603 | if (err < 0) |
| 13604 | return err; |
| 13605 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13606 | "Headphone"); |
| 13607 | if (err < 0) |
| 13608 | return err; |
| 13609 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13610 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13611 | return err; |
| 13612 | |
| 13613 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13614 | |
| 13615 | if (spec->autocfg.dig_out_pin) |
| 13616 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13617 | |
| 13618 | if (spec->kctl_alloc) |
| 13619 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13620 | |
| 13621 | spec->num_mux_defs = 1; |
| 13622 | spec->input_mux = &spec->private_imux; |
| 13623 | |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13624 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13625 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13626 | spec->num_mixers++; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13627 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13628 | } |
| 13629 | |
| 13630 | /* additional initialization for auto-configuration model */ |
| 13631 | static void alc662_auto_init(struct hda_codec *codec) |
| 13632 | { |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13633 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13634 | alc662_auto_init_multi_out(codec); |
| 13635 | alc662_auto_init_hp_out(codec); |
| 13636 | alc662_auto_init_analog_input(codec); |
Takashi Iwai | f6c7e54 | 2008-02-12 18:32:23 +0100 | [diff] [blame] | 13637 | if (spec->unsol_event) |
| 13638 | alc_sku_automute(codec); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13639 | } |
| 13640 | |
| 13641 | static int patch_alc662(struct hda_codec *codec) |
| 13642 | { |
| 13643 | struct alc_spec *spec; |
| 13644 | int err, board_config; |
| 13645 | |
| 13646 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13647 | if (!spec) |
| 13648 | return -ENOMEM; |
| 13649 | |
| 13650 | codec->spec = spec; |
| 13651 | |
| 13652 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13653 | alc662_models, |
| 13654 | alc662_cfg_tbl); |
| 13655 | if (board_config < 0) { |
| 13656 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13657 | "trying auto-probe from BIOS...\n"); |
| 13658 | board_config = ALC662_AUTO; |
| 13659 | } |
| 13660 | |
| 13661 | if (board_config == ALC662_AUTO) { |
| 13662 | /* automatic parse from the BIOS config */ |
| 13663 | err = alc662_parse_auto_config(codec); |
| 13664 | if (err < 0) { |
| 13665 | alc_free(codec); |
| 13666 | return err; |
Takashi Iwai | 8c87286 | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13667 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13668 | printk(KERN_INFO |
| 13669 | "hda_codec: Cannot set up configuration " |
| 13670 | "from BIOS. Using base mode...\n"); |
| 13671 | board_config = ALC662_3ST_2ch_DIG; |
| 13672 | } |
| 13673 | } |
| 13674 | |
| 13675 | if (board_config != ALC662_AUTO) |
| 13676 | setup_preset(spec, &alc662_presets[board_config]); |
| 13677 | |
| 13678 | spec->stream_name_analog = "ALC662 Analog"; |
| 13679 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13680 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13681 | |
| 13682 | spec->stream_name_digital = "ALC662 Digital"; |
| 13683 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13684 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13685 | |
Takashi Iwai | e140634 | 2008-02-11 18:32:32 +0100 | [diff] [blame] | 13686 | spec->adc_nids = alc662_adc_nids; |
| 13687 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13688 | spec->capsrc_nids = alc662_capsrc_nids; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13689 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13690 | spec->vmaster_nid = 0x02; |
| 13691 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13692 | codec->patch_ops = alc_patch_ops; |
| 13693 | if (board_config == ALC662_AUTO) |
| 13694 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13695 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13696 | if (!spec->loopback.amplist) |
| 13697 | spec->loopback.amplist = alc662_loopbacks; |
| 13698 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13699 | |
| 13700 | return 0; |
| 13701 | } |
| 13702 | |
| 13703 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13704 | * patch entries |
| 13705 | */ |
| 13706 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13707 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13708 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13709 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13710 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13711 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13712 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13713 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13714 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13715 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13716 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13717 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13718 | .patch = patch_alc883 }, |
| 13719 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13720 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13721 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13722 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13723 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13724 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13725 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13726 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13727 | {} /* terminator */ |
| 13728 | }; |