Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * HD audio interface patch for ALC 260/880/882 codecs |
| 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@physics.adelaide.edu.au> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
| 30 | #include <sound/core.h> |
| 31 | #include "hda_codec.h" |
| 32 | #include "hda_local.h" |
| 33 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 34 | #define ALC880_FRONT_EVENT 0x01 |
| 35 | #define ALC880_DCVOL_EVENT 0x02 |
| 36 | #define ALC880_HP_EVENT 0x04 |
| 37 | #define ALC880_MIC_EVENT 0x08 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | |
| 39 | /* ALC880 board config type */ |
| 40 | enum { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | ALC880_3ST, |
| 42 | ALC880_3ST_DIG, |
| 43 | ALC880_5ST, |
| 44 | ALC880_5ST_DIG, |
| 45 | ALC880_W810, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 46 | ALC880_Z71V, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 47 | ALC880_6ST, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 48 | ALC880_6ST_DIG, |
| 49 | ALC880_F1734, |
| 50 | ALC880_ASUS, |
| 51 | ALC880_ASUS_DIG, |
| 52 | ALC880_ASUS_W1V, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 53 | ALC880_ASUS_DIG2, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 54 | ALC880_FUJITSU, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 55 | ALC880_UNIWILL_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 56 | ALC880_UNIWILL, |
| 57 | ALC880_UNIWILL_P53, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 58 | ALC880_CLEVO, |
| 59 | ALC880_TCL_S700, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 60 | ALC880_LG, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 61 | ALC880_LG_LW, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 62 | #ifdef CONFIG_SND_DEBUG |
| 63 | ALC880_TEST, |
| 64 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 65 | ALC880_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 66 | ALC880_MODEL_LAST /* last tag */ |
| 67 | }; |
| 68 | |
| 69 | /* ALC260 models */ |
| 70 | enum { |
| 71 | ALC260_BASIC, |
| 72 | ALC260_HP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 73 | ALC260_HP_3013, |
| 74 | ALC260_FUJITSU_S702X, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 75 | ALC260_ACER, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 76 | ALC260_WILL, |
| 77 | ALC260_REPLACER_672V, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 78 | #ifdef CONFIG_SND_DEBUG |
| 79 | ALC260_TEST, |
| 80 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 81 | ALC260_AUTO, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 82 | ALC260_MODEL_LAST /* last tag */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | }; |
| 84 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 85 | /* ALC262 models */ |
| 86 | enum { |
| 87 | ALC262_BASIC, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 88 | ALC262_HIPPO, |
| 89 | ALC262_HIPPO_1, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 90 | ALC262_FUJITSU, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 91 | ALC262_HP_BPC, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 92 | ALC262_HP_BPC_D7000_WL, |
| 93 | ALC262_HP_BPC_D7000_WF, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 94 | ALC262_HP_TC_T5735, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 95 | ALC262_HP_RP5700, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 96 | ALC262_BENQ_ED8, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 97 | ALC262_SONY_ASSAMD, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 98 | ALC262_BENQ_T31, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 99 | ALC262_ULTRA, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 100 | ALC262_AUTO, |
| 101 | ALC262_MODEL_LAST /* last tag */ |
| 102 | }; |
| 103 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 104 | /* ALC268 models */ |
| 105 | enum { |
| 106 | ALC268_3ST, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 107 | ALC268_TOSHIBA, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 108 | ALC268_ACER, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 109 | ALC268_DELL, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 110 | #ifdef CONFIG_SND_DEBUG |
| 111 | ALC268_TEST, |
| 112 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 113 | ALC268_AUTO, |
| 114 | ALC268_MODEL_LAST /* last tag */ |
| 115 | }; |
| 116 | |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 117 | /* ALC269 models */ |
| 118 | enum { |
| 119 | ALC269_BASIC, |
| 120 | ALC269_AUTO, |
| 121 | ALC269_MODEL_LAST /* last tag */ |
| 122 | }; |
| 123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 124 | /* ALC861 models */ |
| 125 | enum { |
| 126 | ALC861_3ST, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 127 | ALC660_3ST, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 128 | ALC861_3ST_DIG, |
| 129 | ALC861_6ST_DIG, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 130 | ALC861_UNIWILL_M31, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 131 | ALC861_TOSHIBA, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 132 | ALC861_ASUS, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 133 | ALC861_ASUS_LAPTOP, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 134 | ALC861_AUTO, |
| 135 | ALC861_MODEL_LAST, |
| 136 | }; |
| 137 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 138 | /* ALC861-VD models */ |
| 139 | enum { |
| 140 | ALC660VD_3ST, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 141 | ALC660VD_3ST_DIG, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 142 | ALC861VD_3ST, |
| 143 | ALC861VD_3ST_DIG, |
| 144 | ALC861VD_6ST_DIG, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 145 | ALC861VD_LENOVO, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 146 | ALC861VD_DALLAS, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 147 | ALC861VD_HP, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 148 | ALC861VD_AUTO, |
| 149 | ALC861VD_MODEL_LAST, |
| 150 | }; |
| 151 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 152 | /* ALC662 models */ |
| 153 | enum { |
| 154 | ALC662_3ST_2ch_DIG, |
| 155 | ALC662_3ST_6ch_DIG, |
| 156 | ALC662_3ST_6ch, |
| 157 | ALC662_5ST_DIG, |
| 158 | ALC662_LENOVO_101E, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 159 | ALC662_ASUS_EEEPC_P701, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 160 | ALC662_ASUS_EEEPC_EP20, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 161 | ALC662_AUTO, |
| 162 | ALC662_MODEL_LAST, |
| 163 | }; |
| 164 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 165 | /* ALC882 models */ |
| 166 | enum { |
| 167 | ALC882_3ST_DIG, |
| 168 | ALC882_6ST_DIG, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 169 | ALC882_ARIMA, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 170 | ALC882_W2JC, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 171 | ALC882_TARGA, |
| 172 | ALC882_ASUS_A7J, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 173 | ALC882_ASUS_A7M, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 174 | ALC885_MACPRO, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 175 | ALC885_MBP3, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 176 | ALC885_IMAC24, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 177 | ALC882_AUTO, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 178 | ALC882_MODEL_LAST, |
| 179 | }; |
| 180 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 181 | /* ALC883 models */ |
| 182 | enum { |
| 183 | ALC883_3ST_2ch_DIG, |
| 184 | ALC883_3ST_6ch_DIG, |
| 185 | ALC883_3ST_6ch, |
| 186 | ALC883_6ST_DIG, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 187 | ALC883_TARGA_DIG, |
| 188 | ALC883_TARGA_2ch_DIG, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 189 | ALC883_ACER, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 190 | ALC883_ACER_ASPIRE, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 191 | ALC883_MEDION, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 192 | ALC883_MEDION_MD2, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 193 | ALC883_LAPTOP_EAPD, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 194 | ALC883_LENOVO_101E_2ch, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 195 | ALC883_LENOVO_NB0763, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 196 | ALC888_LENOVO_MS7195_DIG, |
| 197 | ALC883_HAIER_W66, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 198 | ALC888_6ST_HP, |
| 199 | ALC888_3ST_HP, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 200 | ALC888_6ST_DELL, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 201 | ALC883_MITAC, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 202 | ALC883_AUTO, |
| 203 | ALC883_MODEL_LAST, |
| 204 | }; |
| 205 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 206 | /* for GPIO Poll */ |
| 207 | #define GPIO_MASK 0x03 |
| 208 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 209 | struct alc_spec { |
| 210 | /* codec parameterization */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 211 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | unsigned int num_mixers; |
| 213 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 214 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 215 | * don't forget NULL |
| 216 | * termination! |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 217 | */ |
| 218 | unsigned int num_init_verbs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 219 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 220 | char *stream_name_analog; /* analog PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 | struct hda_pcm_stream *stream_analog_playback; |
| 222 | struct hda_pcm_stream *stream_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 223 | struct hda_pcm_stream *stream_analog_alt_playback; |
| 224 | struct hda_pcm_stream *stream_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 226 | char *stream_name_digital; /* digital PCM stream */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | struct hda_pcm_stream *stream_digital_playback; |
| 228 | struct hda_pcm_stream *stream_digital_capture; |
| 229 | |
| 230 | /* playback */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 231 | struct hda_multi_out multiout; /* playback set-up |
| 232 | * max_channels, dacs must be set |
| 233 | * dig_out_nid and hp_nid are optional |
| 234 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 235 | hda_nid_t alt_dac_nid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 236 | |
| 237 | /* capture */ |
| 238 | unsigned int num_adc_nids; |
| 239 | hda_nid_t *adc_nids; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 240 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | |
| 242 | /* capture source */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 243 | unsigned int num_mux_defs; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | const struct hda_input_mux *input_mux; |
| 245 | unsigned int cur_mux[3]; |
| 246 | |
| 247 | /* channel model */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 248 | const struct hda_channel_mode *channel_mode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 249 | int num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 250 | int need_dac_fix; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | |
| 252 | /* PCM information */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 253 | struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 254 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 255 | /* dynamic controls, init_verbs and input_mux */ |
| 256 | struct auto_pin_cfg autocfg; |
| 257 | unsigned int num_kctl_alloc, num_kctl_used; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 258 | struct snd_kcontrol_new *kctl_alloc; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 259 | struct hda_input_mux private_imux; |
Takashi Iwai | 41923e4 | 2007-10-22 17:20:10 +0200 | [diff] [blame] | 260 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 261 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 262 | /* hooks */ |
| 263 | void (*init_hook)(struct hda_codec *codec); |
| 264 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
| 265 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 266 | /* for pin sensing */ |
| 267 | unsigned int sense_updated: 1; |
| 268 | unsigned int jack_present: 1; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 269 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 270 | /* for virtual master */ |
| 271 | hda_nid_t vmaster_nid; |
| 272 | u32 vmaster_tlv[4]; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 273 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 274 | struct hda_loopback_check loopback; |
| 275 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 276 | }; |
| 277 | |
| 278 | /* |
| 279 | * configuration template - to be copied to the spec instance |
| 280 | */ |
| 281 | struct alc_config_preset { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 282 | struct snd_kcontrol_new *mixers[5]; /* should be identical size |
| 283 | * with spec |
| 284 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 285 | const struct hda_verb *init_verbs[5]; |
| 286 | unsigned int num_dacs; |
| 287 | hda_nid_t *dac_nids; |
| 288 | hda_nid_t dig_out_nid; /* optional */ |
| 289 | hda_nid_t hp_nid; /* optional */ |
| 290 | unsigned int num_adc_nids; |
| 291 | hda_nid_t *adc_nids; |
| 292 | hda_nid_t dig_in_nid; |
| 293 | unsigned int num_channel_mode; |
| 294 | const struct hda_channel_mode *channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 295 | int need_dac_fix; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 296 | unsigned int num_mux_defs; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 297 | const struct hda_input_mux *input_mux; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 298 | void (*unsol_event)(struct hda_codec *, unsigned int); |
| 299 | void (*init_hook)(struct hda_codec *); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 300 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 301 | struct hda_amp_list *loopbacks; |
| 302 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 303 | }; |
| 304 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | |
| 306 | /* |
| 307 | * input MUX handling |
| 308 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 309 | static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, |
| 310 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 311 | { |
| 312 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 313 | struct alc_spec *spec = codec->spec; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 314 | unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); |
| 315 | if (mux_idx >= spec->num_mux_defs) |
| 316 | mux_idx = 0; |
| 317 | return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 320 | static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, |
| 321 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 322 | { |
| 323 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 324 | struct alc_spec *spec = codec->spec; |
| 325 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 326 | |
| 327 | ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; |
| 328 | return 0; |
| 329 | } |
| 330 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 331 | static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 332 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 333 | { |
| 334 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 335 | struct alc_spec *spec = codec->spec; |
| 336 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 337 | unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
| 338 | return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 339 | spec->adc_nids[adc_idx], |
| 340 | &spec->cur_mux[adc_idx]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 341 | } |
| 342 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 343 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | /* |
| 345 | * channel mode setting |
| 346 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 347 | static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, |
| 348 | struct snd_ctl_elem_info *uinfo) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 349 | { |
| 350 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 351 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 352 | return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, |
| 353 | spec->num_channel_mode); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 354 | } |
| 355 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 356 | static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, |
| 357 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 358 | { |
| 359 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 360 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 361 | return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 362 | spec->num_channel_mode, |
| 363 | spec->multiout.max_channels); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 364 | } |
| 365 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 366 | static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, |
| 367 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 368 | { |
| 369 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 370 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 371 | int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, |
| 372 | spec->num_channel_mode, |
| 373 | &spec->multiout.max_channels); |
Takashi Iwai | bd2033f | 2006-10-10 19:49:31 +0200 | [diff] [blame] | 374 | if (err >= 0 && spec->need_dac_fix) |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 375 | spec->multiout.num_dacs = spec->multiout.max_channels / 2; |
| 376 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | } |
| 378 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 379 | /* |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 380 | * Control the mode of pin widget settings via the mixer. "pc" is used |
| 381 | * instead of "%" to avoid consequences of accidently treating the % as |
| 382 | * being part of a format specifier. Maximum allowed length of a value is |
| 383 | * 63 characters plus NULL terminator. |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 384 | * |
| 385 | * Note: some retasking pin complexes seem to ignore requests for input |
| 386 | * states other than HiZ (eg: PIN_VREFxx) and revert to HiZ if any of these |
| 387 | * are requested. Therefore order this list so that this behaviour will not |
| 388 | * cause problems when mixer clients move through the enum sequentially. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 389 | * NIDs 0x0f and 0x10 have been observed to have this behaviour as of |
| 390 | * March 2006. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 391 | */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 392 | static char *alc_pin_mode_names[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 393 | "Mic 50pc bias", "Mic 80pc bias", |
| 394 | "Line in", "Line out", "Headphone out", |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 395 | }; |
| 396 | static unsigned char alc_pin_mode_values[] = { |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 397 | PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 398 | }; |
| 399 | /* 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] | 400 | * in the pin being assumed to be exclusively an input or an output pin. In |
| 401 | * addition, "input" pins may or may not process the mic bias option |
| 402 | * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to |
| 403 | * accept requests for bias as of chip versions up to March 2006) and/or |
| 404 | * wiring in the computer. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 405 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 406 | #define ALC_PIN_DIR_IN 0x00 |
| 407 | #define ALC_PIN_DIR_OUT 0x01 |
| 408 | #define ALC_PIN_DIR_INOUT 0x02 |
| 409 | #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 |
| 410 | #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 411 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 412 | /* Info about the pin modes supported by the different pin direction modes. |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 413 | * For each direction the minimum and maximum values are given. |
| 414 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 415 | static signed char alc_pin_mode_dir_info[5][2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 416 | { 0, 2 }, /* ALC_PIN_DIR_IN */ |
| 417 | { 3, 4 }, /* ALC_PIN_DIR_OUT */ |
| 418 | { 0, 4 }, /* ALC_PIN_DIR_INOUT */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 419 | { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ |
| 420 | { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 421 | }; |
| 422 | #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) |
| 423 | #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) |
| 424 | #define alc_pin_mode_n_items(_dir) \ |
| 425 | (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) |
| 426 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 427 | static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, |
| 428 | struct snd_ctl_elem_info *uinfo) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 429 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 430 | unsigned int item_num = uinfo->value.enumerated.item; |
| 431 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 432 | |
| 433 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 434 | uinfo->count = 1; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 435 | uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); |
| 436 | |
| 437 | if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) |
| 438 | item_num = alc_pin_mode_min(dir); |
| 439 | strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 440 | return 0; |
| 441 | } |
| 442 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 443 | static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, |
| 444 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 445 | { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 446 | unsigned int i; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 447 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 448 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 449 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 450 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 451 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 452 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 453 | 0x00); |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 454 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 455 | /* Find enumerated value for current pinctl setting */ |
| 456 | i = alc_pin_mode_min(dir); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 457 | 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] | 458 | i++; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 459 | *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] | 460 | return 0; |
| 461 | } |
| 462 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 463 | static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, |
| 464 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 465 | { |
| 466 | signed int change; |
| 467 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 468 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 469 | unsigned char dir = (kcontrol->private_value >> 16) & 0xff; |
| 470 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 471 | unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, |
| 472 | AC_VERB_GET_PIN_WIDGET_CONTROL, |
| 473 | 0x00); |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 474 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 475 | 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] | 476 | val = alc_pin_mode_min(dir); |
| 477 | |
| 478 | change = pinctl != alc_pin_mode_values[val]; |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 479 | if (change) { |
| 480 | /* Set pin mode to that requested */ |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 481 | snd_hda_codec_write_cache(codec, nid, 0, |
| 482 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 483 | alc_pin_mode_values[val]); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 484 | |
| 485 | /* Also enable the retasking pin's input/output as required |
| 486 | * for the requested pin mode. Enum values of 2 or less are |
| 487 | * input modes. |
| 488 | * |
| 489 | * Dynamically switching the input/output buffers probably |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 490 | * reduces noise slightly (particularly on input) so we'll |
| 491 | * do it. However, having both input and output buffers |
| 492 | * enabled simultaneously doesn't seem to be problematic if |
| 493 | * this turns out to be necessary in the future. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 494 | */ |
| 495 | if (val <= 2) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 496 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 497 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 498 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 499 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 500 | } else { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 501 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0, |
| 502 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 503 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 504 | HDA_AMP_MUTE, 0); |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 505 | } |
| 506 | } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 507 | return change; |
| 508 | } |
| 509 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 510 | #define ALC_PIN_MODE(xname, nid, dir) \ |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 511 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 512 | .info = alc_pin_mode_info, \ |
| 513 | .get = alc_pin_mode_get, \ |
| 514 | .put = alc_pin_mode_put, \ |
| 515 | .private_value = nid | (dir<<16) } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 516 | |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 517 | /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged |
| 518 | * together using a mask with more than one bit set. This control is |
| 519 | * currently used only by the ALC260 test model. At this stage they are not |
| 520 | * needed for any "production" models. |
| 521 | */ |
| 522 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 523 | #define alc_gpio_data_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 524 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 525 | static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, |
| 526 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 527 | { |
| 528 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 529 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 530 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 531 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 532 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 533 | AC_VERB_GET_GPIO_DATA, 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 534 | |
| 535 | *valp = (val & mask) != 0; |
| 536 | return 0; |
| 537 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 538 | static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, |
| 539 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 540 | { |
| 541 | signed int change; |
| 542 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 543 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 544 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 545 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 546 | unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, |
| 547 | AC_VERB_GET_GPIO_DATA, |
| 548 | 0x00); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 549 | |
| 550 | /* Set/unset the masked GPIO bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 551 | change = (val == 0 ? 0 : mask) != (gpio_data & mask); |
| 552 | if (val == 0) |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 553 | gpio_data &= ~mask; |
| 554 | else |
| 555 | gpio_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 556 | snd_hda_codec_write_cache(codec, nid, 0, |
| 557 | AC_VERB_SET_GPIO_DATA, gpio_data); |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 558 | |
| 559 | return change; |
| 560 | } |
| 561 | #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ |
| 562 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 563 | .info = alc_gpio_data_info, \ |
| 564 | .get = alc_gpio_data_get, \ |
| 565 | .put = alc_gpio_data_put, \ |
| 566 | .private_value = nid | (mask<<16) } |
| 567 | #endif /* CONFIG_SND_DEBUG */ |
| 568 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 569 | /* A switch control to allow the enabling of the digital IO pins on the |
| 570 | * ALC260. This is incredibly simplistic; the intention of this control is |
| 571 | * to provide something in the test model allowing digital outputs to be |
| 572 | * identified if present. If models are found which can utilise these |
| 573 | * outputs a more complete mixer control can be devised for those models if |
| 574 | * necessary. |
| 575 | */ |
| 576 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | a5ce889 | 2007-07-23 15:42:26 +0200 | [diff] [blame] | 577 | #define alc_spdif_ctrl_info snd_ctl_boolean_mono_info |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 578 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 579 | static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, |
| 580 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 581 | { |
| 582 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 583 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 584 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 585 | long *valp = ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 586 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 587 | AC_VERB_GET_DIGI_CONVERT_1, 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 588 | |
| 589 | *valp = (val & mask) != 0; |
| 590 | return 0; |
| 591 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 592 | static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, |
| 593 | struct snd_ctl_elem_value *ucontrol) |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 594 | { |
| 595 | signed int change; |
| 596 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 597 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 598 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 599 | long val = *ucontrol->value.integer.value; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 600 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
Andrew Paprocki | 3982d17 | 2007-12-19 12:13:44 +0100 | [diff] [blame] | 601 | AC_VERB_GET_DIGI_CONVERT_1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 602 | 0x00); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 603 | |
| 604 | /* Set/unset the masked control bit(s) as needed */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 605 | change = (val == 0 ? 0 : mask) != (ctrl_data & mask); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 606 | if (val==0) |
| 607 | ctrl_data &= ~mask; |
| 608 | else |
| 609 | ctrl_data |= mask; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 610 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, |
| 611 | ctrl_data); |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 612 | |
| 613 | return change; |
| 614 | } |
| 615 | #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ |
| 616 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 617 | .info = alc_spdif_ctrl_info, \ |
| 618 | .get = alc_spdif_ctrl_get, \ |
| 619 | .put = alc_spdif_ctrl_put, \ |
| 620 | .private_value = nid | (mask<<16) } |
| 621 | #endif /* CONFIG_SND_DEBUG */ |
| 622 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 623 | /* A switch control to allow the enabling EAPD digital outputs on the ALC26x. |
| 624 | * Again, this is only used in the ALC26x test models to help identify when |
| 625 | * the EAPD line must be asserted for features to work. |
| 626 | */ |
| 627 | #ifdef CONFIG_SND_DEBUG |
| 628 | #define alc_eapd_ctrl_info snd_ctl_boolean_mono_info |
| 629 | |
| 630 | static int alc_eapd_ctrl_get(struct snd_kcontrol *kcontrol, |
| 631 | struct snd_ctl_elem_value *ucontrol) |
| 632 | { |
| 633 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 634 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 635 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 636 | long *valp = ucontrol->value.integer.value; |
| 637 | unsigned int val = snd_hda_codec_read(codec, nid, 0, |
| 638 | AC_VERB_GET_EAPD_BTLENABLE, 0x00); |
| 639 | |
| 640 | *valp = (val & mask) != 0; |
| 641 | return 0; |
| 642 | } |
| 643 | |
| 644 | static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, |
| 645 | struct snd_ctl_elem_value *ucontrol) |
| 646 | { |
| 647 | int change; |
| 648 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 649 | hda_nid_t nid = kcontrol->private_value & 0xffff; |
| 650 | unsigned char mask = (kcontrol->private_value >> 16) & 0xff; |
| 651 | long val = *ucontrol->value.integer.value; |
| 652 | unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, |
| 653 | AC_VERB_GET_EAPD_BTLENABLE, |
| 654 | 0x00); |
| 655 | |
| 656 | /* Set/unset the masked control bit(s) as needed */ |
| 657 | change = (!val ? 0 : mask) != (ctrl_data & mask); |
| 658 | if (!val) |
| 659 | ctrl_data &= ~mask; |
| 660 | else |
| 661 | ctrl_data |= mask; |
| 662 | snd_hda_codec_write_cache(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 663 | ctrl_data); |
| 664 | |
| 665 | return change; |
| 666 | } |
| 667 | |
| 668 | #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \ |
| 669 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ |
| 670 | .info = alc_eapd_ctrl_info, \ |
| 671 | .get = alc_eapd_ctrl_get, \ |
| 672 | .put = alc_eapd_ctrl_put, \ |
| 673 | .private_value = nid | (mask<<16) } |
| 674 | #endif /* CONFIG_SND_DEBUG */ |
| 675 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 676 | /* |
| 677 | * set up from the preset table |
| 678 | */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 679 | static void setup_preset(struct alc_spec *spec, |
| 680 | const struct alc_config_preset *preset) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 681 | { |
| 682 | int i; |
| 683 | |
| 684 | for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) |
| 685 | spec->mixers[spec->num_mixers++] = preset->mixers[i]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 686 | for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; |
| 687 | i++) |
| 688 | spec->init_verbs[spec->num_init_verbs++] = |
| 689 | preset->init_verbs[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 690 | |
| 691 | spec->channel_mode = preset->channel_mode; |
| 692 | spec->num_channel_mode = preset->num_channel_mode; |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 693 | spec->need_dac_fix = preset->need_dac_fix; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 694 | |
| 695 | spec->multiout.max_channels = spec->channel_mode[0].channels; |
| 696 | |
| 697 | spec->multiout.num_dacs = preset->num_dacs; |
| 698 | spec->multiout.dac_nids = preset->dac_nids; |
| 699 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
| 700 | spec->multiout.hp_nid = preset->hp_nid; |
| 701 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 702 | spec->num_mux_defs = preset->num_mux_defs; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 703 | if (!spec->num_mux_defs) |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 704 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 705 | spec->input_mux = preset->input_mux; |
| 706 | |
| 707 | spec->num_adc_nids = preset->num_adc_nids; |
| 708 | spec->adc_nids = preset->adc_nids; |
| 709 | spec->dig_in_nid = preset->dig_in_nid; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 710 | |
| 711 | spec->unsol_event = preset->unsol_event; |
| 712 | spec->init_hook = preset->init_hook; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 713 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 714 | spec->loopback.amplist = preset->loopbacks; |
| 715 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 716 | } |
| 717 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 718 | /* Enable GPIO mask and set output */ |
| 719 | static struct hda_verb alc_gpio1_init_verbs[] = { |
| 720 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 721 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 722 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 723 | { } |
| 724 | }; |
| 725 | |
| 726 | static struct hda_verb alc_gpio2_init_verbs[] = { |
| 727 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 728 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 729 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 730 | { } |
| 731 | }; |
| 732 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 733 | static struct hda_verb alc_gpio3_init_verbs[] = { |
| 734 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 735 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 736 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 737 | { } |
| 738 | }; |
| 739 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 740 | static void alc_sku_automute(struct hda_codec *codec) |
| 741 | { |
| 742 | struct alc_spec *spec = codec->spec; |
| 743 | unsigned int mute; |
| 744 | unsigned int present; |
| 745 | unsigned int hp_nid = spec->autocfg.hp_pins[0]; |
| 746 | unsigned int sp_nid = spec->autocfg.speaker_pins[0]; |
| 747 | |
| 748 | /* need to execute and sync at first */ |
| 749 | snd_hda_codec_read(codec, hp_nid, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 750 | present = snd_hda_codec_read(codec, hp_nid, 0, |
| 751 | AC_VERB_GET_PIN_SENSE, 0); |
| 752 | spec->jack_present = (present & 0x80000000) != 0; |
| 753 | if (spec->jack_present) { |
| 754 | /* mute internal speaker */ |
| 755 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 756 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 757 | } else { |
| 758 | /* unmute internal speaker if necessary */ |
| 759 | mute = snd_hda_codec_amp_read(codec, hp_nid, 0, HDA_OUTPUT, 0); |
| 760 | snd_hda_codec_amp_stereo(codec, sp_nid, HDA_OUTPUT, 0, |
| 761 | HDA_AMP_MUTE, mute); |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | /* unsolicited event for HP jack sensing */ |
| 766 | static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) |
| 767 | { |
| 768 | if (codec->vendor_id == 0x10ec0880) |
| 769 | res >>= 28; |
| 770 | else |
| 771 | res >>= 26; |
| 772 | if (res != ALC880_HP_EVENT) |
| 773 | return; |
| 774 | |
| 775 | alc_sku_automute(codec); |
| 776 | } |
| 777 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 778 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 779 | * 31 ~ 16 : Manufacture ID |
| 780 | * 15 ~ 8 : SKU ID |
| 781 | * 7 ~ 0 : Assembly ID |
| 782 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 783 | */ |
| 784 | static void alc_subsystem_id(struct hda_codec *codec, |
| 785 | unsigned int porta, unsigned int porte, |
| 786 | unsigned int portd) |
| 787 | { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 788 | unsigned int ass, tmp, i; |
| 789 | unsigned nid; |
| 790 | struct alc_spec *spec = codec->spec; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 791 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 792 | ass = codec->subsystem_id & 0xffff; |
| 793 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 794 | goto do_sku; |
| 795 | |
| 796 | /* |
| 797 | * 31~30 : port conetcivity |
| 798 | * 29~21 : reserve |
| 799 | * 20 : PCBEEP input |
| 800 | * 19~16 : Check sum (15:1) |
| 801 | * 15~1 : Custom |
| 802 | * 0 : override |
| 803 | */ |
| 804 | nid = 0x1d; |
| 805 | if (codec->vendor_id == 0x10ec0260) |
| 806 | nid = 0x17; |
| 807 | ass = snd_hda_codec_read(codec, nid, 0, |
| 808 | AC_VERB_GET_CONFIG_DEFAULT, 0); |
| 809 | if (!(ass & 1) && !(ass & 0x100000)) |
| 810 | return; |
| 811 | if ((ass >> 30) != 1) /* no physical connection */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 812 | return; |
| 813 | |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 814 | /* check sum */ |
| 815 | tmp = 0; |
| 816 | for (i = 1; i < 16; i++) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 817 | if ((ass >> i) & 1) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 818 | tmp++; |
| 819 | } |
| 820 | if (((ass >> 16) & 0xf) != tmp) |
| 821 | return; |
| 822 | do_sku: |
| 823 | /* |
| 824 | * 0 : override |
| 825 | * 1 : Swap Jack |
| 826 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 827 | * 3~5 : External Amplifier control |
| 828 | * 7~6 : Reserved |
| 829 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 830 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 831 | switch (tmp) { |
| 832 | case 1: |
| 833 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 834 | break; |
| 835 | case 3: |
| 836 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 837 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 838 | case 7: |
| 839 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 840 | break; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 841 | case 5: /* set EAPD output high */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 842 | switch (codec->vendor_id) { |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 843 | case 0x10ec0260: |
| 844 | snd_hda_codec_write(codec, 0x0f, 0, |
| 845 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 846 | snd_hda_codec_write(codec, 0x10, 0, |
| 847 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 848 | break; |
| 849 | case 0x10ec0262: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 850 | case 0x10ec0267: |
| 851 | case 0x10ec0268: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 852 | case 0x10ec0269: |
| 853 | case 0x10ec0862: |
| 854 | case 0x10ec0662: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 855 | snd_hda_codec_write(codec, 0x14, 0, |
| 856 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
| 857 | snd_hda_codec_write(codec, 0x15, 0, |
| 858 | AC_VERB_SET_EAPD_BTLENABLE, 2); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 859 | break; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 860 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 861 | switch (codec->vendor_id) { |
| 862 | case 0x10ec0260: |
| 863 | snd_hda_codec_write(codec, 0x1a, 0, |
| 864 | AC_VERB_SET_COEF_INDEX, 7); |
| 865 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 866 | AC_VERB_GET_PROC_COEF, 0); |
| 867 | snd_hda_codec_write(codec, 0x1a, 0, |
| 868 | AC_VERB_SET_COEF_INDEX, 7); |
| 869 | snd_hda_codec_write(codec, 0x1a, 0, |
| 870 | AC_VERB_SET_PROC_COEF, |
| 871 | tmp | 0x2010); |
| 872 | break; |
| 873 | case 0x10ec0262: |
| 874 | case 0x10ec0880: |
| 875 | case 0x10ec0882: |
| 876 | case 0x10ec0883: |
| 877 | case 0x10ec0885: |
| 878 | case 0x10ec0888: |
| 879 | snd_hda_codec_write(codec, 0x20, 0, |
| 880 | AC_VERB_SET_COEF_INDEX, 7); |
| 881 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 882 | AC_VERB_GET_PROC_COEF, 0); |
| 883 | snd_hda_codec_write(codec, 0x20, 0, |
| 884 | AC_VERB_SET_COEF_INDEX, 7); |
| 885 | snd_hda_codec_write(codec, 0x20, 0, |
| 886 | AC_VERB_SET_PROC_COEF, |
| 887 | tmp | 0x2010); |
| 888 | break; |
| 889 | case 0x10ec0267: |
| 890 | case 0x10ec0268: |
| 891 | snd_hda_codec_write(codec, 0x20, 0, |
| 892 | AC_VERB_SET_COEF_INDEX, 7); |
| 893 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 894 | AC_VERB_GET_PROC_COEF, 0); |
| 895 | snd_hda_codec_write(codec, 0x20, 0, |
| 896 | AC_VERB_SET_COEF_INDEX, 7); |
| 897 | snd_hda_codec_write(codec, 0x20, 0, |
| 898 | AC_VERB_SET_PROC_COEF, |
| 899 | tmp | 0x3000); |
| 900 | break; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 901 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 902 | default: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 903 | break; |
| 904 | } |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 905 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 906 | /* is laptop or Desktop and enable the function "Mute internal speaker |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 907 | * when the external headphone out jack is plugged" |
| 908 | */ |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 909 | if (!(ass & 0x8000)) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 910 | return; |
| 911 | /* |
| 912 | * 10~8 : Jack location |
| 913 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 914 | * 14~13: Resvered |
| 915 | * 15 : 1 --> enable the function "Mute internal speaker |
| 916 | * when the external headphone out jack is plugged" |
| 917 | */ |
| 918 | if (!spec->autocfg.speaker_pins[0]) { |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 919 | if (spec->autocfg.line_out_pins[0]) |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 920 | spec->autocfg.speaker_pins[0] = |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 921 | spec->autocfg.line_out_pins[0]; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 922 | else |
| 923 | return; |
| 924 | } |
| 925 | |
| 926 | if (!spec->autocfg.hp_pins[0]) { |
| 927 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 928 | if (tmp == 0) |
| 929 | spec->autocfg.hp_pins[0] = porta; |
| 930 | else if (tmp == 1) |
| 931 | spec->autocfg.hp_pins[0] = porte; |
| 932 | else if (tmp == 2) |
| 933 | spec->autocfg.hp_pins[0] = portd; |
| 934 | else |
| 935 | return; |
| 936 | } |
| 937 | |
| 938 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
| 939 | AC_VERB_SET_UNSOLICITED_ENABLE, |
| 940 | AC_USRSP_EN | ALC880_HP_EVENT); |
| 941 | spec->unsol_event = alc_sku_unsol_event; |
| 942 | spec->init_hook = alc_sku_automute; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 943 | } |
| 944 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 945 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 946 | * Fix-up pin default configurations |
| 947 | */ |
| 948 | |
| 949 | struct alc_pincfg { |
| 950 | hda_nid_t nid; |
| 951 | u32 val; |
| 952 | }; |
| 953 | |
| 954 | static void alc_fix_pincfg(struct hda_codec *codec, |
| 955 | const struct snd_pci_quirk *quirk, |
| 956 | const struct alc_pincfg **pinfix) |
| 957 | { |
| 958 | const struct alc_pincfg *cfg; |
| 959 | |
| 960 | quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); |
| 961 | if (!quirk) |
| 962 | return; |
| 963 | |
| 964 | cfg = pinfix[quirk->value]; |
| 965 | for (; cfg->nid; cfg++) { |
| 966 | int i; |
| 967 | u32 val = cfg->val; |
| 968 | for (i = 0; i < 4; i++) { |
| 969 | snd_hda_codec_write(codec, cfg->nid, 0, |
| 970 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, |
| 971 | val & 0xff); |
| 972 | val >>= 8; |
| 973 | } |
| 974 | } |
| 975 | } |
| 976 | |
| 977 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 978 | * ALC880 3-stack model |
| 979 | * |
| 980 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 981 | * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, |
| 982 | * F-Mic = 0x1b, HP = 0x19 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 983 | */ |
| 984 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 985 | static hda_nid_t alc880_dac_nids[4] = { |
| 986 | /* front, rear, clfe, rear_surr */ |
| 987 | 0x02, 0x05, 0x04, 0x03 |
| 988 | }; |
| 989 | |
| 990 | static hda_nid_t alc880_adc_nids[3] = { |
| 991 | /* ADC0-2 */ |
| 992 | 0x07, 0x08, 0x09, |
| 993 | }; |
| 994 | |
| 995 | /* The datasheet says the node 0x07 is connected from inputs, |
| 996 | * but it shows zero connection in the real implementation on some devices. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 997 | * Note: this is a 915GAV bug, fixed on 915GLV |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 998 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 999 | static hda_nid_t alc880_adc_nids_alt[2] = { |
| 1000 | /* ADC1-2 */ |
| 1001 | 0x08, 0x09, |
| 1002 | }; |
| 1003 | |
| 1004 | #define ALC880_DIGOUT_NID 0x06 |
| 1005 | #define ALC880_DIGIN_NID 0x0a |
| 1006 | |
| 1007 | static struct hda_input_mux alc880_capture_source = { |
| 1008 | .num_items = 4, |
| 1009 | .items = { |
| 1010 | { "Mic", 0x0 }, |
| 1011 | { "Front Mic", 0x3 }, |
| 1012 | { "Line", 0x2 }, |
| 1013 | { "CD", 0x4 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1014 | }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1015 | }; |
| 1016 | |
| 1017 | /* channel source setting (2/6 channel selection for 3-stack) */ |
| 1018 | /* 2ch mode */ |
| 1019 | static struct hda_verb alc880_threestack_ch2_init[] = { |
| 1020 | /* set line-in to input, mute it */ |
| 1021 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1022 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 1023 | /* set mic-in to input vref 80%, mute it */ |
| 1024 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 1025 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1026 | { } /* end */ |
| 1027 | }; |
| 1028 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1029 | /* 6ch mode */ |
| 1030 | static struct hda_verb alc880_threestack_ch6_init[] = { |
| 1031 | /* set line-in to output, unmute it */ |
| 1032 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1033 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1034 | /* set mic-in to output, unmute it */ |
| 1035 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1036 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1037 | { } /* end */ |
| 1038 | }; |
| 1039 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1040 | static struct hda_channel_mode alc880_threestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1041 | { 2, alc880_threestack_ch2_init }, |
| 1042 | { 6, alc880_threestack_ch6_init }, |
| 1043 | }; |
| 1044 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1045 | static struct snd_kcontrol_new alc880_three_stack_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1046 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1047 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1048 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1049 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1050 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1051 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1052 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1053 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1054 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1055 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1056 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1057 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1058 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1059 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1060 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 1061 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 1062 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1063 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1064 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1065 | { |
| 1066 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1067 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1068 | .info = alc_ch_mode_info, |
| 1069 | .get = alc_ch_mode_get, |
| 1070 | .put = alc_ch_mode_put, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1071 | }, |
| 1072 | { } /* end */ |
| 1073 | }; |
| 1074 | |
| 1075 | /* capture mixer elements */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1076 | static struct snd_kcontrol_new alc880_capture_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1077 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 1078 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 1079 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 1080 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 1081 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 1082 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 1083 | { |
| 1084 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1085 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1086 | * So call somewhat different.. |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1087 | */ |
| 1088 | /* .name = "Capture Source", */ |
| 1089 | .name = "Input Source", |
| 1090 | .count = 3, |
| 1091 | .info = alc_mux_enum_info, |
| 1092 | .get = alc_mux_enum_get, |
| 1093 | .put = alc_mux_enum_put, |
| 1094 | }, |
| 1095 | { } /* end */ |
| 1096 | }; |
| 1097 | |
| 1098 | /* capture mixer elements (in case NID 0x07 not available) */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1099 | static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1100 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1101 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1102 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 1103 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1104 | { |
| 1105 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1106 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1107 | * So call somewhat different.. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1108 | */ |
| 1109 | /* .name = "Capture Source", */ |
| 1110 | .name = "Input Source", |
| 1111 | .count = 2, |
| 1112 | .info = alc_mux_enum_info, |
| 1113 | .get = alc_mux_enum_get, |
| 1114 | .put = alc_mux_enum_put, |
| 1115 | }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1116 | { } /* end */ |
| 1117 | }; |
| 1118 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1119 | |
| 1120 | |
| 1121 | /* |
| 1122 | * ALC880 5-stack model |
| 1123 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1124 | * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), |
| 1125 | * Side = 0x02 (0xd) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1126 | * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 |
| 1127 | * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 |
| 1128 | */ |
| 1129 | |
| 1130 | /* additional mixers to alc880_three_stack_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1131 | static struct snd_kcontrol_new alc880_five_stack_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1132 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1133 | HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1134 | { } /* end */ |
| 1135 | }; |
| 1136 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1137 | /* channel source setting (6/8 channel selection for 5-stack) */ |
| 1138 | /* 6ch mode */ |
| 1139 | static struct hda_verb alc880_fivestack_ch6_init[] = { |
| 1140 | /* set line-in to input, mute it */ |
| 1141 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 1142 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1143 | { } /* end */ |
| 1144 | }; |
| 1145 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1146 | /* 8ch mode */ |
| 1147 | static struct hda_verb alc880_fivestack_ch8_init[] = { |
| 1148 | /* set line-in to output, unmute it */ |
| 1149 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 1150 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 1151 | { } /* end */ |
| 1152 | }; |
| 1153 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1154 | static struct hda_channel_mode alc880_fivestack_modes[2] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1155 | { 6, alc880_fivestack_ch6_init }, |
| 1156 | { 8, alc880_fivestack_ch8_init }, |
| 1157 | }; |
| 1158 | |
| 1159 | |
| 1160 | /* |
| 1161 | * ALC880 6-stack model |
| 1162 | * |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1163 | * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), |
| 1164 | * Side = 0x05 (0x0f) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1165 | * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, |
| 1166 | * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b |
| 1167 | */ |
| 1168 | |
| 1169 | static hda_nid_t alc880_6st_dac_nids[4] = { |
| 1170 | /* front, rear, clfe, rear_surr */ |
| 1171 | 0x02, 0x03, 0x04, 0x05 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1172 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1173 | |
| 1174 | static struct hda_input_mux alc880_6stack_capture_source = { |
| 1175 | .num_items = 4, |
| 1176 | .items = { |
| 1177 | { "Mic", 0x0 }, |
| 1178 | { "Front Mic", 0x1 }, |
| 1179 | { "Line", 0x2 }, |
| 1180 | { "CD", 0x4 }, |
| 1181 | }, |
| 1182 | }; |
| 1183 | |
| 1184 | /* fixed 8-channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1185 | static struct hda_channel_mode alc880_sixstack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1186 | { 8, NULL }, |
| 1187 | }; |
| 1188 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1189 | static struct snd_kcontrol_new alc880_six_stack_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1190 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1191 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1192 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1193 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1194 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1195 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1196 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1197 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1198 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1199 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1200 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1201 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1202 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1203 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1204 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1205 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1206 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1207 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1208 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1209 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1210 | { |
| 1211 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1212 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1213 | .info = alc_ch_mode_info, |
| 1214 | .get = alc_ch_mode_get, |
| 1215 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1216 | }, |
| 1217 | { } /* end */ |
| 1218 | }; |
| 1219 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1220 | |
| 1221 | /* |
| 1222 | * ALC880 W810 model |
| 1223 | * |
| 1224 | * W810 has rear IO for: |
| 1225 | * Front (DAC 02) |
| 1226 | * Surround (DAC 03) |
| 1227 | * Center/LFE (DAC 04) |
| 1228 | * Digital out (06) |
| 1229 | * |
| 1230 | * The system also has a pair of internal speakers, and a headphone jack. |
| 1231 | * These are both connected to Line2 on the codec, hence to DAC 02. |
| 1232 | * |
| 1233 | * There is a variable resistor to control the speaker or headphone |
| 1234 | * volume. This is a hardware-only device without a software API. |
| 1235 | * |
| 1236 | * Plugging headphones in will disable the internal speakers. This is |
| 1237 | * implemented in hardware, not via the driver using jack sense. In |
| 1238 | * a similar fashion, plugging into the rear socket marked "front" will |
| 1239 | * disable both the speakers and headphones. |
| 1240 | * |
| 1241 | * For input, there's a microphone jack, and an "audio in" jack. |
| 1242 | * These may not do anything useful with this driver yet, because I |
| 1243 | * haven't setup any initialization verbs for these yet... |
| 1244 | */ |
| 1245 | |
| 1246 | static hda_nid_t alc880_w810_dac_nids[3] = { |
| 1247 | /* front, rear/surround, clfe */ |
| 1248 | 0x02, 0x03, 0x04 |
| 1249 | }; |
| 1250 | |
| 1251 | /* fixed 6 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1252 | static struct hda_channel_mode alc880_w810_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1253 | { 6, NULL } |
| 1254 | }; |
| 1255 | |
| 1256 | /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1257 | static struct snd_kcontrol_new alc880_w810_base_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1258 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1259 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1260 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1261 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1262 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1263 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1264 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1265 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1266 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1267 | { } /* end */ |
| 1268 | }; |
| 1269 | |
| 1270 | |
| 1271 | /* |
| 1272 | * Z710V model |
| 1273 | * |
| 1274 | * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1275 | * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), |
| 1276 | * Line = 0x1a |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1277 | */ |
| 1278 | |
| 1279 | static hda_nid_t alc880_z71v_dac_nids[1] = { |
| 1280 | 0x02 |
| 1281 | }; |
| 1282 | #define ALC880_Z71V_HP_DAC 0x03 |
| 1283 | |
| 1284 | /* fixed 2 channels */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 1285 | static struct hda_channel_mode alc880_2_jack_modes[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1286 | { 2, NULL } |
| 1287 | }; |
| 1288 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1289 | static struct snd_kcontrol_new alc880_z71v_mixer[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1290 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1291 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1292 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1293 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1294 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1295 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1296 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1297 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1298 | { } /* end */ |
| 1299 | }; |
| 1300 | |
| 1301 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1302 | /* |
| 1303 | * ALC880 F1734 model |
| 1304 | * |
| 1305 | * DAC: HP = 0x02 (0x0c), Front = 0x03 (0x0d) |
| 1306 | * Pin assignment: HP = 0x14, Front = 0x15, Mic = 0x18 |
| 1307 | */ |
| 1308 | |
| 1309 | static hda_nid_t alc880_f1734_dac_nids[1] = { |
| 1310 | 0x03 |
| 1311 | }; |
| 1312 | #define ALC880_F1734_HP_DAC 0x02 |
| 1313 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1314 | static struct snd_kcontrol_new alc880_f1734_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1315 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1316 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1317 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1318 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1319 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1320 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1321 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1322 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1323 | { } /* end */ |
| 1324 | }; |
| 1325 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1326 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1327 | /* |
| 1328 | * ALC880 ASUS model |
| 1329 | * |
| 1330 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1331 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1332 | * Mic = 0x18, Line = 0x1a |
| 1333 | */ |
| 1334 | |
| 1335 | #define alc880_asus_dac_nids alc880_w810_dac_nids /* identical with w810 */ |
| 1336 | #define alc880_asus_modes alc880_threestack_modes /* 2/6 channel mode */ |
| 1337 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1338 | static struct snd_kcontrol_new alc880_asus_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1339 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1340 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1341 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1342 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1343 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1344 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 1345 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1346 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1347 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1348 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1349 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1350 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1351 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1352 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1353 | { |
| 1354 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1355 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1356 | .info = alc_ch_mode_info, |
| 1357 | .get = alc_ch_mode_get, |
| 1358 | .put = alc_ch_mode_put, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1359 | }, |
| 1360 | { } /* end */ |
| 1361 | }; |
| 1362 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1363 | /* |
| 1364 | * ALC880 ASUS W1V model |
| 1365 | * |
| 1366 | * DAC: HP/Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e) |
| 1367 | * Pin assignment: HP/Front = 0x14, Surr = 0x15, CLFE = 0x16, |
| 1368 | * Mic = 0x18, Line = 0x1a, Line2 = 0x1b |
| 1369 | */ |
| 1370 | |
| 1371 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1372 | static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1373 | HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 1374 | HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1375 | { } /* end */ |
| 1376 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1377 | |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1378 | /* additional mixers to alc880_asus_mixer */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 1379 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 1380 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1381 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1382 | { } /* end */ |
| 1383 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1384 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1385 | /* TCL S700 */ |
| 1386 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
| 1387 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1388 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 1389 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 1390 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), |
| 1391 | HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), |
| 1392 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), |
| 1393 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), |
| 1394 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 1395 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 1396 | { |
| 1397 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1398 | /* The multiple "Capture Source" controls confuse alsamixer |
| 1399 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1400 | */ |
| 1401 | /* .name = "Capture Source", */ |
| 1402 | .name = "Input Source", |
| 1403 | .count = 1, |
| 1404 | .info = alc_mux_enum_info, |
| 1405 | .get = alc_mux_enum_get, |
| 1406 | .put = alc_mux_enum_put, |
| 1407 | }, |
| 1408 | { } /* end */ |
| 1409 | }; |
| 1410 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1411 | /* Uniwill */ |
| 1412 | static struct snd_kcontrol_new alc880_uniwill_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1413 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1414 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1415 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1416 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1417 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 1418 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 1419 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 1420 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 1421 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1422 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1423 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 1424 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 1425 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1427 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1428 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1429 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 1430 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 1431 | { |
| 1432 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 1433 | .name = "Channel Mode", |
| 1434 | .info = alc_ch_mode_info, |
| 1435 | .get = alc_ch_mode_get, |
| 1436 | .put = alc_ch_mode_put, |
| 1437 | }, |
| 1438 | { } /* end */ |
| 1439 | }; |
| 1440 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1441 | static struct snd_kcontrol_new alc880_fujitsu_mixer[] = { |
| 1442 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1443 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1444 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1445 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
| 1446 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 1447 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 1448 | HDA_CODEC_VOLUME("Ext Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1449 | HDA_CODEC_MUTE("Ext Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1450 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 1451 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 1452 | { } /* end */ |
| 1453 | }; |
| 1454 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1455 | static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1456 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 1457 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), |
| 1458 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 1459 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1460 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 1461 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 1462 | { } /* end */ |
| 1463 | }; |
| 1464 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1465 | /* |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1466 | * virtual master controls |
| 1467 | */ |
| 1468 | |
| 1469 | /* |
| 1470 | * slave controls for virtual master |
| 1471 | */ |
| 1472 | static const char *alc_slave_vols[] = { |
| 1473 | "Front Playback Volume", |
| 1474 | "Surround Playback Volume", |
| 1475 | "Center Playback Volume", |
| 1476 | "LFE Playback Volume", |
| 1477 | "Side Playback Volume", |
| 1478 | "Headphone Playback Volume", |
| 1479 | "Speaker Playback Volume", |
| 1480 | "Mono Playback Volume", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1481 | "Line-Out Playback Volume", |
| 1482 | NULL, |
| 1483 | }; |
| 1484 | |
| 1485 | static const char *alc_slave_sws[] = { |
| 1486 | "Front Playback Switch", |
| 1487 | "Surround Playback Switch", |
| 1488 | "Center Playback Switch", |
| 1489 | "LFE Playback Switch", |
| 1490 | "Side Playback Switch", |
| 1491 | "Headphone Playback Switch", |
| 1492 | "Speaker Playback Switch", |
| 1493 | "Mono Playback Switch", |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1494 | NULL, |
| 1495 | }; |
| 1496 | |
| 1497 | /* |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1498 | * build control elements |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1499 | */ |
| 1500 | static int alc_build_controls(struct hda_codec *codec) |
| 1501 | { |
| 1502 | struct alc_spec *spec = codec->spec; |
| 1503 | int err; |
| 1504 | int i; |
| 1505 | |
| 1506 | for (i = 0; i < spec->num_mixers; i++) { |
| 1507 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 1508 | if (err < 0) |
| 1509 | return err; |
| 1510 | } |
| 1511 | |
| 1512 | if (spec->multiout.dig_out_nid) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1513 | err = snd_hda_create_spdif_out_ctls(codec, |
| 1514 | spec->multiout.dig_out_nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1515 | if (err < 0) |
| 1516 | return err; |
| 1517 | } |
| 1518 | if (spec->dig_in_nid) { |
| 1519 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
| 1520 | if (err < 0) |
| 1521 | return err; |
| 1522 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 1523 | |
| 1524 | /* if we have no master control, let's create it */ |
| 1525 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
| 1526 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
| 1527 | HDA_OUTPUT, spec->vmaster_tlv); |
| 1528 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
| 1529 | spec->vmaster_tlv, alc_slave_vols); |
| 1530 | if (err < 0) |
| 1531 | return err; |
| 1532 | } |
| 1533 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { |
| 1534 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
| 1535 | NULL, alc_slave_sws); |
| 1536 | if (err < 0) |
| 1537 | return err; |
| 1538 | } |
| 1539 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1540 | return 0; |
| 1541 | } |
| 1542 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1544 | /* |
| 1545 | * initialize the codec volumes, etc |
| 1546 | */ |
| 1547 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1548 | /* |
| 1549 | * generic initialization of ADC, input mixers and output mixers |
| 1550 | */ |
| 1551 | static struct hda_verb alc880_volume_init_verbs[] = { |
| 1552 | /* |
| 1553 | * Unmute ADC0-2 and set the default input to mic-in |
| 1554 | */ |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1555 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1556 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1557 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1558 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 1559 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1560 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1561 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1562 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 1563 | * mixer widget |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1564 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 1565 | * panel mic (mic 2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1566 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1567 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 1568 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1569 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 1570 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 1571 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 1572 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 1573 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 1574 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1575 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1576 | /* |
| 1577 | * Set up output mixers (0x0c - 0x0f) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1578 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1579 | /* set vol=0 to output mixers */ |
| 1580 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1581 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1582 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1583 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 1584 | /* set up input amps for analog loopback */ |
| 1585 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1586 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1587 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1588 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1589 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1590 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1591 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1592 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 1593 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1594 | |
| 1595 | { } |
| 1596 | }; |
| 1597 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1598 | /* |
| 1599 | * 3-stack pin configuration: |
| 1600 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 1601 | */ |
| 1602 | static struct hda_verb alc880_pin_3stack_init_verbs[] = { |
| 1603 | /* |
| 1604 | * preset connection lists of input pins |
| 1605 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1606 | */ |
| 1607 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 1608 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1609 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 1610 | |
| 1611 | /* |
| 1612 | * Set pin mode and muting |
| 1613 | */ |
| 1614 | /* set front pin widgets 0x14 for output */ |
| 1615 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1616 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1617 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 1618 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1619 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1620 | /* Mic2 (as headphone out) for HP output */ |
| 1621 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1622 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1623 | /* Line In pin widget for input */ |
| 1624 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1625 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1626 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1627 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1628 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1629 | /* CD pin widget for input */ |
| 1630 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1631 | |
| 1632 | { } |
| 1633 | }; |
| 1634 | |
| 1635 | /* |
| 1636 | * 5-stack pin configuration: |
| 1637 | * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, |
| 1638 | * line-in/side = 0x1a, f-mic = 0x1b |
| 1639 | */ |
| 1640 | static struct hda_verb alc880_pin_5stack_init_verbs[] = { |
| 1641 | /* |
| 1642 | * preset connection lists of input pins |
| 1643 | * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround |
| 1644 | */ |
| 1645 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1646 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ |
| 1647 | |
| 1648 | /* |
| 1649 | * Set pin mode and muting |
| 1650 | */ |
| 1651 | /* set pin widgets 0x14-0x17 for output */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1652 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1653 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1654 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1655 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1656 | /* unmute pins for output (no gain on this amp) */ |
| 1657 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1658 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1659 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1660 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1661 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1662 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1663 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1664 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1665 | /* Mic2 (as headphone out) for HP output */ |
| 1666 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1667 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1668 | /* Line In pin widget for input */ |
| 1669 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1670 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1671 | /* Line2 (as front mic) pin widget for input and vref at 80% */ |
| 1672 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1673 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1674 | /* CD pin widget for input */ |
| 1675 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1676 | |
| 1677 | { } |
| 1678 | }; |
| 1679 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1680 | /* |
| 1681 | * W810 pin configuration: |
| 1682 | * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b |
| 1683 | */ |
| 1684 | static struct hda_verb alc880_pin_w810_init_verbs[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1685 | /* hphone/speaker input selector: front DAC */ |
| 1686 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, |
| 1687 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1688 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1689 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1690 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1691 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1692 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1693 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1694 | |
| 1695 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1696 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1697 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1698 | { } |
| 1699 | }; |
| 1700 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1701 | /* |
| 1702 | * Z71V pin configuration: |
| 1703 | * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) |
| 1704 | */ |
| 1705 | static struct hda_verb alc880_pin_z71v_init_verbs[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1706 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1707 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 1708 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1709 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1710 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1711 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1712 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1713 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1714 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | dfc0ff6 | 2005-05-12 14:31:49 +0200 | [diff] [blame] | 1715 | |
| 1716 | { } |
| 1717 | }; |
| 1718 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1719 | /* |
| 1720 | * 6-stack pin configuration: |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 1721 | * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, |
| 1722 | * f-mic = 0x19, line = 0x1a, HP = 0x1b |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1723 | */ |
| 1724 | static struct hda_verb alc880_pin_6stack_init_verbs[] = { |
| 1725 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1726 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1727 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1728 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1730 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1731 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1732 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1733 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1734 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1735 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1736 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1737 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1738 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1739 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1740 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1741 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1742 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1743 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1744 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1745 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1746 | { } |
| 1747 | }; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1748 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1749 | /* |
| 1750 | * Uniwill pin configuration: |
| 1751 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, |
| 1752 | * line = 0x1a |
| 1753 | */ |
| 1754 | static struct hda_verb alc880_uniwill_init_verbs[] = { |
| 1755 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1756 | |
| 1757 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1758 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1759 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1760 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1761 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1762 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1763 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1764 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1765 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1766 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1767 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1768 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1769 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1770 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1771 | |
| 1772 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1773 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1774 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1775 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1776 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1777 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1778 | /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ |
| 1779 | /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ |
| 1780 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1781 | |
| 1782 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1783 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 1784 | |
| 1785 | { } |
| 1786 | }; |
| 1787 | |
| 1788 | /* |
| 1789 | * Uniwill P53 |
| 1790 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
| 1791 | */ |
| 1792 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
| 1793 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 1794 | |
| 1795 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1796 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1797 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1798 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1799 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1800 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1801 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1802 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1803 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1804 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1805 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 1806 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 1807 | |
| 1808 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1809 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1810 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1811 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1812 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1813 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1814 | |
| 1815 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 1816 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, |
| 1817 | |
| 1818 | { } |
| 1819 | }; |
| 1820 | |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 1821 | static struct hda_verb alc880_beep_init_verbs[] = { |
| 1822 | { 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) }, |
| 1823 | { } |
| 1824 | }; |
| 1825 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1826 | /* toggle speaker-output according to the hp-jack state */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1827 | static void alc880_uniwill_hp_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1828 | { |
| 1829 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1830 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1831 | |
| 1832 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1833 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1834 | bits = present ? HDA_AMP_MUTE : 0; |
| 1835 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 1836 | HDA_AMP_MUTE, bits); |
| 1837 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 1838 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1839 | } |
| 1840 | |
| 1841 | /* auto-toggle front mic */ |
| 1842 | static void alc880_uniwill_mic_automute(struct hda_codec *codec) |
| 1843 | { |
| 1844 | unsigned int present; |
| 1845 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1846 | |
| 1847 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 1848 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1849 | bits = present ? HDA_AMP_MUTE : 0; |
| 1850 | 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] | 1851 | } |
| 1852 | |
| 1853 | static void alc880_uniwill_automute(struct hda_codec *codec) |
| 1854 | { |
| 1855 | alc880_uniwill_hp_automute(codec); |
| 1856 | alc880_uniwill_mic_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1857 | } |
| 1858 | |
| 1859 | static void alc880_uniwill_unsol_event(struct hda_codec *codec, |
| 1860 | unsigned int res) |
| 1861 | { |
| 1862 | /* Looks like the unsol event is incompatible with the standard |
| 1863 | * definition. 4bit tag is placed at 28 bit! |
| 1864 | */ |
Takashi Iwai | 458a4fa | 2007-05-05 12:18:40 +0200 | [diff] [blame] | 1865 | switch (res >> 28) { |
| 1866 | case ALC880_HP_EVENT: |
| 1867 | alc880_uniwill_hp_automute(codec); |
| 1868 | break; |
| 1869 | case ALC880_MIC_EVENT: |
| 1870 | alc880_uniwill_mic_automute(codec); |
| 1871 | break; |
| 1872 | } |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1873 | } |
| 1874 | |
| 1875 | static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) |
| 1876 | { |
| 1877 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1878 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1879 | |
| 1880 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 1881 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1882 | bits = present ? HDA_AMP_MUTE : 0; |
| 1883 | 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] | 1884 | } |
| 1885 | |
| 1886 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
| 1887 | { |
| 1888 | unsigned int present; |
| 1889 | |
| 1890 | present = snd_hda_codec_read(codec, 0x21, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1891 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 1892 | present &= HDA_AMP_VOLMASK; |
| 1893 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, |
| 1894 | HDA_AMP_VOLMASK, present); |
| 1895 | snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0, |
| 1896 | HDA_AMP_VOLMASK, present); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1897 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 1898 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1899 | static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, |
| 1900 | unsigned int res) |
| 1901 | { |
| 1902 | /* Looks like the unsol event is incompatible with the standard |
| 1903 | * definition. 4bit tag is placed at 28 bit! |
| 1904 | */ |
| 1905 | if ((res >> 28) == ALC880_HP_EVENT) |
| 1906 | alc880_uniwill_p53_hp_automute(codec); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 1907 | if ((res >> 28) == ALC880_DCVOL_EVENT) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 1908 | alc880_uniwill_p53_dcvol_automute(codec); |
| 1909 | } |
| 1910 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1911 | /* |
| 1912 | * F1734 pin configuration: |
| 1913 | * HP = 0x14, speaker-out = 0x15, mic = 0x18 |
| 1914 | */ |
| 1915 | static struct hda_verb alc880_pin_f1734_init_verbs[] = { |
| 1916 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1917 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1918 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1919 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1920 | |
| 1921 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1922 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1923 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1924 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1925 | |
| 1926 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1927 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1928 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1929 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1930 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1931 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1932 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1933 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1934 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 1935 | |
| 1936 | { } |
| 1937 | }; |
| 1938 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1939 | /* |
| 1940 | * ASUS pin configuration: |
| 1941 | * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a |
| 1942 | */ |
| 1943 | static struct hda_verb alc880_pin_asus_init_verbs[] = { |
| 1944 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 1945 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1946 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1947 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 1948 | |
| 1949 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1950 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1951 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1952 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1953 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1954 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1955 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1956 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1957 | |
| 1958 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1959 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1960 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1961 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1962 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1963 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 1964 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1965 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1966 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1967 | |
| 1968 | { } |
| 1969 | }; |
| 1970 | |
| 1971 | /* Enable GPIO mask and set output */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 1972 | #define alc880_gpio1_init_verbs alc_gpio1_init_verbs |
| 1973 | #define alc880_gpio2_init_verbs alc_gpio2_init_verbs |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 1974 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 1975 | /* Clevo m520g init */ |
| 1976 | static struct hda_verb alc880_pin_clevo_init_verbs[] = { |
| 1977 | /* headphone output */ |
| 1978 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 1979 | /* line-out */ |
| 1980 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 1981 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1982 | /* Line-in */ |
| 1983 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1984 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1985 | /* CD */ |
| 1986 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 1987 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1988 | /* Mic1 (rear panel) */ |
| 1989 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1990 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1991 | /* Mic2 (front panel) */ |
| 1992 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 1993 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1994 | /* headphone */ |
| 1995 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 1996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 1997 | /* change to EAPD mode */ |
| 1998 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 1999 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2000 | |
| 2001 | { } |
| 2002 | }; |
| 2003 | |
| 2004 | static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 2005 | /* change to EAPD mode */ |
| 2006 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2007 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
| 2008 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2009 | /* Headphone output */ |
| 2010 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2011 | /* Front output*/ |
| 2012 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2013 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 2014 | |
| 2015 | /* Line In pin widget for input */ |
| 2016 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2017 | /* CD pin widget for input */ |
| 2018 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2019 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 2020 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2021 | |
| 2022 | /* change to EAPD mode */ |
| 2023 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 2024 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 2025 | |
| 2026 | { } |
| 2027 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2028 | |
| 2029 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2030 | * LG m1 express dual |
| 2031 | * |
| 2032 | * Pin assignment: |
| 2033 | * Rear Line-In/Out (blue): 0x14 |
| 2034 | * Build-in Mic-In: 0x15 |
| 2035 | * Speaker-out: 0x17 |
| 2036 | * HP-Out (green): 0x1b |
| 2037 | * Mic-In/Out (red): 0x19 |
| 2038 | * SPDIF-Out: 0x1e |
| 2039 | */ |
| 2040 | |
| 2041 | /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ |
| 2042 | static hda_nid_t alc880_lg_dac_nids[3] = { |
| 2043 | 0x05, 0x02, 0x03 |
| 2044 | }; |
| 2045 | |
| 2046 | /* seems analog CD is not working */ |
| 2047 | static struct hda_input_mux alc880_lg_capture_source = { |
| 2048 | .num_items = 3, |
| 2049 | .items = { |
| 2050 | { "Mic", 0x1 }, |
| 2051 | { "Line", 0x5 }, |
| 2052 | { "Internal Mic", 0x6 }, |
| 2053 | }, |
| 2054 | }; |
| 2055 | |
| 2056 | /* 2,4,6 channel modes */ |
| 2057 | static struct hda_verb alc880_lg_ch2_init[] = { |
| 2058 | /* set line-in and mic-in to input */ |
| 2059 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 2060 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2061 | { } |
| 2062 | }; |
| 2063 | |
| 2064 | static struct hda_verb alc880_lg_ch4_init[] = { |
| 2065 | /* set line-in to out and mic-in to input */ |
| 2066 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2067 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 2068 | { } |
| 2069 | }; |
| 2070 | |
| 2071 | static struct hda_verb alc880_lg_ch6_init[] = { |
| 2072 | /* set line-in and mic-in to output */ |
| 2073 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2074 | { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
| 2075 | { } |
| 2076 | }; |
| 2077 | |
| 2078 | static struct hda_channel_mode alc880_lg_ch_modes[3] = { |
| 2079 | { 2, alc880_lg_ch2_init }, |
| 2080 | { 4, alc880_lg_ch4_init }, |
| 2081 | { 6, alc880_lg_ch6_init }, |
| 2082 | }; |
| 2083 | |
| 2084 | static struct snd_kcontrol_new alc880_lg_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 2085 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2086 | HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2087 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2088 | HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2089 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 2090 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 2091 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 2092 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 2093 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2094 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2095 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 2096 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 2097 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), |
| 2098 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), |
| 2099 | { |
| 2100 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2101 | .name = "Channel Mode", |
| 2102 | .info = alc_ch_mode_info, |
| 2103 | .get = alc_ch_mode_get, |
| 2104 | .put = alc_ch_mode_put, |
| 2105 | }, |
| 2106 | { } /* end */ |
| 2107 | }; |
| 2108 | |
| 2109 | static struct hda_verb alc880_lg_init_verbs[] = { |
| 2110 | /* set capture source to mic-in */ |
| 2111 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2112 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2113 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2114 | /* mute all amp mixer inputs */ |
| 2115 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2116 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 2117 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2118 | /* line-in to input */ |
| 2119 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2120 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2121 | /* built-in mic */ |
| 2122 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2123 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2124 | /* speaker-out */ |
| 2125 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2126 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2127 | /* mic-in to input */ |
| 2128 | {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 2129 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2130 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2131 | /* HP-out */ |
| 2132 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 2133 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2134 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2135 | /* jack sense */ |
| 2136 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2137 | { } |
| 2138 | }; |
| 2139 | |
| 2140 | /* toggle speaker-output according to the hp-jack state */ |
| 2141 | static void alc880_lg_automute(struct hda_codec *codec) |
| 2142 | { |
| 2143 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2144 | unsigned char bits; |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2145 | |
| 2146 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2147 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2148 | bits = present ? HDA_AMP_MUTE : 0; |
| 2149 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 2150 | HDA_AMP_MUTE, bits); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2151 | } |
| 2152 | |
| 2153 | static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2154 | { |
| 2155 | /* Looks like the unsol event is incompatible with the standard |
| 2156 | * definition. 4bit tag is placed at 28 bit! |
| 2157 | */ |
| 2158 | if ((res >> 28) == 0x01) |
| 2159 | alc880_lg_automute(codec); |
| 2160 | } |
| 2161 | |
| 2162 | /* |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2163 | * LG LW20 |
| 2164 | * |
| 2165 | * Pin assignment: |
| 2166 | * Speaker-out: 0x14 |
| 2167 | * Mic-In: 0x18 |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2168 | * Built-in Mic-In: 0x19 |
| 2169 | * Line-In: 0x1b |
| 2170 | * HP-Out: 0x1a |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2171 | * SPDIF-Out: 0x1e |
| 2172 | */ |
| 2173 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2174 | static struct hda_input_mux alc880_lg_lw_capture_source = { |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2175 | .num_items = 3, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2176 | .items = { |
| 2177 | { "Mic", 0x0 }, |
| 2178 | { "Internal Mic", 0x1 }, |
Claudio Matsuoka | e4f41da | 2007-07-13 11:51:06 +0200 | [diff] [blame] | 2179 | { "Line In", 0x2 }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2180 | }, |
| 2181 | }; |
| 2182 | |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2183 | #define alc880_lg_lw_modes alc880_threestack_modes |
| 2184 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2185 | static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2186 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2187 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2188 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 2189 | HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), |
| 2190 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 2191 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 2192 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 2193 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 2194 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 2195 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2196 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2197 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2198 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 2199 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2200 | { |
| 2201 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2202 | .name = "Channel Mode", |
| 2203 | .info = alc_ch_mode_info, |
| 2204 | .get = alc_ch_mode_get, |
| 2205 | .put = alc_ch_mode_put, |
| 2206 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2207 | { } /* end */ |
| 2208 | }; |
| 2209 | |
| 2210 | static struct hda_verb alc880_lg_lw_init_verbs[] = { |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 2211 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 2212 | {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 2213 | {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ |
| 2214 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2215 | /* set capture source to mic-in */ |
| 2216 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2217 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2218 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2219 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2220 | /* speaker-out */ |
| 2221 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2222 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2223 | /* HP-out */ |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2224 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 2225 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2226 | /* mic-in to input */ |
| 2227 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2228 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2229 | /* built-in mic */ |
| 2230 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2231 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2232 | /* jack sense */ |
| 2233 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, |
| 2234 | { } |
| 2235 | }; |
| 2236 | |
| 2237 | /* toggle speaker-output according to the hp-jack state */ |
| 2238 | static void alc880_lg_lw_automute(struct hda_codec *codec) |
| 2239 | { |
| 2240 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2241 | unsigned char bits; |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2242 | |
| 2243 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 2244 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2245 | bits = present ? HDA_AMP_MUTE : 0; |
| 2246 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 2247 | HDA_AMP_MUTE, bits); |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2248 | } |
| 2249 | |
| 2250 | static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2251 | { |
| 2252 | /* Looks like the unsol event is incompatible with the standard |
| 2253 | * definition. 4bit tag is placed at 28 bit! |
| 2254 | */ |
| 2255 | if ((res >> 28) == 0x01) |
| 2256 | alc880_lg_lw_automute(codec); |
| 2257 | } |
| 2258 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2259 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2260 | static struct hda_amp_list alc880_loopbacks[] = { |
| 2261 | { 0x0b, HDA_INPUT, 0 }, |
| 2262 | { 0x0b, HDA_INPUT, 1 }, |
| 2263 | { 0x0b, HDA_INPUT, 2 }, |
| 2264 | { 0x0b, HDA_INPUT, 3 }, |
| 2265 | { 0x0b, HDA_INPUT, 4 }, |
| 2266 | { } /* end */ |
| 2267 | }; |
| 2268 | |
| 2269 | static struct hda_amp_list alc880_lg_loopbacks[] = { |
| 2270 | { 0x0b, HDA_INPUT, 1 }, |
| 2271 | { 0x0b, HDA_INPUT, 6 }, |
| 2272 | { 0x0b, HDA_INPUT, 7 }, |
| 2273 | { } /* end */ |
| 2274 | }; |
| 2275 | #endif |
| 2276 | |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 2277 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2278 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2279 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2280 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2281 | static int alc_init(struct hda_codec *codec) |
| 2282 | { |
| 2283 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2284 | unsigned int i; |
| 2285 | |
| 2286 | for (i = 0; i < spec->num_init_verbs; i++) |
| 2287 | snd_hda_sequence_write(codec, spec->init_verbs[i]); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2288 | |
| 2289 | if (spec->init_hook) |
| 2290 | spec->init_hook(codec); |
| 2291 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2292 | return 0; |
| 2293 | } |
| 2294 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2295 | static void alc_unsol_event(struct hda_codec *codec, unsigned int res) |
| 2296 | { |
| 2297 | struct alc_spec *spec = codec->spec; |
| 2298 | |
| 2299 | if (spec->unsol_event) |
| 2300 | spec->unsol_event(codec, res); |
| 2301 | } |
| 2302 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2303 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2304 | static int alc_check_power_status(struct hda_codec *codec, hda_nid_t nid) |
| 2305 | { |
| 2306 | struct alc_spec *spec = codec->spec; |
| 2307 | return snd_hda_check_amp_list_power(codec, &spec->loopback, nid); |
| 2308 | } |
| 2309 | #endif |
| 2310 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2311 | /* |
| 2312 | * Analog playback callbacks |
| 2313 | */ |
| 2314 | static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2315 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2316 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2317 | { |
| 2318 | struct alc_spec *spec = codec->spec; |
| 2319 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); |
| 2320 | } |
| 2321 | |
| 2322 | static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2323 | struct hda_codec *codec, |
| 2324 | unsigned int stream_tag, |
| 2325 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2326 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2327 | { |
| 2328 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2329 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2330 | stream_tag, format, substream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2331 | } |
| 2332 | |
| 2333 | static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2334 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2335 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2336 | { |
| 2337 | struct alc_spec *spec = codec->spec; |
| 2338 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2339 | } |
| 2340 | |
| 2341 | /* |
| 2342 | * Digital out |
| 2343 | */ |
| 2344 | static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2345 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2346 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2347 | { |
| 2348 | struct alc_spec *spec = codec->spec; |
| 2349 | return snd_hda_multi_out_dig_open(codec, &spec->multiout); |
| 2350 | } |
| 2351 | |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2352 | static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2353 | struct hda_codec *codec, |
| 2354 | unsigned int stream_tag, |
| 2355 | unsigned int format, |
| 2356 | struct snd_pcm_substream *substream) |
| 2357 | { |
| 2358 | struct alc_spec *spec = codec->spec; |
| 2359 | return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, |
| 2360 | stream_tag, format, substream); |
| 2361 | } |
| 2362 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2363 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
| 2364 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2365 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2366 | { |
| 2367 | struct alc_spec *spec = codec->spec; |
| 2368 | return snd_hda_multi_out_dig_close(codec, &spec->multiout); |
| 2369 | } |
| 2370 | |
| 2371 | /* |
| 2372 | * Analog capture |
| 2373 | */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2374 | static int alc880_alt_capture_pcm_prepare(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2375 | struct hda_codec *codec, |
| 2376 | unsigned int stream_tag, |
| 2377 | unsigned int format, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2378 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2379 | { |
| 2380 | struct alc_spec *spec = codec->spec; |
| 2381 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2382 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2383 | stream_tag, 0, format); |
| 2384 | return 0; |
| 2385 | } |
| 2386 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2387 | static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2388 | struct hda_codec *codec, |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2389 | struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2390 | { |
| 2391 | struct alc_spec *spec = codec->spec; |
| 2392 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2393 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2394 | 0, 0, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2395 | return 0; |
| 2396 | } |
| 2397 | |
| 2398 | |
| 2399 | /* |
| 2400 | */ |
| 2401 | static struct hda_pcm_stream alc880_pcm_analog_playback = { |
| 2402 | .substreams = 1, |
| 2403 | .channels_min = 2, |
| 2404 | .channels_max = 8, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2405 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2406 | .ops = { |
| 2407 | .open = alc880_playback_pcm_open, |
| 2408 | .prepare = alc880_playback_pcm_prepare, |
| 2409 | .cleanup = alc880_playback_pcm_cleanup |
| 2410 | }, |
| 2411 | }; |
| 2412 | |
| 2413 | static struct hda_pcm_stream alc880_pcm_analog_capture = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2414 | .substreams = 1, |
| 2415 | .channels_min = 2, |
| 2416 | .channels_max = 2, |
| 2417 | /* NID is set in alc_build_pcms */ |
| 2418 | }; |
| 2419 | |
| 2420 | static struct hda_pcm_stream alc880_pcm_analog_alt_playback = { |
| 2421 | .substreams = 1, |
| 2422 | .channels_min = 2, |
| 2423 | .channels_max = 2, |
| 2424 | /* NID is set in alc_build_pcms */ |
| 2425 | }; |
| 2426 | |
| 2427 | static struct hda_pcm_stream alc880_pcm_analog_alt_capture = { |
| 2428 | .substreams = 2, /* can be overridden */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2429 | .channels_min = 2, |
| 2430 | .channels_max = 2, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2431 | /* NID is set in alc_build_pcms */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2432 | .ops = { |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2433 | .prepare = alc880_alt_capture_pcm_prepare, |
| 2434 | .cleanup = alc880_alt_capture_pcm_cleanup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2435 | }, |
| 2436 | }; |
| 2437 | |
| 2438 | static struct hda_pcm_stream alc880_pcm_digital_playback = { |
| 2439 | .substreams = 1, |
| 2440 | .channels_min = 2, |
| 2441 | .channels_max = 2, |
| 2442 | /* NID is set in alc_build_pcms */ |
| 2443 | .ops = { |
| 2444 | .open = alc880_dig_playback_pcm_open, |
Takashi Iwai | 6b97eb4 | 2007-04-05 14:51:48 +0200 | [diff] [blame] | 2445 | .close = alc880_dig_playback_pcm_close, |
| 2446 | .prepare = alc880_dig_playback_pcm_prepare |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2447 | }, |
| 2448 | }; |
| 2449 | |
| 2450 | static struct hda_pcm_stream alc880_pcm_digital_capture = { |
| 2451 | .substreams = 1, |
| 2452 | .channels_min = 2, |
| 2453 | .channels_max = 2, |
| 2454 | /* NID is set in alc_build_pcms */ |
| 2455 | }; |
| 2456 | |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2457 | /* 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] | 2458 | static struct hda_pcm_stream alc_pcm_null_stream = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 2459 | .substreams = 0, |
| 2460 | .channels_min = 0, |
| 2461 | .channels_max = 0, |
| 2462 | }; |
| 2463 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2464 | static int alc_build_pcms(struct hda_codec *codec) |
| 2465 | { |
| 2466 | struct alc_spec *spec = codec->spec; |
| 2467 | struct hda_pcm *info = spec->pcm_rec; |
| 2468 | int i; |
| 2469 | |
| 2470 | codec->num_pcms = 1; |
| 2471 | codec->pcm_info = info; |
| 2472 | |
| 2473 | info->name = spec->stream_name_analog; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2474 | if (spec->stream_analog_playback) { |
| 2475 | snd_assert(spec->multiout.dac_nids, return -EINVAL); |
| 2476 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
| 2477 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
| 2478 | } |
| 2479 | if (spec->stream_analog_capture) { |
| 2480 | snd_assert(spec->adc_nids, return -EINVAL); |
| 2481 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
| 2482 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
| 2483 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2484 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2485 | if (spec->channel_mode) { |
| 2486 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; |
| 2487 | for (i = 0; i < spec->num_channel_mode; i++) { |
| 2488 | if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { |
| 2489 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; |
| 2490 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2491 | } |
| 2492 | } |
| 2493 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2494 | /* SPDIF for stream index #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2495 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2496 | codec->num_pcms = 2; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2497 | info = spec->pcm_rec + 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2498 | info->name = spec->stream_name_digital; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2499 | if (spec->multiout.dig_out_nid && |
| 2500 | spec->stream_digital_playback) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2501 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
| 2502 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
| 2503 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 2504 | if (spec->dig_in_nid && |
| 2505 | spec->stream_digital_capture) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2506 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
| 2507 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
| 2508 | } |
| 2509 | } |
| 2510 | |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2511 | /* If the use of more than one ADC is requested for the current |
| 2512 | * model, configure a second analog capture-only PCM. |
| 2513 | */ |
| 2514 | /* Additional Analaog capture for index #2 */ |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2515 | if ((spec->alt_dac_nid && spec->stream_analog_alt_playback) || |
| 2516 | (spec->num_adc_nids > 1 && spec->stream_analog_alt_capture)) { |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2517 | codec->num_pcms = 3; |
Takashi Iwai | c06134d | 2006-10-11 18:49:13 +0200 | [diff] [blame] | 2518 | info = spec->pcm_rec + 2; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2519 | info->name = spec->stream_name_analog; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 2520 | if (spec->alt_dac_nid) { |
| 2521 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2522 | *spec->stream_analog_alt_playback; |
| 2523 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = |
| 2524 | spec->alt_dac_nid; |
| 2525 | } else { |
| 2526 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = |
| 2527 | alc_pcm_null_stream; |
| 2528 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; |
| 2529 | } |
| 2530 | if (spec->num_adc_nids > 1) { |
| 2531 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2532 | *spec->stream_analog_alt_capture; |
| 2533 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = |
| 2534 | spec->adc_nids[1]; |
| 2535 | info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = |
| 2536 | spec->num_adc_nids - 1; |
| 2537 | } else { |
| 2538 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = |
| 2539 | alc_pcm_null_stream; |
| 2540 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 0; |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 2541 | } |
| 2542 | } |
| 2543 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2544 | return 0; |
| 2545 | } |
| 2546 | |
| 2547 | static void alc_free(struct hda_codec *codec) |
| 2548 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2549 | struct alc_spec *spec = codec->spec; |
| 2550 | unsigned int i; |
| 2551 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2552 | if (!spec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2553 | return; |
| 2554 | |
| 2555 | if (spec->kctl_alloc) { |
| 2556 | for (i = 0; i < spec->num_kctl_used; i++) |
| 2557 | kfree(spec->kctl_alloc[i].name); |
| 2558 | kfree(spec->kctl_alloc); |
| 2559 | } |
| 2560 | kfree(spec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2561 | } |
| 2562 | |
| 2563 | /* |
| 2564 | */ |
| 2565 | static struct hda_codec_ops alc_patch_ops = { |
| 2566 | .build_controls = alc_build_controls, |
| 2567 | .build_pcms = alc_build_pcms, |
| 2568 | .init = alc_init, |
| 2569 | .free = alc_free, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2570 | .unsol_event = alc_unsol_event, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 2571 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 2572 | .check_power_status = alc_check_power_status, |
| 2573 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2574 | }; |
| 2575 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2576 | |
| 2577 | /* |
| 2578 | * Test configuration for debugging |
| 2579 | * |
| 2580 | * Almost all inputs/outputs are enabled. I/O pins can be configured via |
| 2581 | * enum controls. |
| 2582 | */ |
| 2583 | #ifdef CONFIG_SND_DEBUG |
| 2584 | static hda_nid_t alc880_test_dac_nids[4] = { |
| 2585 | 0x02, 0x03, 0x04, 0x05 |
| 2586 | }; |
| 2587 | |
| 2588 | static struct hda_input_mux alc880_test_capture_source = { |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2589 | .num_items = 7, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2590 | .items = { |
| 2591 | { "In-1", 0x0 }, |
| 2592 | { "In-2", 0x1 }, |
| 2593 | { "In-3", 0x2 }, |
| 2594 | { "In-4", 0x3 }, |
| 2595 | { "CD", 0x4 }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 2596 | { "Front", 0x5 }, |
| 2597 | { "Surround", 0x6 }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2598 | }, |
| 2599 | }; |
| 2600 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 2601 | static struct hda_channel_mode alc880_test_modes[4] = { |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2602 | { 2, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2603 | { 4, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2604 | { 6, NULL }, |
Takashi Iwai | fd2c326 | 2005-05-13 17:18:42 +0200 | [diff] [blame] | 2605 | { 8, NULL }, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2606 | }; |
| 2607 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2608 | static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, |
| 2609 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2610 | { |
| 2611 | static char *texts[] = { |
| 2612 | "N/A", "Line Out", "HP Out", |
| 2613 | "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" |
| 2614 | }; |
| 2615 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2616 | uinfo->count = 1; |
| 2617 | uinfo->value.enumerated.items = 8; |
| 2618 | if (uinfo->value.enumerated.item >= 8) |
| 2619 | uinfo->value.enumerated.item = 7; |
| 2620 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2621 | return 0; |
| 2622 | } |
| 2623 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2624 | static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, |
| 2625 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2626 | { |
| 2627 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2628 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2629 | unsigned int pin_ctl, item = 0; |
| 2630 | |
| 2631 | pin_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2632 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2633 | if (pin_ctl & AC_PINCTL_OUT_EN) { |
| 2634 | if (pin_ctl & AC_PINCTL_HP_EN) |
| 2635 | item = 2; |
| 2636 | else |
| 2637 | item = 1; |
| 2638 | } else if (pin_ctl & AC_PINCTL_IN_EN) { |
| 2639 | switch (pin_ctl & AC_PINCTL_VREFEN) { |
| 2640 | case AC_PINCTL_VREF_HIZ: item = 3; break; |
| 2641 | case AC_PINCTL_VREF_50: item = 4; break; |
| 2642 | case AC_PINCTL_VREF_GRD: item = 5; break; |
| 2643 | case AC_PINCTL_VREF_80: item = 6; break; |
| 2644 | case AC_PINCTL_VREF_100: item = 7; break; |
| 2645 | } |
| 2646 | } |
| 2647 | ucontrol->value.enumerated.item[0] = item; |
| 2648 | return 0; |
| 2649 | } |
| 2650 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2651 | static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, |
| 2652 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2653 | { |
| 2654 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2655 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2656 | static unsigned int ctls[] = { |
| 2657 | 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, |
| 2658 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, |
| 2659 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, |
| 2660 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, |
| 2661 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, |
| 2662 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, |
| 2663 | }; |
| 2664 | unsigned int old_ctl, new_ctl; |
| 2665 | |
| 2666 | old_ctl = snd_hda_codec_read(codec, nid, 0, |
| 2667 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 2668 | new_ctl = ctls[ucontrol->value.enumerated.item[0]]; |
| 2669 | if (old_ctl != new_ctl) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2670 | int val; |
| 2671 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2672 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 2673 | new_ctl); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 2674 | val = ucontrol->value.enumerated.item[0] >= 3 ? |
| 2675 | HDA_AMP_MUTE : 0; |
| 2676 | snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, |
| 2677 | HDA_AMP_MUTE, val); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2678 | return 1; |
| 2679 | } |
| 2680 | return 0; |
| 2681 | } |
| 2682 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2683 | static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, |
| 2684 | struct snd_ctl_elem_info *uinfo) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2685 | { |
| 2686 | static char *texts[] = { |
| 2687 | "Front", "Surround", "CLFE", "Side" |
| 2688 | }; |
| 2689 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
| 2690 | uinfo->count = 1; |
| 2691 | uinfo->value.enumerated.items = 4; |
| 2692 | if (uinfo->value.enumerated.item >= 4) |
| 2693 | uinfo->value.enumerated.item = 3; |
| 2694 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
| 2695 | return 0; |
| 2696 | } |
| 2697 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2698 | static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, |
| 2699 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2700 | { |
| 2701 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2702 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2703 | unsigned int sel; |
| 2704 | |
| 2705 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); |
| 2706 | ucontrol->value.enumerated.item[0] = sel & 3; |
| 2707 | return 0; |
| 2708 | } |
| 2709 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 2710 | static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, |
| 2711 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2712 | { |
| 2713 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 2714 | hda_nid_t nid = (hda_nid_t)kcontrol->private_value; |
| 2715 | unsigned int sel; |
| 2716 | |
| 2717 | sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; |
| 2718 | if (ucontrol->value.enumerated.item[0] != sel) { |
| 2719 | sel = ucontrol->value.enumerated.item[0] & 3; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 2720 | snd_hda_codec_write_cache(codec, nid, 0, |
| 2721 | AC_VERB_SET_CONNECT_SEL, sel); |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2722 | return 1; |
| 2723 | } |
| 2724 | return 0; |
| 2725 | } |
| 2726 | |
| 2727 | #define PIN_CTL_TEST(xname,nid) { \ |
| 2728 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2729 | .name = xname, \ |
| 2730 | .info = alc_test_pin_ctl_info, \ |
| 2731 | .get = alc_test_pin_ctl_get, \ |
| 2732 | .put = alc_test_pin_ctl_put, \ |
| 2733 | .private_value = nid \ |
| 2734 | } |
| 2735 | |
| 2736 | #define PIN_SRC_TEST(xname,nid) { \ |
| 2737 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
| 2738 | .name = xname, \ |
| 2739 | .info = alc_test_pin_src_info, \ |
| 2740 | .get = alc_test_pin_src_get, \ |
| 2741 | .put = alc_test_pin_src_put, \ |
| 2742 | .private_value = nid \ |
| 2743 | } |
| 2744 | |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 2745 | static struct snd_kcontrol_new alc880_test_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2746 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 2747 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 2748 | HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 2749 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 2750 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 2751 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 2752 | HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), |
| 2753 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2754 | PIN_CTL_TEST("Front Pin Mode", 0x14), |
| 2755 | PIN_CTL_TEST("Surround Pin Mode", 0x15), |
| 2756 | PIN_CTL_TEST("CLFE Pin Mode", 0x16), |
| 2757 | PIN_CTL_TEST("Side Pin Mode", 0x17), |
| 2758 | PIN_CTL_TEST("In-1 Pin Mode", 0x18), |
| 2759 | PIN_CTL_TEST("In-2 Pin Mode", 0x19), |
| 2760 | PIN_CTL_TEST("In-3 Pin Mode", 0x1a), |
| 2761 | PIN_CTL_TEST("In-4 Pin Mode", 0x1b), |
| 2762 | PIN_SRC_TEST("In-1 Pin Source", 0x18), |
| 2763 | PIN_SRC_TEST("In-2 Pin Source", 0x19), |
| 2764 | PIN_SRC_TEST("In-3 Pin Source", 0x1a), |
| 2765 | PIN_SRC_TEST("In-4 Pin Source", 0x1b), |
| 2766 | HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 2767 | HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 2768 | HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 2769 | HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 2770 | HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), |
| 2771 | HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), |
| 2772 | HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), |
| 2773 | HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), |
| 2774 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), |
| 2775 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2776 | { |
| 2777 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 2778 | .name = "Channel Mode", |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2779 | .info = alc_ch_mode_info, |
| 2780 | .get = alc_ch_mode_get, |
| 2781 | .put = alc_ch_mode_put, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2782 | }, |
| 2783 | { } /* end */ |
| 2784 | }; |
| 2785 | |
| 2786 | static struct hda_verb alc880_test_init_verbs[] = { |
| 2787 | /* Unmute inputs of 0x0c - 0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2788 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2789 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2790 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2791 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2792 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2793 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 2794 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2795 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2796 | /* Vol output for 0x0c-0x0f */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2797 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2798 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2799 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 2800 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2801 | /* Set output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2802 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2803 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2804 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 2805 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2806 | /* Unmute output pins 0x14-0x17 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2807 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2809 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 2810 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2811 | /* Set input pins 0x18-0x1c */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2812 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 2813 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2814 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2815 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 2816 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2817 | /* Mute input pins 0x18-0x1b */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2818 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2820 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 2821 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2822 | /* ADC set up */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2823 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2824 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2825 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2826 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2827 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 2828 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 2829 | /* Analog input/passthru */ |
| 2830 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 2831 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2832 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 2833 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 2834 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2835 | { } |
| 2836 | }; |
| 2837 | #endif |
| 2838 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2839 | /* |
| 2840 | */ |
| 2841 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2842 | static const char *alc880_models[ALC880_MODEL_LAST] = { |
| 2843 | [ALC880_3ST] = "3stack", |
| 2844 | [ALC880_TCL_S700] = "tcl", |
| 2845 | [ALC880_3ST_DIG] = "3stack-digout", |
| 2846 | [ALC880_CLEVO] = "clevo", |
| 2847 | [ALC880_5ST] = "5stack", |
| 2848 | [ALC880_5ST_DIG] = "5stack-digout", |
| 2849 | [ALC880_W810] = "w810", |
| 2850 | [ALC880_Z71V] = "z71v", |
| 2851 | [ALC880_6ST] = "6stack", |
| 2852 | [ALC880_6ST_DIG] = "6stack-digout", |
| 2853 | [ALC880_ASUS] = "asus", |
| 2854 | [ALC880_ASUS_W1V] = "asus-w1v", |
| 2855 | [ALC880_ASUS_DIG] = "asus-dig", |
| 2856 | [ALC880_ASUS_DIG2] = "asus-dig2", |
| 2857 | [ALC880_UNIWILL_DIG] = "uniwill", |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2858 | [ALC880_UNIWILL_P53] = "uniwill-p53", |
| 2859 | [ALC880_FUJITSU] = "fujitsu", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2860 | [ALC880_F1734] = "F1734", |
| 2861 | [ALC880_LG] = "lg", |
| 2862 | [ALC880_LG_LW] = "lg-lw", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2863 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2864 | [ALC880_TEST] = "test", |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 2865 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2866 | [ALC880_AUTO] = "auto", |
| 2867 | }; |
| 2868 | |
| 2869 | static struct snd_pci_quirk alc880_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2870 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2871 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), |
| 2872 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), |
| 2873 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), |
| 2874 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), |
| 2875 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), |
| 2876 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), |
| 2877 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), |
| 2878 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2879 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), |
| 2880 | SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2881 | SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), |
| 2882 | SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), |
| 2883 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), |
| 2884 | SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), |
| 2885 | SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), |
| 2886 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), |
| 2887 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), |
| 2888 | /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ |
| 2889 | SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), |
| 2890 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), |
Tobin Davis | 0e4ceb7 | 2007-01-08 10:54:26 +0100 | [diff] [blame] | 2891 | SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2892 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
| 2893 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
| 2894 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2895 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2896 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2897 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
| 2898 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2899 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), |
| 2900 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2901 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), |
| 2902 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), |
| 2903 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), |
| 2904 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2905 | SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), |
| 2906 | SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2907 | SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2908 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2909 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2910 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2911 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), |
| 2912 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2913 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), |
| 2914 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2915 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2916 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2917 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 2918 | SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2919 | SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2920 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), |
| 2921 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2922 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2923 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), |
| 2924 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ |
| 2925 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), |
| 2926 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2927 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), |
| 2928 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2929 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2930 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2931 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), |
| 2932 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 2933 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
| 2934 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
| 2935 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 2936 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ |
| 2937 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
| 2938 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2939 | {} |
| 2940 | }; |
| 2941 | |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2942 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2943 | * ALC880 codec presets |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2944 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2945 | static struct alc_config_preset alc880_presets[] = { |
| 2946 | [ALC880_3ST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2947 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2948 | .init_verbs = { alc880_volume_init_verbs, |
| 2949 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2950 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2951 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2952 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2953 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2954 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2955 | .input_mux = &alc880_capture_source, |
| 2956 | }, |
| 2957 | [ALC880_3ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 2958 | .mixers = { alc880_three_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2959 | .init_verbs = { alc880_volume_init_verbs, |
| 2960 | alc880_pin_3stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2961 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2962 | .dac_nids = alc880_dac_nids, |
| 2963 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2964 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 2965 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 2966 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2967 | .input_mux = &alc880_capture_source, |
| 2968 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 2969 | [ALC880_TCL_S700] = { |
| 2970 | .mixers = { alc880_tcl_s700_mixer }, |
| 2971 | .init_verbs = { alc880_volume_init_verbs, |
| 2972 | alc880_pin_tcl_S700_init_verbs, |
| 2973 | alc880_gpio2_init_verbs }, |
| 2974 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2975 | .dac_nids = alc880_dac_nids, |
| 2976 | .hp_nid = 0x03, |
| 2977 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 2978 | .channel_mode = alc880_2_jack_modes, |
| 2979 | .input_mux = &alc880_capture_source, |
| 2980 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2981 | [ALC880_5ST] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2982 | .mixers = { alc880_three_stack_mixer, |
| 2983 | alc880_five_stack_mixer}, |
| 2984 | .init_verbs = { alc880_volume_init_verbs, |
| 2985 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2986 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2987 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2988 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 2989 | .channel_mode = alc880_fivestack_modes, |
| 2990 | .input_mux = &alc880_capture_source, |
| 2991 | }, |
| 2992 | [ALC880_5ST_DIG] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 2993 | .mixers = { alc880_three_stack_mixer, |
| 2994 | alc880_five_stack_mixer }, |
| 2995 | .init_verbs = { alc880_volume_init_verbs, |
| 2996 | alc880_pin_5stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 2997 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 2998 | .dac_nids = alc880_dac_nids, |
| 2999 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3000 | .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), |
| 3001 | .channel_mode = alc880_fivestack_modes, |
| 3002 | .input_mux = &alc880_capture_source, |
| 3003 | }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3004 | [ALC880_6ST] = { |
| 3005 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3006 | .init_verbs = { alc880_volume_init_verbs, |
| 3007 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | b6482d4 | 2005-06-27 15:32:43 +0200 | [diff] [blame] | 3008 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3009 | .dac_nids = alc880_6st_dac_nids, |
| 3010 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3011 | .channel_mode = alc880_sixstack_modes, |
| 3012 | .input_mux = &alc880_6stack_capture_source, |
| 3013 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3014 | [ALC880_6ST_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3015 | .mixers = { alc880_six_stack_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3016 | .init_verbs = { alc880_volume_init_verbs, |
| 3017 | alc880_pin_6stack_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3018 | .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), |
| 3019 | .dac_nids = alc880_6st_dac_nids, |
| 3020 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3021 | .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), |
| 3022 | .channel_mode = alc880_sixstack_modes, |
| 3023 | .input_mux = &alc880_6stack_capture_source, |
| 3024 | }, |
| 3025 | [ALC880_W810] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3026 | .mixers = { alc880_w810_base_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3027 | .init_verbs = { alc880_volume_init_verbs, |
| 3028 | alc880_pin_w810_init_verbs, |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3029 | alc880_gpio2_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3030 | .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), |
| 3031 | .dac_nids = alc880_w810_dac_nids, |
| 3032 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3033 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
| 3034 | .channel_mode = alc880_w810_modes, |
| 3035 | .input_mux = &alc880_capture_source, |
| 3036 | }, |
| 3037 | [ALC880_Z71V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3038 | .mixers = { alc880_z71v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3039 | .init_verbs = { alc880_volume_init_verbs, |
| 3040 | alc880_pin_z71v_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3041 | .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), |
| 3042 | .dac_nids = alc880_z71v_dac_nids, |
| 3043 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3044 | .hp_nid = 0x03, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3045 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3046 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3047 | .input_mux = &alc880_capture_source, |
| 3048 | }, |
| 3049 | [ALC880_F1734] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3050 | .mixers = { alc880_f1734_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3051 | .init_verbs = { alc880_volume_init_verbs, |
| 3052 | alc880_pin_f1734_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3053 | .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), |
| 3054 | .dac_nids = alc880_f1734_dac_nids, |
| 3055 | .hp_nid = 0x02, |
| 3056 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3057 | .channel_mode = alc880_2_jack_modes, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3058 | .input_mux = &alc880_capture_source, |
| 3059 | }, |
| 3060 | [ALC880_ASUS] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3061 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3062 | .init_verbs = { alc880_volume_init_verbs, |
| 3063 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3064 | alc880_gpio1_init_verbs }, |
| 3065 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3066 | .dac_nids = alc880_asus_dac_nids, |
| 3067 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3068 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3069 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3070 | .input_mux = &alc880_capture_source, |
| 3071 | }, |
| 3072 | [ALC880_ASUS_DIG] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3073 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3074 | .init_verbs = { alc880_volume_init_verbs, |
| 3075 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3076 | alc880_gpio1_init_verbs }, |
| 3077 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3078 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3079 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3080 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3081 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3082 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3083 | .input_mux = &alc880_capture_source, |
| 3084 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3085 | [ALC880_ASUS_DIG2] = { |
| 3086 | .mixers = { alc880_asus_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3087 | .init_verbs = { alc880_volume_init_verbs, |
| 3088 | alc880_pin_asus_init_verbs, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3089 | alc880_gpio2_init_verbs }, /* use GPIO2 */ |
| 3090 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3091 | .dac_nids = alc880_asus_dac_nids, |
| 3092 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3093 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3094 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3095 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3096 | .input_mux = &alc880_capture_source, |
| 3097 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3098 | [ALC880_ASUS_W1V] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3099 | .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3100 | .init_verbs = { alc880_volume_init_verbs, |
| 3101 | alc880_pin_asus_init_verbs, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3102 | alc880_gpio1_init_verbs }, |
| 3103 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3104 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3105 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3106 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3107 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3108 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3109 | .input_mux = &alc880_capture_source, |
| 3110 | }, |
| 3111 | [ALC880_UNIWILL_DIG] = { |
Takashi Iwai | 3c10a9d | 2005-08-23 20:02:27 +0200 | [diff] [blame] | 3112 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3113 | .init_verbs = { alc880_volume_init_verbs, |
| 3114 | alc880_pin_asus_init_verbs }, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3115 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3116 | .dac_nids = alc880_asus_dac_nids, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3117 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3118 | .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), |
| 3119 | .channel_mode = alc880_asus_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3120 | .need_dac_fix = 1, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3121 | .input_mux = &alc880_capture_source, |
| 3122 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3123 | [ALC880_UNIWILL] = { |
| 3124 | .mixers = { alc880_uniwill_mixer }, |
| 3125 | .init_verbs = { alc880_volume_init_verbs, |
| 3126 | alc880_uniwill_init_verbs }, |
| 3127 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3128 | .dac_nids = alc880_asus_dac_nids, |
| 3129 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3130 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3131 | .channel_mode = alc880_threestack_modes, |
| 3132 | .need_dac_fix = 1, |
| 3133 | .input_mux = &alc880_capture_source, |
| 3134 | .unsol_event = alc880_uniwill_unsol_event, |
| 3135 | .init_hook = alc880_uniwill_automute, |
| 3136 | }, |
| 3137 | [ALC880_UNIWILL_P53] = { |
| 3138 | .mixers = { alc880_uniwill_p53_mixer }, |
| 3139 | .init_verbs = { alc880_volume_init_verbs, |
| 3140 | alc880_uniwill_p53_init_verbs }, |
| 3141 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
| 3142 | .dac_nids = alc880_asus_dac_nids, |
| 3143 | .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3144 | .channel_mode = alc880_threestack_modes, |
| 3145 | .input_mux = &alc880_capture_source, |
| 3146 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3147 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3148 | }, |
| 3149 | [ALC880_FUJITSU] = { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3150 | .mixers = { alc880_fujitsu_mixer, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3151 | alc880_pcbeep_mixer, }, |
| 3152 | .init_verbs = { alc880_volume_init_verbs, |
| 3153 | alc880_uniwill_p53_init_verbs, |
| 3154 | alc880_beep_init_verbs }, |
| 3155 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3156 | .dac_nids = alc880_dac_nids, |
Takashi Iwai | d53d7d9 | 2007-08-20 15:20:02 +0200 | [diff] [blame] | 3157 | .dig_out_nid = ALC880_DIGOUT_NID, |
Tobin Davis | 2cf9f0f | 2007-02-07 16:04:25 +0100 | [diff] [blame] | 3158 | .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), |
| 3159 | .channel_mode = alc880_2_jack_modes, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 3160 | .input_mux = &alc880_capture_source, |
| 3161 | .unsol_event = alc880_uniwill_p53_unsol_event, |
| 3162 | .init_hook = alc880_uniwill_p53_hp_automute, |
| 3163 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3164 | [ALC880_CLEVO] = { |
| 3165 | .mixers = { alc880_three_stack_mixer }, |
| 3166 | .init_verbs = { alc880_volume_init_verbs, |
| 3167 | alc880_pin_clevo_init_verbs }, |
| 3168 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
| 3169 | .dac_nids = alc880_dac_nids, |
| 3170 | .hp_nid = 0x03, |
| 3171 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 3172 | .channel_mode = alc880_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3173 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3174 | .input_mux = &alc880_capture_source, |
| 3175 | }, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3176 | [ALC880_LG] = { |
| 3177 | .mixers = { alc880_lg_mixer }, |
| 3178 | .init_verbs = { alc880_volume_init_verbs, |
| 3179 | alc880_lg_init_verbs }, |
| 3180 | .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), |
| 3181 | .dac_nids = alc880_lg_dac_nids, |
| 3182 | .dig_out_nid = ALC880_DIGOUT_NID, |
| 3183 | .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), |
| 3184 | .channel_mode = alc880_lg_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 3185 | .need_dac_fix = 1, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3186 | .input_mux = &alc880_lg_capture_source, |
| 3187 | .unsol_event = alc880_lg_unsol_event, |
| 3188 | .init_hook = alc880_lg_automute, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3189 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3190 | .loopbacks = alc880_lg_loopbacks, |
| 3191 | #endif |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3192 | }, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3193 | [ALC880_LG_LW] = { |
| 3194 | .mixers = { alc880_lg_lw_mixer }, |
| 3195 | .init_verbs = { alc880_volume_init_verbs, |
| 3196 | alc880_lg_lw_init_verbs }, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3197 | .num_dacs = ARRAY_SIZE(alc880_dac_nids), |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3198 | .dac_nids = alc880_dac_nids, |
| 3199 | .dig_out_nid = ALC880_DIGOUT_NID, |
Claudio Matsuoka | 0a8c5da | 2007-07-04 15:17:38 +0200 | [diff] [blame] | 3200 | .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes), |
| 3201 | .channel_mode = alc880_lg_lw_modes, |
Takashi Iwai | d681518 | 2006-03-23 16:06:23 +0100 | [diff] [blame] | 3202 | .input_mux = &alc880_lg_lw_capture_source, |
| 3203 | .unsol_event = alc880_lg_lw_unsol_event, |
| 3204 | .init_hook = alc880_lg_lw_automute, |
| 3205 | }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3206 | #ifdef CONFIG_SND_DEBUG |
| 3207 | [ALC880_TEST] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3208 | .mixers = { alc880_test_mixer }, |
| 3209 | .init_verbs = { alc880_test_init_verbs }, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3210 | .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), |
| 3211 | .dac_nids = alc880_test_dac_nids, |
| 3212 | .dig_out_nid = ALC880_DIGOUT_NID, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3213 | .num_channel_mode = ARRAY_SIZE(alc880_test_modes), |
| 3214 | .channel_mode = alc880_test_modes, |
| 3215 | .input_mux = &alc880_test_capture_source, |
| 3216 | }, |
| 3217 | #endif |
| 3218 | }; |
| 3219 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3220 | /* |
| 3221 | * Automatic parse of I/O pins from the BIOS configuration |
| 3222 | */ |
| 3223 | |
| 3224 | #define NUM_CONTROL_ALLOC 32 |
| 3225 | #define NUM_VERB_ALLOC 32 |
| 3226 | |
| 3227 | enum { |
| 3228 | ALC_CTL_WIDGET_VOL, |
| 3229 | ALC_CTL_WIDGET_MUTE, |
| 3230 | ALC_CTL_BIND_MUTE, |
| 3231 | }; |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3232 | static struct snd_kcontrol_new alc880_control_templates[] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3233 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
| 3234 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3235 | HDA_BIND_MUTE(NULL, 0, 0, 0), |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3236 | }; |
| 3237 | |
| 3238 | /* add dynamic controls */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3239 | static int add_control(struct alc_spec *spec, int type, const char *name, |
| 3240 | unsigned long val) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3241 | { |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3242 | struct snd_kcontrol_new *knew; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3243 | |
| 3244 | if (spec->num_kctl_used >= spec->num_kctl_alloc) { |
| 3245 | int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; |
| 3246 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3247 | /* array + terminator */ |
| 3248 | knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); |
| 3249 | if (!knew) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3250 | return -ENOMEM; |
| 3251 | if (spec->kctl_alloc) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3252 | memcpy(knew, spec->kctl_alloc, |
| 3253 | sizeof(*knew) * spec->num_kctl_alloc); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3254 | kfree(spec->kctl_alloc); |
| 3255 | } |
| 3256 | spec->kctl_alloc = knew; |
| 3257 | spec->num_kctl_alloc = num; |
| 3258 | } |
| 3259 | |
| 3260 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
| 3261 | *knew = alc880_control_templates[type]; |
Paulo Marques | 543537b | 2005-06-23 00:09:02 -0700 | [diff] [blame] | 3262 | knew->name = kstrdup(name, GFP_KERNEL); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3263 | if (!knew->name) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3264 | return -ENOMEM; |
| 3265 | knew->private_value = val; |
| 3266 | spec->num_kctl_used++; |
| 3267 | return 0; |
| 3268 | } |
| 3269 | |
| 3270 | #define alc880_is_fixed_pin(nid) ((nid) >= 0x14 && (nid) <= 0x17) |
| 3271 | #define alc880_fixed_pin_idx(nid) ((nid) - 0x14) |
| 3272 | #define alc880_is_multi_pin(nid) ((nid) >= 0x18) |
| 3273 | #define alc880_multi_pin_idx(nid) ((nid) - 0x18) |
| 3274 | #define alc880_is_input_pin(nid) ((nid) >= 0x18) |
| 3275 | #define alc880_input_pin_idx(nid) ((nid) - 0x18) |
| 3276 | #define alc880_idx_to_dac(nid) ((nid) + 0x02) |
| 3277 | #define alc880_dac_to_idx(nid) ((nid) - 0x02) |
| 3278 | #define alc880_idx_to_mixer(nid) ((nid) + 0x0c) |
| 3279 | #define alc880_idx_to_selector(nid) ((nid) + 0x10) |
| 3280 | #define ALC880_PIN_CD_NID 0x1c |
| 3281 | |
| 3282 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3283 | static int alc880_auto_fill_dac_nids(struct alc_spec *spec, |
| 3284 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3285 | { |
| 3286 | hda_nid_t nid; |
| 3287 | int assigned[4]; |
| 3288 | int i, j; |
| 3289 | |
| 3290 | memset(assigned, 0, sizeof(assigned)); |
Takashi Iwai | b0af0de | 2005-06-21 14:49:19 +0200 | [diff] [blame] | 3291 | spec->multiout.dac_nids = spec->private_dac_nids; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3292 | |
| 3293 | /* check the pins hardwired to audio widget */ |
| 3294 | for (i = 0; i < cfg->line_outs; i++) { |
| 3295 | nid = cfg->line_out_pins[i]; |
| 3296 | if (alc880_is_fixed_pin(nid)) { |
| 3297 | int idx = alc880_fixed_pin_idx(nid); |
Libin Yang | 5014f19 | 2005-11-23 15:48:36 +0100 | [diff] [blame] | 3298 | spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3299 | assigned[idx] = 1; |
| 3300 | } |
| 3301 | } |
| 3302 | /* left pins can be connect to any audio widget */ |
| 3303 | for (i = 0; i < cfg->line_outs; i++) { |
| 3304 | nid = cfg->line_out_pins[i]; |
| 3305 | if (alc880_is_fixed_pin(nid)) |
| 3306 | continue; |
| 3307 | /* search for an empty channel */ |
| 3308 | for (j = 0; j < cfg->line_outs; j++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3309 | if (!assigned[j]) { |
| 3310 | spec->multiout.dac_nids[i] = |
| 3311 | alc880_idx_to_dac(j); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3312 | assigned[j] = 1; |
| 3313 | break; |
| 3314 | } |
| 3315 | } |
| 3316 | } |
| 3317 | spec->multiout.num_dacs = cfg->line_outs; |
| 3318 | return 0; |
| 3319 | } |
| 3320 | |
| 3321 | /* add playback controls from the parsed DAC table */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3322 | static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 3323 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3324 | { |
| 3325 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3326 | static const char *chname[4] = { |
| 3327 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 3328 | }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3329 | hda_nid_t nid; |
| 3330 | int i, err; |
| 3331 | |
| 3332 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3333 | if (!spec->multiout.dac_nids[i]) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3334 | continue; |
| 3335 | nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); |
| 3336 | if (i == 2) { |
| 3337 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3338 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3339 | "Center Playback Volume", |
| 3340 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 3341 | HDA_OUTPUT)); |
| 3342 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3343 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3344 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 3345 | "LFE Playback Volume", |
| 3346 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 3347 | HDA_OUTPUT)); |
| 3348 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3349 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3350 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3351 | "Center Playback Switch", |
| 3352 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 3353 | HDA_INPUT)); |
| 3354 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3355 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3356 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 3357 | "LFE Playback Switch", |
| 3358 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 3359 | HDA_INPUT)); |
| 3360 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3361 | return err; |
| 3362 | } else { |
| 3363 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3364 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3365 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 3366 | HDA_OUTPUT)); |
| 3367 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3368 | return err; |
| 3369 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3370 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3371 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 3372 | HDA_INPUT)); |
| 3373 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3374 | return err; |
| 3375 | } |
| 3376 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3377 | return 0; |
| 3378 | } |
| 3379 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3380 | /* add playback controls for speaker and HP outputs */ |
| 3381 | static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 3382 | const char *pfx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3383 | { |
| 3384 | hda_nid_t nid; |
| 3385 | int err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3386 | char name[32]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3387 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3388 | if (!pin) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3389 | return 0; |
| 3390 | |
| 3391 | if (alc880_is_fixed_pin(pin)) { |
| 3392 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3393 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3394 | if (!spec->multiout.hp_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3395 | spec->multiout.hp_nid = nid; |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3396 | else |
| 3397 | spec->multiout.extra_out_nid[0] = nid; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3398 | /* control HP volume/switch on the output mixer amp */ |
| 3399 | nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3400 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3401 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3402 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 3403 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3404 | return err; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3405 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3406 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 3407 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 3408 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3409 | return err; |
| 3410 | } else if (alc880_is_multi_pin(pin)) { |
| 3411 | /* set manual connection */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3412 | /* we have only a switch on HP-out PIN */ |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3413 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3414 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3415 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 3416 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3417 | return err; |
| 3418 | } |
| 3419 | return 0; |
| 3420 | } |
| 3421 | |
| 3422 | /* create input playback/capture controls for the given pin */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3423 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
| 3424 | const char *ctlname, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3425 | int idx, hda_nid_t mix_nid) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3426 | { |
| 3427 | char name[32]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3428 | int err; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3429 | |
| 3430 | sprintf(name, "%s Playback Volume", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3431 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 3432 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3433 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3434 | return err; |
| 3435 | sprintf(name, "%s Playback Switch", ctlname); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3436 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 3437 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
| 3438 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3439 | return err; |
| 3440 | return 0; |
| 3441 | } |
| 3442 | |
| 3443 | /* create playback/capture controls for input pins */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3444 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 3445 | const struct auto_pin_cfg *cfg) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3446 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3447 | struct hda_input_mux *imux = &spec->private_imux; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3448 | int i, err, idx; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3449 | |
| 3450 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3451 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3452 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 3453 | err = new_analog_input(spec, cfg->input_pins[i], |
| 3454 | auto_pin_cfg_labels[i], |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3455 | idx, 0x0b); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3456 | if (err < 0) |
| 3457 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3458 | imux->items[imux->num_items].label = |
| 3459 | auto_pin_cfg_labels[i]; |
| 3460 | imux->items[imux->num_items].index = |
| 3461 | alc880_input_pin_idx(cfg->input_pins[i]); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3462 | imux->num_items++; |
| 3463 | } |
| 3464 | } |
| 3465 | return 0; |
| 3466 | } |
| 3467 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3468 | static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, |
| 3469 | hda_nid_t nid, int pin_type, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3470 | int dac_idx) |
| 3471 | { |
| 3472 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3473 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3474 | pin_type); |
| 3475 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 3476 | AMP_OUT_UNMUTE); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3477 | /* need the manual connection? */ |
| 3478 | if (alc880_is_multi_pin(nid)) { |
| 3479 | struct alc_spec *spec = codec->spec; |
| 3480 | int idx = alc880_multi_pin_idx(nid); |
| 3481 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 3482 | AC_VERB_SET_CONNECT_SEL, |
| 3483 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 3484 | } |
| 3485 | } |
| 3486 | |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3487 | static int get_pin_type(int line_out_type) |
| 3488 | { |
| 3489 | if (line_out_type == AUTO_PIN_HP_OUT) |
| 3490 | return PIN_HP; |
| 3491 | else |
| 3492 | return PIN_OUT; |
| 3493 | } |
| 3494 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3495 | static void alc880_auto_init_multi_out(struct hda_codec *codec) |
| 3496 | { |
| 3497 | struct alc_spec *spec = codec->spec; |
| 3498 | int i; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3499 | |
| 3500 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3501 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 3502 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 3503 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 3504 | alc880_auto_set_output_and_unmute(codec, nid, pin_type, i); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3505 | } |
| 3506 | } |
| 3507 | |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3508 | static void alc880_auto_init_extra_out(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3509 | { |
| 3510 | struct alc_spec *spec = codec->spec; |
| 3511 | hda_nid_t pin; |
| 3512 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 3513 | pin = spec->autocfg.speaker_pins[0]; |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3514 | if (pin) /* connect to front */ |
| 3515 | alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 3516 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3517 | if (pin) /* connect to front */ |
| 3518 | alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 3519 | } |
| 3520 | |
| 3521 | static void alc880_auto_init_analog_input(struct hda_codec *codec) |
| 3522 | { |
| 3523 | struct alc_spec *spec = codec->spec; |
| 3524 | int i; |
| 3525 | |
| 3526 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 3527 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 3528 | if (alc880_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3529 | snd_hda_codec_write(codec, nid, 0, |
| 3530 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 3531 | i <= AUTO_PIN_FRONT_MIC ? |
| 3532 | PIN_VREF80 : PIN_IN); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3533 | if (nid != ALC880_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3534 | snd_hda_codec_write(codec, nid, 0, |
| 3535 | AC_VERB_SET_AMP_GAIN_MUTE, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3536 | AMP_OUT_MUTE); |
| 3537 | } |
| 3538 | } |
| 3539 | } |
| 3540 | |
| 3541 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3542 | /* return 1 if successful, 0 if the proper config is not found, |
| 3543 | * or a negative error code |
| 3544 | */ |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3545 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 3546 | { |
| 3547 | struct alc_spec *spec = codec->spec; |
| 3548 | int err; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3549 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3550 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3551 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 3552 | alc880_ignore); |
| 3553 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3554 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3555 | if (!spec->autocfg.line_outs) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3556 | return 0; /* can't find valid BIOS pin config */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3557 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3558 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 3559 | if (err < 0) |
| 3560 | return err; |
| 3561 | err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 3562 | if (err < 0) |
| 3563 | return err; |
| 3564 | err = alc880_auto_create_extra_out(spec, |
| 3565 | spec->autocfg.speaker_pins[0], |
| 3566 | "Speaker"); |
| 3567 | if (err < 0) |
| 3568 | return err; |
| 3569 | err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 3570 | "Headphone"); |
| 3571 | if (err < 0) |
| 3572 | return err; |
| 3573 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 3574 | if (err < 0) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3575 | return err; |
| 3576 | |
| 3577 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 3578 | |
| 3579 | if (spec->autocfg.dig_out_pin) |
| 3580 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 3581 | if (spec->autocfg.dig_in_pin) |
| 3582 | spec->dig_in_nid = ALC880_DIGIN_NID; |
| 3583 | |
| 3584 | if (spec->kctl_alloc) |
| 3585 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 3586 | |
| 3587 | spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; |
| 3588 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3589 | spec->num_mux_defs = 1; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3590 | spec->input_mux = &spec->private_imux; |
| 3591 | |
| 3592 | return 1; |
| 3593 | } |
| 3594 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3595 | /* additional initialization for auto-configuration model */ |
| 3596 | static void alc880_auto_init(struct hda_codec *codec) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3597 | { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3598 | alc880_auto_init_multi_out(codec); |
Takashi Iwai | 8d88bc3 | 2005-11-17 11:09:23 +0100 | [diff] [blame] | 3599 | alc880_auto_init_extra_out(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3600 | alc880_auto_init_analog_input(codec); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3601 | } |
| 3602 | |
| 3603 | /* |
| 3604 | * OK, here we have finally the patch for ALC880 |
| 3605 | */ |
| 3606 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3607 | static int patch_alc880(struct hda_codec *codec) |
| 3608 | { |
| 3609 | struct alc_spec *spec; |
| 3610 | int board_config; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3611 | int err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3612 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 3613 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3614 | if (spec == NULL) |
| 3615 | return -ENOMEM; |
| 3616 | |
| 3617 | codec->spec = spec; |
| 3618 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 3619 | board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, |
| 3620 | alc880_models, |
| 3621 | alc880_cfg_tbl); |
| 3622 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3623 | printk(KERN_INFO "hda_codec: Unknown model for ALC880, " |
| 3624 | "trying auto-probe from BIOS...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3625 | board_config = ALC880_AUTO; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3626 | } |
| 3627 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3628 | if (board_config == ALC880_AUTO) { |
| 3629 | /* automatic parse from the BIOS config */ |
| 3630 | err = alc880_parse_auto_config(codec); |
| 3631 | if (err < 0) { |
| 3632 | alc_free(codec); |
| 3633 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3634 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 3635 | printk(KERN_INFO |
| 3636 | "hda_codec: Cannot set up configuration " |
| 3637 | "from BIOS. Using 3-stack mode...\n"); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3638 | board_config = ALC880_3ST; |
| 3639 | } |
| 3640 | } |
| 3641 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3642 | if (board_config != ALC880_AUTO) |
| 3643 | setup_preset(spec, &alc880_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3644 | |
| 3645 | spec->stream_name_analog = "ALC880 Analog"; |
| 3646 | spec->stream_analog_playback = &alc880_pcm_analog_playback; |
| 3647 | spec->stream_analog_capture = &alc880_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 3648 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3649 | |
| 3650 | spec->stream_name_digital = "ALC880 Digital"; |
| 3651 | spec->stream_digital_playback = &alc880_pcm_digital_playback; |
| 3652 | spec->stream_digital_capture = &alc880_pcm_digital_capture; |
| 3653 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3654 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3655 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 54d1740 | 2005-11-21 16:33:22 +0100 | [diff] [blame] | 3656 | unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3657 | /* get type */ |
| 3658 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3659 | if (wcap != AC_WID_AUD_IN) { |
| 3660 | spec->adc_nids = alc880_adc_nids_alt; |
| 3661 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3662 | spec->mixers[spec->num_mixers] = |
| 3663 | alc880_capture_alt_mixer; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3664 | spec->num_mixers++; |
| 3665 | } else { |
| 3666 | spec->adc_nids = alc880_adc_nids; |
| 3667 | spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); |
| 3668 | spec->mixers[spec->num_mixers] = alc880_capture_mixer; |
| 3669 | spec->num_mixers++; |
| 3670 | } |
| 3671 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3672 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3673 | spec->vmaster_nid = 0x0c; |
| 3674 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3675 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3676 | if (board_config == ALC880_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 3677 | spec->init_hook = alc880_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 3678 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 3679 | if (!spec->loopback.amplist) |
| 3680 | spec->loopback.amplist = alc880_loopbacks; |
| 3681 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3682 | |
| 3683 | return 0; |
| 3684 | } |
| 3685 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3686 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3687 | /* |
| 3688 | * ALC260 support |
| 3689 | */ |
| 3690 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3691 | static hda_nid_t alc260_dac_nids[1] = { |
| 3692 | /* front */ |
| 3693 | 0x02, |
| 3694 | }; |
| 3695 | |
| 3696 | static hda_nid_t alc260_adc_nids[1] = { |
| 3697 | /* ADC0 */ |
| 3698 | 0x04, |
| 3699 | }; |
| 3700 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3701 | static hda_nid_t alc260_adc_nids_alt[1] = { |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3702 | /* ADC1 */ |
| 3703 | 0x05, |
| 3704 | }; |
| 3705 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3706 | static hda_nid_t alc260_hp_adc_nids[2] = { |
| 3707 | /* ADC1, 0 */ |
| 3708 | 0x05, 0x04 |
| 3709 | }; |
| 3710 | |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 3711 | /* NIDs used when simultaneous access to both ADCs makes sense. Note that |
| 3712 | * alc260_capture_mixer assumes ADC0 (nid 0x04) is the first ADC. |
| 3713 | */ |
| 3714 | static hda_nid_t alc260_dual_adc_nids[2] = { |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3715 | /* ADC0, ADC1 */ |
| 3716 | 0x04, 0x05 |
| 3717 | }; |
| 3718 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 3719 | #define ALC260_DIGOUT_NID 0x03 |
| 3720 | #define ALC260_DIGIN_NID 0x06 |
| 3721 | |
| 3722 | static struct hda_input_mux alc260_capture_source = { |
| 3723 | .num_items = 4, |
| 3724 | .items = { |
| 3725 | { "Mic", 0x0 }, |
| 3726 | { "Front Mic", 0x1 }, |
| 3727 | { "Line", 0x2 }, |
| 3728 | { "CD", 0x4 }, |
| 3729 | }, |
| 3730 | }; |
| 3731 | |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 3732 | /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3733 | * headphone jack and the internal CD lines since these are the only pins at |
| 3734 | * which audio can appear. For flexibility, also allow the option of |
| 3735 | * recording the mixer output on the second ADC (ADC0 doesn't have a |
| 3736 | * connection to the mixer output). |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3737 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3738 | static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { |
| 3739 | { |
| 3740 | .num_items = 3, |
| 3741 | .items = { |
| 3742 | { "Mic/Line", 0x0 }, |
| 3743 | { "CD", 0x4 }, |
| 3744 | { "Headphone", 0x2 }, |
| 3745 | }, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3746 | }, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3747 | { |
| 3748 | .num_items = 4, |
| 3749 | .items = { |
| 3750 | { "Mic/Line", 0x0 }, |
| 3751 | { "CD", 0x4 }, |
| 3752 | { "Headphone", 0x2 }, |
| 3753 | { "Mixer", 0x5 }, |
| 3754 | }, |
| 3755 | }, |
| 3756 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3757 | }; |
| 3758 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3759 | /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to |
| 3760 | * the Fujitsu S702x, but jacks are marked differently. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3761 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3762 | static struct hda_input_mux alc260_acer_capture_sources[2] = { |
| 3763 | { |
| 3764 | .num_items = 4, |
| 3765 | .items = { |
| 3766 | { "Mic", 0x0 }, |
| 3767 | { "Line", 0x2 }, |
| 3768 | { "CD", 0x4 }, |
| 3769 | { "Headphone", 0x5 }, |
| 3770 | }, |
| 3771 | }, |
| 3772 | { |
| 3773 | .num_items = 5, |
| 3774 | .items = { |
| 3775 | { "Mic", 0x0 }, |
| 3776 | { "Line", 0x2 }, |
| 3777 | { "CD", 0x4 }, |
| 3778 | { "Headphone", 0x6 }, |
| 3779 | { "Mixer", 0x5 }, |
| 3780 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3781 | }, |
| 3782 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3783 | /* |
| 3784 | * This is just place-holder, so there's something for alc_build_pcms to look |
| 3785 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
| 3786 | * element which allows changing the channel mode, so the verb list is |
| 3787 | * never used. |
| 3788 | */ |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 3789 | static struct hda_channel_mode alc260_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3790 | { 2, NULL }, |
| 3791 | }; |
| 3792 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3793 | |
| 3794 | /* Mixer combinations |
| 3795 | * |
| 3796 | * basic: base_output + input + pc_beep + capture |
| 3797 | * HP: base_output + input + capture_alt |
| 3798 | * HP_3013: hp_3013 + input + capture |
| 3799 | * fujitsu: fujitsu + capture |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3800 | * acer: acer + capture |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3801 | */ |
| 3802 | |
| 3803 | static struct snd_kcontrol_new alc260_base_output_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3804 | HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3805 | HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3806 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3807 | HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), |
| 3808 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3809 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 3810 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 3811 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3812 | |
| 3813 | static struct snd_kcontrol_new alc260_input_mixer[] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3814 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3815 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3816 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3817 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3818 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3819 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3820 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 3821 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3822 | { } /* end */ |
| 3823 | }; |
| 3824 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3825 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { |
| 3826 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3827 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3828 | { } /* end */ |
| 3829 | }; |
| 3830 | |
| 3831 | static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { |
| 3832 | HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 3833 | HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), |
| 3834 | HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 3835 | HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 3836 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3837 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 3838 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 3839 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3840 | { } /* end */ |
| 3841 | }; |
| 3842 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3843 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, |
| 3844 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
| 3845 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 3846 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3847 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3848 | HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3849 | ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3850 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3851 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3852 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3853 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 3854 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3855 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3856 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3857 | HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 3858 | HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3859 | { } /* end */ |
| 3860 | }; |
| 3861 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3862 | /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current |
| 3863 | * versions of the ALC260 don't act on requests to enable mic bias from NID |
| 3864 | * 0x0f (used to drive the headphone jack in these laptops). The ALC260 |
| 3865 | * datasheet doesn't mention this restriction. At this stage it's not clear |
| 3866 | * whether this behaviour is intentional or is a hardware bug in chip |
| 3867 | * revisions available in early 2006. Therefore for now allow the |
| 3868 | * "Headphone Jack Mode" control to span all choices, but if it turns out |
| 3869 | * that the lack of mic bias for this NID is intentional we could change the |
| 3870 | * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 3871 | * |
| 3872 | * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 |
| 3873 | * don't appear to make the mic bias available from the "line" jack, even |
| 3874 | * though the NID used for this jack (0x14) can supply it. The theory is |
| 3875 | * that perhaps Acer have included blocking capacitors between the ALC260 |
| 3876 | * and the output jack. If this turns out to be the case for all such |
| 3877 | * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT |
| 3878 | * to ALC_PIN_DIR_INOUT_NOMICBIAS. |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3879 | * |
| 3880 | * The C20x Tablet series have a mono internal speaker which is controlled |
| 3881 | * via the chip's Mono sum widget and pin complex, so include the necessary |
| 3882 | * controls for such models. On models without a "mono speaker" the control |
| 3883 | * won't do anything. |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3884 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3885 | static struct snd_kcontrol_new alc260_acer_mixer[] = { |
| 3886 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3887 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 3888 | ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 3889 | HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, |
| 3890 | HDA_OUTPUT), |
| 3891 | HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, |
| 3892 | HDA_INPUT), |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 3893 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3894 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3895 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3896 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3897 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3898 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3899 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3900 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3901 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3902 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3903 | { } /* end */ |
| 3904 | }; |
| 3905 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3906 | /* Packard bell V7900 ALC260 pin usage: HP = 0x0f, Mic jack = 0x12, |
| 3907 | * Line In jack = 0x14, CD audio = 0x16, pc beep = 0x17. |
| 3908 | */ |
| 3909 | static struct snd_kcontrol_new alc260_will_mixer[] = { |
| 3910 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3911 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3912 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3913 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3914 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3915 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3916 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3917 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3918 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 3919 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 3920 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 3921 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 3922 | { } /* end */ |
| 3923 | }; |
| 3924 | |
| 3925 | /* Replacer 672V ALC260 pin usage: Mic jack = 0x12, |
| 3926 | * Line In jack = 0x14, ATAPI Mic = 0x13, speaker = 0x0f. |
| 3927 | */ |
| 3928 | static struct snd_kcontrol_new alc260_replacer_672v_mixer[] = { |
| 3929 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 3930 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 0x2, HDA_INPUT), |
| 3931 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), |
| 3932 | HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), |
| 3933 | ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), |
| 3934 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x07, 0x1, HDA_INPUT), |
| 3935 | HDA_CODEC_MUTE("ATATI Mic Playback Switch", 0x07, 0x1, HDA_INPUT), |
| 3936 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 3937 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 3938 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
| 3939 | { } /* end */ |
| 3940 | }; |
| 3941 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3942 | /* capture mixer elements */ |
| 3943 | static struct snd_kcontrol_new alc260_capture_mixer[] = { |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3944 | HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), |
| 3945 | HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3946 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), |
| 3947 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3948 | { |
| 3949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3950 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3951 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3952 | */ |
| 3953 | /* .name = "Capture Source", */ |
| 3954 | .name = "Input Source", |
| 3955 | .count = 2, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 3956 | .info = alc_mux_enum_info, |
| 3957 | .get = alc_mux_enum_get, |
| 3958 | .put = alc_mux_enum_put, |
| 3959 | }, |
| 3960 | { } /* end */ |
| 3961 | }; |
| 3962 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3963 | static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { |
| 3964 | HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), |
| 3965 | HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), |
| 3966 | { |
| 3967 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 3968 | /* The multiple "Capture Source" controls confuse alsamixer |
| 3969 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3970 | */ |
| 3971 | /* .name = "Capture Source", */ |
| 3972 | .name = "Input Source", |
| 3973 | .count = 1, |
| 3974 | .info = alc_mux_enum_info, |
| 3975 | .get = alc_mux_enum_get, |
| 3976 | .put = alc_mux_enum_put, |
| 3977 | }, |
| 3978 | { } /* end */ |
| 3979 | }; |
| 3980 | |
| 3981 | /* |
| 3982 | * initialization verbs |
| 3983 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3984 | static struct hda_verb alc260_init_verbs[] = { |
| 3985 | /* Line In pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3986 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3987 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3988 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3989 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3990 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3991 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 3992 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3993 | /* LINE-2 is used for line-out in rear */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3994 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3995 | /* select line-out */ |
Jonathan Woithe | fd56f2d | 2006-01-24 10:35:46 +0100 | [diff] [blame] | 3996 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3997 | /* LINE-OUT pin */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 3998 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3999 | /* enable HP */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4000 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4001 | /* enable Mono */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4002 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4003 | /* mute capture amp left and right */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4004 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4005 | /* set connection select to line in (default select for this ADC) */ |
| 4006 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4007 | /* mute capture amp left and right */ |
| 4008 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4009 | /* set connection select to line in (default select for this ADC) */ |
| 4010 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4011 | /* set vol=0 Line-Out mixer amp left and right */ |
| 4012 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4013 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4014 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4015 | /* set vol=0 HP mixer amp left and right */ |
| 4016 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4017 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4018 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4019 | /* set vol=0 Mono mixer amp left and right */ |
| 4020 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4021 | /* unmute pin widget amp left and right (no gain on this amp) */ |
| 4022 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4023 | /* unmute LINE-2 out pin */ |
| 4024 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4025 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4026 | * Line In 2 = 0x03 |
| 4027 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4028 | /* mute analog inputs */ |
| 4029 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4030 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4031 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4032 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4033 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4034 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 4035 | /* mute Front out path */ |
| 4036 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4037 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4038 | /* mute Headphone out path */ |
| 4039 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4040 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4041 | /* mute Mono out path */ |
| 4042 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4043 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4044 | { } |
| 4045 | }; |
| 4046 | |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4047 | #if 0 /* should be identical with alc260_init_verbs? */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4048 | static struct hda_verb alc260_hp_init_verbs[] = { |
| 4049 | /* Headphone and output */ |
| 4050 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4051 | /* mono output */ |
| 4052 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4053 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4054 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4055 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4056 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4057 | /* Line In pin widget for input */ |
| 4058 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4059 | /* Line-2 pin widget for output */ |
| 4060 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4061 | /* CD pin widget for input */ |
| 4062 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4063 | /* unmute amp left and right */ |
| 4064 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4065 | /* set connection select to line in (default select for this ADC) */ |
| 4066 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4067 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4068 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4069 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4070 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4071 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4072 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4073 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4074 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4075 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4076 | * Line In 2 = 0x03 |
| 4077 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4078 | /* mute analog inputs */ |
| 4079 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4081 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4082 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4083 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4084 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4085 | /* Unmute Front out path */ |
| 4086 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4087 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4088 | /* Unmute Headphone out path */ |
| 4089 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4090 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4091 | /* Unmute Mono out path */ |
| 4092 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4093 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4094 | { } |
| 4095 | }; |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4096 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4097 | |
| 4098 | static struct hda_verb alc260_hp_3013_init_verbs[] = { |
| 4099 | /* Line out and output */ |
| 4100 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4101 | /* mono output */ |
| 4102 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 4103 | /* Mic1 (rear panel) pin widget for input and vref at 80% */ |
| 4104 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4105 | /* Mic2 (front panel) pin widget for input and vref at 80% */ |
| 4106 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 4107 | /* Line In pin widget for input */ |
| 4108 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4109 | /* Headphone pin widget for output */ |
| 4110 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 4111 | /* CD pin widget for input */ |
| 4112 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 4113 | /* unmute amp left and right */ |
| 4114 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, |
| 4115 | /* set connection select to line in (default select for this ADC) */ |
| 4116 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 4117 | /* unmute Line-Out mixer amp left and right (volume = 0) */ |
| 4118 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4119 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4120 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 4121 | /* unmute HP mixer amp left and right (volume = 0) */ |
| 4122 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
| 4123 | /* mute pin widget amp left and right (no gain on this amp) */ |
| 4124 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4125 | /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & |
| 4126 | * Line In 2 = 0x03 |
| 4127 | */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4128 | /* mute analog inputs */ |
| 4129 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4130 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4131 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4132 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4133 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4134 | /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ |
| 4135 | /* Unmute Front out path */ |
| 4136 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4137 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4138 | /* Unmute Headphone out path */ |
| 4139 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4140 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4141 | /* Unmute Mono out path */ |
| 4142 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 4143 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 4144 | { } |
| 4145 | }; |
| 4146 | |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4147 | /* Initialisation sequence for ALC260 as configured in Fujitsu S702x |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4148 | * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD |
| 4149 | * audio = 0x16, internal speaker = 0x10. |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4150 | */ |
| 4151 | static struct hda_verb alc260_fujitsu_init_verbs[] = { |
| 4152 | /* Disable all GPIOs */ |
| 4153 | {0x01, AC_VERB_SET_GPIO_MASK, 0}, |
| 4154 | /* Internal speaker is connected to headphone pin */ |
| 4155 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4156 | /* Headphone/Line-out jack connects to Line1 pin; make it an output */ |
| 4157 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4158 | /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ |
| 4159 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 4160 | /* Ensure all other unused pins are disabled and muted. */ |
| 4161 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4162 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4163 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4164 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4165 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4166 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4167 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4168 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4169 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4170 | /* Disable digital (SPDIF) pins */ |
| 4171 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4172 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4173 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4174 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
| 4175 | * when acting as an output. |
| 4176 | */ |
| 4177 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4178 | |
| 4179 | /* Start with output sum widgets muted and their output gains at min */ |
Takashi Iwai | 8b33a5a | 2006-02-09 11:57:01 +0100 | [diff] [blame] | 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 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 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 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4186 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4187 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4188 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4189 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4190 | /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ |
| 4191 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4192 | /* Unmute Line1 pin widget output buffer since it starts as an output. |
| 4193 | * If the pin mode is changed by the user the pin mode control will |
| 4194 | * take care of enabling the pin's input/output buffers as needed. |
| 4195 | * Therefore there's no need to enable the input buffer at this |
| 4196 | * stage. |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4197 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4198 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4199 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
| 4200 | * mixer ctrl) |
| 4201 | */ |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4202 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4203 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4204 | /* Mute capture amp left and right */ |
| 4205 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4206 | /* Set ADC connection select to match default mixer setting - line |
| 4207 | * in (on mic1 pin) |
| 4208 | */ |
| 4209 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4210 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4211 | /* Do the same for the second ADC: mute capture input amp and |
| 4212 | * set ADC connection to line in (on mic1 pin) |
| 4213 | */ |
| 4214 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4215 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 4c5186e | 2006-02-09 11:53:48 +0100 | [diff] [blame] | 4216 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4217 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4218 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4219 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4220 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4221 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4222 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4223 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4224 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4225 | {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] | 4226 | |
| 4227 | { } |
Jonathan Woithe | a9430dd | 2005-09-16 19:12:48 +0200 | [diff] [blame] | 4228 | }; |
| 4229 | |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4230 | /* Initialisation sequence for ALC260 as configured in Acer TravelMate and |
| 4231 | * similar laptops (adapted from Fujitsu init verbs). |
| 4232 | */ |
| 4233 | static struct hda_verb alc260_acer_init_verbs[] = { |
| 4234 | /* On TravelMate laptops, GPIO 0 enables the internal speaker and |
| 4235 | * the headphone jack. Turn this on and rely on the standard mute |
| 4236 | * methods whenever the user wants to turn these outputs off. |
| 4237 | */ |
| 4238 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4239 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4240 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 4241 | /* Internal speaker/Headphone jack is connected to Line-out pin */ |
| 4242 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4243 | /* Internal microphone/Mic jack is connected to Mic1 pin */ |
| 4244 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 4245 | /* Line In jack is connected to Line1 pin */ |
| 4246 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4247 | /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ |
| 4248 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4249 | /* Ensure all other unused pins are disabled and muted. */ |
| 4250 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4251 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4252 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4253 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4254 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, |
| 4255 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4256 | /* Disable digital (SPDIF) pins */ |
| 4257 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4258 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4259 | |
| 4260 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
| 4261 | * bus when acting as outputs. |
| 4262 | */ |
| 4263 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4264 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4265 | |
| 4266 | /* Start with output sum widgets muted and their output gains at min */ |
| 4267 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4268 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4269 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4270 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4271 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4272 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4273 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4274 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4275 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4276 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4277 | /* Unmute Line-out pin widget amp left and right |
| 4278 | * (no equiv mixer ctrl) |
| 4279 | */ |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4280 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4281 | /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ |
| 4282 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4283 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as |
| 4284 | * inputs. If the pin mode is changed by the user the pin mode control |
| 4285 | * will take care of enabling the pin's input/output buffers as needed. |
| 4286 | * Therefore there's no need to enable the input buffer at this |
| 4287 | * stage. |
| 4288 | */ |
| 4289 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4290 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4291 | |
| 4292 | /* Mute capture amp left and right */ |
| 4293 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4294 | /* Set ADC connection select to match default mixer setting - mic |
| 4295 | * (on mic1 pin) |
| 4296 | */ |
| 4297 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4298 | |
| 4299 | /* Do similar with the second ADC: mute capture input amp and |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4300 | * set ADC connection to mic to match ALSA's default state. |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4301 | */ |
| 4302 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4303 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4304 | |
| 4305 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4306 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4307 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4308 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4309 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4310 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4311 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4312 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4313 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4314 | |
| 4315 | { } |
| 4316 | }; |
| 4317 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4318 | static struct hda_verb alc260_will_verbs[] = { |
| 4319 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 4320 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4321 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4322 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4323 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4324 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3040}, |
| 4325 | {} |
| 4326 | }; |
| 4327 | |
| 4328 | static struct hda_verb alc260_replacer_672v_verbs[] = { |
| 4329 | {0x0f, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, |
| 4330 | {0x1a, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 4331 | {0x1a, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 4332 | |
| 4333 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 4334 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 4335 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4336 | |
| 4337 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 4338 | {} |
| 4339 | }; |
| 4340 | |
| 4341 | /* toggle speaker-output according to the hp-jack state */ |
| 4342 | static void alc260_replacer_672v_automute(struct hda_codec *codec) |
| 4343 | { |
| 4344 | unsigned int present; |
| 4345 | |
| 4346 | /* speaker --> GPIO Data 0, hp or spdif --> GPIO data 1 */ |
| 4347 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 4348 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 4349 | if (present) { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4350 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4351 | AC_VERB_SET_GPIO_DATA, 1); |
| 4352 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4353 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4354 | PIN_HP); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4355 | } else { |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 4356 | snd_hda_codec_write_cache(codec, 0x01, 0, |
| 4357 | AC_VERB_SET_GPIO_DATA, 0); |
| 4358 | snd_hda_codec_write_cache(codec, 0x0f, 0, |
| 4359 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4360 | PIN_OUT); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4361 | } |
| 4362 | } |
| 4363 | |
| 4364 | static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, |
| 4365 | unsigned int res) |
| 4366 | { |
| 4367 | if ((res >> 26) == ALC880_HP_EVENT) |
| 4368 | alc260_replacer_672v_automute(codec); |
| 4369 | } |
| 4370 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4371 | /* Test configuration for debugging, modelled after the ALC880 test |
| 4372 | * configuration. |
| 4373 | */ |
| 4374 | #ifdef CONFIG_SND_DEBUG |
| 4375 | static hda_nid_t alc260_test_dac_nids[1] = { |
| 4376 | 0x02, |
| 4377 | }; |
| 4378 | static hda_nid_t alc260_test_adc_nids[2] = { |
| 4379 | 0x04, 0x05, |
| 4380 | }; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4381 | /* For testing the ALC260, each input MUX needs its own definition since |
| 4382 | * the signal assignments are different. This assumes that the first ADC |
| 4383 | * is NID 0x04. |
Jonathan Woithe | 17e7aec | 2006-02-28 11:35:18 +0100 | [diff] [blame] | 4384 | */ |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4385 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
| 4386 | { |
| 4387 | .num_items = 7, |
| 4388 | .items = { |
| 4389 | { "MIC1 pin", 0x0 }, |
| 4390 | { "MIC2 pin", 0x1 }, |
| 4391 | { "LINE1 pin", 0x2 }, |
| 4392 | { "LINE2 pin", 0x3 }, |
| 4393 | { "CD pin", 0x4 }, |
| 4394 | { "LINE-OUT pin", 0x5 }, |
| 4395 | { "HP-OUT pin", 0x6 }, |
| 4396 | }, |
| 4397 | }, |
| 4398 | { |
| 4399 | .num_items = 8, |
| 4400 | .items = { |
| 4401 | { "MIC1 pin", 0x0 }, |
| 4402 | { "MIC2 pin", 0x1 }, |
| 4403 | { "LINE1 pin", 0x2 }, |
| 4404 | { "LINE2 pin", 0x3 }, |
| 4405 | { "CD pin", 0x4 }, |
| 4406 | { "Mixer", 0x5 }, |
| 4407 | { "LINE-OUT pin", 0x6 }, |
| 4408 | { "HP-OUT pin", 0x7 }, |
| 4409 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4410 | }, |
| 4411 | }; |
| 4412 | static struct snd_kcontrol_new alc260_test_mixer[] = { |
| 4413 | /* Output driver widgets */ |
| 4414 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), |
| 4415 | HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), |
| 4416 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
| 4417 | HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), |
| 4418 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), |
| 4419 | HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), |
| 4420 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4421 | /* Modes for retasking pin widgets |
| 4422 | * Note: the ALC260 doesn't seem to act on requests to enable mic |
| 4423 | * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't |
| 4424 | * mention this restriction. At this stage it's not clear whether |
| 4425 | * this behaviour is intentional or is a hardware bug in chip |
| 4426 | * revisions available at least up until early 2006. Therefore for |
| 4427 | * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all |
| 4428 | * choices, but if it turns out that the lack of mic bias for these |
| 4429 | * NIDs is intentional we could change their modes from |
| 4430 | * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. |
| 4431 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4432 | ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), |
| 4433 | ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), |
| 4434 | ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 4435 | ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 4436 | ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), |
| 4437 | ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), |
| 4438 | |
| 4439 | /* Loopback mixer controls */ |
| 4440 | HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), |
| 4441 | HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), |
| 4442 | HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), |
| 4443 | HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), |
| 4444 | HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), |
| 4445 | HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), |
| 4446 | HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), |
| 4447 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
| 4448 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
| 4449 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
| 4450 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), |
| 4451 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), |
| 4452 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
| 4453 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
| 4454 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
| 4455 | HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4456 | |
| 4457 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 4458 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 4459 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 4460 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 4461 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 4462 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4463 | /* Switches to allow the digital IO pins to be enabled. The datasheet |
| 4464 | * is ambigious as to which NID is which; testing on laptops which |
| 4465 | * make this output available should provide clarification. |
| 4466 | */ |
| 4467 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
| 4468 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
| 4469 | |
Jonathan Woithe | f8225f6 | 2008-01-08 12:16:54 +0100 | [diff] [blame] | 4470 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 4471 | * this output to turn on an external amplifier. |
| 4472 | */ |
| 4473 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 4474 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 4475 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4476 | { } /* end */ |
| 4477 | }; |
| 4478 | static struct hda_verb alc260_test_init_verbs[] = { |
Jonathan Woithe | 5c8f858 | 2006-02-28 11:43:27 +0100 | [diff] [blame] | 4479 | /* Enable all GPIOs as outputs with an initial value of 0 */ |
| 4480 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, |
| 4481 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 4482 | {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, |
| 4483 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4484 | /* Enable retasking pins as output, initially without power amp */ |
| 4485 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4486 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4487 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4488 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4489 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4490 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 4491 | |
Jonathan Woithe | 92621f1 | 2006-02-28 11:47:47 +0100 | [diff] [blame] | 4492 | /* Disable digital (SPDIF) pins initially, but users can enable |
| 4493 | * them via a mixer switch. In the case of SPDIF-out, this initverb |
| 4494 | * payload also sets the generation to 0, output to be in "consumer" |
| 4495 | * PCM format, copyright asserted, no pre-emphasis and no validity |
| 4496 | * control. |
| 4497 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4498 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4499 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
| 4500 | |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4501 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4502 | * OUT1 sum bus when acting as an output. |
| 4503 | */ |
| 4504 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4505 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4506 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4507 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, |
| 4508 | |
| 4509 | /* Start with output sum widgets muted and their output gains at min */ |
| 4510 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4511 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4512 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4513 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4514 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4515 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4516 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4517 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4518 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4519 | |
Jonathan Woithe | cdcd926 | 2006-02-28 11:36:42 +0100 | [diff] [blame] | 4520 | /* Unmute retasking pin widget output buffers since the default |
| 4521 | * state appears to be output. As the pin mode is changed by the |
| 4522 | * user the pin mode control will take care of enabling the pin's |
| 4523 | * input/output buffers as needed. |
| 4524 | */ |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4525 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4526 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4527 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4528 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4529 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4530 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4531 | /* Also unmute the mono-out pin widget */ |
| 4532 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 4533 | |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4534 | /* Mute capture amp left and right */ |
| 4535 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4536 | /* Set ADC connection select to match default mixer setting (mic1 |
| 4537 | * pin) |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4538 | */ |
| 4539 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4540 | |
| 4541 | /* Do the same for the second ADC: mute capture input amp and |
Jonathan Woithe | f7ace40 | 2006-02-28 11:46:14 +0100 | [diff] [blame] | 4542 | * set ADC connection to mic1 pin |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4543 | */ |
| 4544 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4545 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4546 | |
| 4547 | /* Mute all inputs to mixer widget (even unconnected ones) */ |
| 4548 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ |
| 4549 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ |
| 4550 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ |
| 4551 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ |
| 4552 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ |
| 4553 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ |
| 4554 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ |
| 4555 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ |
| 4556 | |
| 4557 | { } |
| 4558 | }; |
| 4559 | #endif |
| 4560 | |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 4561 | #define alc260_pcm_analog_playback alc880_pcm_analog_alt_playback |
| 4562 | #define alc260_pcm_analog_capture alc880_pcm_analog_capture |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4563 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 4564 | #define alc260_pcm_digital_playback alc880_pcm_digital_playback |
| 4565 | #define alc260_pcm_digital_capture alc880_pcm_digital_capture |
| 4566 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4567 | /* |
| 4568 | * for BIOS auto-configuration |
| 4569 | */ |
| 4570 | |
| 4571 | static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, |
| 4572 | const char *pfx) |
| 4573 | { |
| 4574 | hda_nid_t nid_vol; |
| 4575 | unsigned long vol_val, sw_val; |
| 4576 | char name[32]; |
| 4577 | int err; |
| 4578 | |
| 4579 | if (nid >= 0x0f && nid < 0x11) { |
| 4580 | nid_vol = nid - 0x7; |
| 4581 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4582 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4583 | } else if (nid == 0x11) { |
| 4584 | nid_vol = nid - 0x7; |
| 4585 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); |
| 4586 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); |
| 4587 | } else if (nid >= 0x12 && nid <= 0x15) { |
| 4588 | nid_vol = 0x08; |
| 4589 | vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); |
| 4590 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
| 4591 | } else |
| 4592 | return 0; /* N/A */ |
| 4593 | |
| 4594 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4595 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
| 4596 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4597 | return err; |
| 4598 | snprintf(name, sizeof(name), "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4599 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val); |
| 4600 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4601 | return err; |
| 4602 | return 1; |
| 4603 | } |
| 4604 | |
| 4605 | /* add playback controls from the parsed DAC table */ |
| 4606 | static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 4607 | const struct auto_pin_cfg *cfg) |
| 4608 | { |
| 4609 | hda_nid_t nid; |
| 4610 | int err; |
| 4611 | |
| 4612 | spec->multiout.num_dacs = 1; |
| 4613 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 4614 | spec->multiout.dac_nids[0] = 0x02; |
| 4615 | |
| 4616 | nid = cfg->line_out_pins[0]; |
| 4617 | if (nid) { |
| 4618 | err = alc260_add_playback_controls(spec, nid, "Front"); |
| 4619 | if (err < 0) |
| 4620 | return err; |
| 4621 | } |
| 4622 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4623 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4624 | if (nid) { |
| 4625 | err = alc260_add_playback_controls(spec, nid, "Speaker"); |
| 4626 | if (err < 0) |
| 4627 | return err; |
| 4628 | } |
| 4629 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4630 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4631 | if (nid) { |
| 4632 | err = alc260_add_playback_controls(spec, nid, "Headphone"); |
| 4633 | if (err < 0) |
| 4634 | return err; |
| 4635 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4636 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4637 | } |
| 4638 | |
| 4639 | /* create playback/capture controls for input pins */ |
| 4640 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 4641 | const struct auto_pin_cfg *cfg) |
| 4642 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4643 | struct hda_input_mux *imux = &spec->private_imux; |
| 4644 | int i, err, idx; |
| 4645 | |
| 4646 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4647 | if (cfg->input_pins[i] >= 0x12) { |
| 4648 | idx = cfg->input_pins[i] - 0x12; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4649 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4650 | auto_pin_cfg_labels[i], idx, |
| 4651 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4652 | if (err < 0) |
| 4653 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4654 | imux->items[imux->num_items].label = |
| 4655 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4656 | imux->items[imux->num_items].index = idx; |
| 4657 | imux->num_items++; |
| 4658 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4659 | if (cfg->input_pins[i] >= 0x0f && cfg->input_pins[i] <= 0x10){ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4660 | idx = cfg->input_pins[i] - 0x09; |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4661 | err = new_analog_input(spec, cfg->input_pins[i], |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4662 | auto_pin_cfg_labels[i], idx, |
| 4663 | 0x07); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4664 | if (err < 0) |
| 4665 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4666 | imux->items[imux->num_items].label = |
| 4667 | auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4668 | imux->items[imux->num_items].index = idx; |
| 4669 | imux->num_items++; |
| 4670 | } |
| 4671 | } |
| 4672 | return 0; |
| 4673 | } |
| 4674 | |
| 4675 | static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, |
| 4676 | hda_nid_t nid, int pin_type, |
| 4677 | int sel_idx) |
| 4678 | { |
| 4679 | /* set as output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4680 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4681 | pin_type); |
| 4682 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 4683 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4684 | /* need the manual connection? */ |
| 4685 | if (nid >= 0x12) { |
| 4686 | int idx = nid - 0x12; |
| 4687 | snd_hda_codec_write(codec, idx + 0x0b, 0, |
| 4688 | AC_VERB_SET_CONNECT_SEL, sel_idx); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4689 | } |
| 4690 | } |
| 4691 | |
| 4692 | static void alc260_auto_init_multi_out(struct hda_codec *codec) |
| 4693 | { |
| 4694 | struct alc_spec *spec = codec->spec; |
| 4695 | hda_nid_t nid; |
| 4696 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4697 | alc_subsystem_id(codec, 0x10, 0x15, 0x0f); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4698 | nid = spec->autocfg.line_out_pins[0]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4699 | if (nid) { |
| 4700 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
| 4701 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
| 4702 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4703 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 4704 | nid = spec->autocfg.speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4705 | if (nid) |
| 4706 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
| 4707 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 4708 | nid = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4709 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 4710 | alc260_auto_set_output_and_unmute(codec, nid, PIN_HP, 0); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4711 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4712 | |
| 4713 | #define ALC260_PIN_CD_NID 0x16 |
| 4714 | static void alc260_auto_init_analog_input(struct hda_codec *codec) |
| 4715 | { |
| 4716 | struct alc_spec *spec = codec->spec; |
| 4717 | int i; |
| 4718 | |
| 4719 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 4720 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 4721 | if (nid >= 0x12) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4722 | snd_hda_codec_write(codec, nid, 0, |
| 4723 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 4724 | i <= AUTO_PIN_FRONT_MIC ? |
| 4725 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4726 | if (nid != ALC260_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4727 | snd_hda_codec_write(codec, nid, 0, |
| 4728 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4729 | AMP_OUT_MUTE); |
| 4730 | } |
| 4731 | } |
| 4732 | } |
| 4733 | |
| 4734 | /* |
| 4735 | * generic initialization of ADC, input mixers and output mixers |
| 4736 | */ |
| 4737 | static struct hda_verb alc260_volume_init_verbs[] = { |
| 4738 | /* |
| 4739 | * Unmute ADC0-1 and set the default input to mic-in |
| 4740 | */ |
| 4741 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4742 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4743 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 4744 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4745 | |
| 4746 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 4747 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4748 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 4749 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4750 | */ |
| 4751 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4752 | /* mute analog inputs */ |
| 4753 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 4754 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 4755 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 4756 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 4757 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4758 | |
| 4759 | /* |
| 4760 | * Set up output mixers (0x08 - 0x0a) |
| 4761 | */ |
| 4762 | /* set vol=0 to output mixers */ |
| 4763 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4764 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4765 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 4766 | /* set up input amps for analog loopback */ |
| 4767 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 4768 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4769 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4770 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4771 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4772 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 4773 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 4774 | |
| 4775 | { } |
| 4776 | }; |
| 4777 | |
| 4778 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 4779 | { |
| 4780 | struct alc_spec *spec = codec->spec; |
| 4781 | unsigned int wcap; |
| 4782 | int err; |
| 4783 | static hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
| 4784 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4785 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 4786 | alc260_ignore); |
| 4787 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4788 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4789 | err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 4790 | if (err < 0) |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4791 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4792 | if (!spec->kctl_alloc) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4793 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 4794 | err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 4795 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4796 | return err; |
| 4797 | |
| 4798 | spec->multiout.max_channels = 2; |
| 4799 | |
| 4800 | if (spec->autocfg.dig_out_pin) |
| 4801 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
| 4802 | if (spec->kctl_alloc) |
| 4803 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 4804 | |
| 4805 | spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; |
| 4806 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4807 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4808 | spec->input_mux = &spec->private_imux; |
| 4809 | |
| 4810 | /* check whether NID 0x04 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4811 | wcap = get_wcaps(codec, 0x04); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4812 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ |
| 4813 | if (wcap != AC_WID_AUD_IN) { |
| 4814 | spec->adc_nids = alc260_adc_nids_alt; |
| 4815 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); |
| 4816 | spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4817 | } else { |
| 4818 | spec->adc_nids = alc260_adc_nids; |
| 4819 | spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); |
| 4820 | spec->mixers[spec->num_mixers] = alc260_capture_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4821 | } |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 4822 | spec->num_mixers++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4823 | |
| 4824 | return 1; |
| 4825 | } |
| 4826 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 4827 | /* additional initialization for auto-configuration model */ |
| 4828 | static void alc260_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4829 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4830 | alc260_auto_init_multi_out(codec); |
| 4831 | alc260_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4832 | } |
| 4833 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 4834 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 4835 | static struct hda_amp_list alc260_loopbacks[] = { |
| 4836 | { 0x07, HDA_INPUT, 0 }, |
| 4837 | { 0x07, HDA_INPUT, 1 }, |
| 4838 | { 0x07, HDA_INPUT, 2 }, |
| 4839 | { 0x07, HDA_INPUT, 3 }, |
| 4840 | { 0x07, HDA_INPUT, 4 }, |
| 4841 | { } /* end */ |
| 4842 | }; |
| 4843 | #endif |
| 4844 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4845 | /* |
| 4846 | * ALC260 configurations |
| 4847 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4848 | static const char *alc260_models[ALC260_MODEL_LAST] = { |
| 4849 | [ALC260_BASIC] = "basic", |
| 4850 | [ALC260_HP] = "hp", |
| 4851 | [ALC260_HP_3013] = "hp-3013", |
| 4852 | [ALC260_FUJITSU_S702X] = "fujitsu", |
| 4853 | [ALC260_ACER] = "acer", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4854 | [ALC260_WILL] = "will", |
| 4855 | [ALC260_REPLACER_672V] = "replacer", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4856 | #ifdef CONFIG_SND_DEBUG |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4857 | [ALC260_TEST] = "test", |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4858 | #endif |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4859 | [ALC260_AUTO] = "auto", |
| 4860 | }; |
| 4861 | |
| 4862 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
Jonathan Woithe | bd86948 | 2006-11-28 11:35:52 +0100 | [diff] [blame] | 4863 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4864 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
Takashi Iwai | 9720b71 | 2007-03-13 21:46:23 +0100 | [diff] [blame] | 4865 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
Takashi Iwai | a8a5d06 | 2007-03-15 15:10:28 +0100 | [diff] [blame] | 4866 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 4867 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
| 4868 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), |
| 4869 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), |
| 4870 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
| 4871 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
| 4872 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
| 4873 | SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), |
| 4874 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), |
| 4875 | SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), |
| 4876 | SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), |
| 4877 | SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), |
| 4878 | SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4879 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_REPLACER_672V), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 4880 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_WILL), |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 4881 | {} |
| 4882 | }; |
| 4883 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4884 | static struct alc_config_preset alc260_presets[] = { |
| 4885 | [ALC260_BASIC] = { |
| 4886 | .mixers = { alc260_base_output_mixer, |
| 4887 | alc260_input_mixer, |
| 4888 | alc260_pc_beep_mixer, |
| 4889 | alc260_capture_mixer }, |
| 4890 | .init_verbs = { alc260_init_verbs }, |
| 4891 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4892 | .dac_nids = alc260_dac_nids, |
| 4893 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4894 | .adc_nids = alc260_adc_nids, |
| 4895 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4896 | .channel_mode = alc260_modes, |
| 4897 | .input_mux = &alc260_capture_source, |
| 4898 | }, |
| 4899 | [ALC260_HP] = { |
| 4900 | .mixers = { alc260_base_output_mixer, |
| 4901 | alc260_input_mixer, |
| 4902 | alc260_capture_alt_mixer }, |
Takashi Iwai | 474167d | 2006-05-17 17:17:43 +0200 | [diff] [blame] | 4903 | .init_verbs = { alc260_init_verbs }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4904 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4905 | .dac_nids = alc260_dac_nids, |
| 4906 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4907 | .adc_nids = alc260_hp_adc_nids, |
| 4908 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4909 | .channel_mode = alc260_modes, |
| 4910 | .input_mux = &alc260_capture_source, |
| 4911 | }, |
| 4912 | [ALC260_HP_3013] = { |
| 4913 | .mixers = { alc260_hp_3013_mixer, |
| 4914 | alc260_input_mixer, |
| 4915 | alc260_capture_alt_mixer }, |
| 4916 | .init_verbs = { alc260_hp_3013_init_verbs }, |
| 4917 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4918 | .dac_nids = alc260_dac_nids, |
| 4919 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), |
| 4920 | .adc_nids = alc260_hp_adc_nids, |
| 4921 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4922 | .channel_mode = alc260_modes, |
| 4923 | .input_mux = &alc260_capture_source, |
| 4924 | }, |
| 4925 | [ALC260_FUJITSU_S702X] = { |
| 4926 | .mixers = { alc260_fujitsu_mixer, |
| 4927 | alc260_capture_mixer }, |
| 4928 | .init_verbs = { alc260_fujitsu_init_verbs }, |
| 4929 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4930 | .dac_nids = alc260_dac_nids, |
Jonathan Woithe | d57fdac | 2006-02-28 11:38:35 +0100 | [diff] [blame] | 4931 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4932 | .adc_nids = alc260_dual_adc_nids, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4933 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4934 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4935 | .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), |
| 4936 | .input_mux = alc260_fujitsu_capture_sources, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4937 | }, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4938 | [ALC260_ACER] = { |
| 4939 | .mixers = { alc260_acer_mixer, |
| 4940 | alc260_capture_mixer }, |
| 4941 | .init_verbs = { alc260_acer_init_verbs }, |
| 4942 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4943 | .dac_nids = alc260_dac_nids, |
| 4944 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), |
| 4945 | .adc_nids = alc260_dual_adc_nids, |
| 4946 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4947 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4948 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
| 4949 | .input_mux = alc260_acer_capture_sources, |
Jonathan Woithe | 0bfc90e | 2006-02-28 11:45:11 +0100 | [diff] [blame] | 4950 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 4951 | [ALC260_WILL] = { |
| 4952 | .mixers = { alc260_will_mixer, |
| 4953 | alc260_capture_mixer }, |
| 4954 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
| 4955 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4956 | .dac_nids = alc260_dac_nids, |
| 4957 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4958 | .adc_nids = alc260_adc_nids, |
| 4959 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4960 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4961 | .channel_mode = alc260_modes, |
| 4962 | .input_mux = &alc260_capture_source, |
| 4963 | }, |
| 4964 | [ALC260_REPLACER_672V] = { |
| 4965 | .mixers = { alc260_replacer_672v_mixer, |
| 4966 | alc260_capture_mixer }, |
| 4967 | .init_verbs = { alc260_init_verbs, alc260_replacer_672v_verbs }, |
| 4968 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
| 4969 | .dac_nids = alc260_dac_nids, |
| 4970 | .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), |
| 4971 | .adc_nids = alc260_adc_nids, |
| 4972 | .dig_out_nid = ALC260_DIGOUT_NID, |
| 4973 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4974 | .channel_mode = alc260_modes, |
| 4975 | .input_mux = &alc260_capture_source, |
| 4976 | .unsol_event = alc260_replacer_672v_unsol_event, |
| 4977 | .init_hook = alc260_replacer_672v_automute, |
| 4978 | }, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4979 | #ifdef CONFIG_SND_DEBUG |
| 4980 | [ALC260_TEST] = { |
| 4981 | .mixers = { alc260_test_mixer, |
| 4982 | alc260_capture_mixer }, |
| 4983 | .init_verbs = { alc260_test_init_verbs }, |
| 4984 | .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), |
| 4985 | .dac_nids = alc260_test_dac_nids, |
| 4986 | .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), |
| 4987 | .adc_nids = alc260_test_adc_nids, |
| 4988 | .num_channel_mode = ARRAY_SIZE(alc260_modes), |
| 4989 | .channel_mode = alc260_modes, |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 4990 | .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), |
| 4991 | .input_mux = alc260_test_capture_sources, |
Jonathan Woithe | 7cf51e48 | 2006-02-09 12:01:26 +0100 | [diff] [blame] | 4992 | }, |
| 4993 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4994 | }; |
| 4995 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4996 | static int patch_alc260(struct hda_codec *codec) |
| 4997 | { |
| 4998 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 4999 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5000 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 5001 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5002 | if (spec == NULL) |
| 5003 | return -ENOMEM; |
| 5004 | |
| 5005 | codec->spec = spec; |
| 5006 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5007 | board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, |
| 5008 | alc260_models, |
| 5009 | alc260_cfg_tbl); |
| 5010 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5011 | snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " |
| 5012 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5013 | board_config = ALC260_AUTO; |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5014 | } |
| 5015 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5016 | if (board_config == ALC260_AUTO) { |
| 5017 | /* automatic parse from the BIOS config */ |
| 5018 | err = alc260_parse_auto_config(codec); |
| 5019 | if (err < 0) { |
| 5020 | alc_free(codec); |
| 5021 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5022 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 5023 | printk(KERN_INFO |
| 5024 | "hda_codec: Cannot set up configuration " |
| 5025 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5026 | board_config = ALC260_BASIC; |
| 5027 | } |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5028 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5029 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5030 | if (board_config != ALC260_AUTO) |
| 5031 | setup_preset(spec, &alc260_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5032 | |
| 5033 | spec->stream_name_analog = "ALC260 Analog"; |
| 5034 | spec->stream_analog_playback = &alc260_pcm_analog_playback; |
| 5035 | spec->stream_analog_capture = &alc260_pcm_analog_capture; |
| 5036 | |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 5037 | spec->stream_name_digital = "ALC260 Digital"; |
| 5038 | spec->stream_digital_playback = &alc260_pcm_digital_playback; |
| 5039 | spec->stream_digital_capture = &alc260_pcm_digital_capture; |
| 5040 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5041 | spec->vmaster_nid = 0x08; |
| 5042 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5043 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5044 | if (board_config == ALC260_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 5045 | spec->init_hook = alc260_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5046 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5047 | if (!spec->loopback.amplist) |
| 5048 | spec->loopback.amplist = alc260_loopbacks; |
| 5049 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5050 | |
| 5051 | return 0; |
| 5052 | } |
| 5053 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5054 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5055 | /* |
| 5056 | * ALC882 support |
| 5057 | * |
| 5058 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 5059 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 5060 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 5061 | * 6-channel independent captures. |
| 5062 | * |
| 5063 | * In addition, an independent DAC for the multi-playback (not used in this |
| 5064 | * driver yet). |
| 5065 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5066 | #define ALC882_DIGOUT_NID 0x06 |
| 5067 | #define ALC882_DIGIN_NID 0x0a |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5068 | |
Takashi Iwai | d2a6d7d | 2005-11-17 11:06:29 +0100 | [diff] [blame] | 5069 | static struct hda_channel_mode alc882_ch_modes[1] = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5070 | { 8, NULL } |
| 5071 | }; |
| 5072 | |
| 5073 | static hda_nid_t alc882_dac_nids[4] = { |
| 5074 | /* front, rear, clfe, rear_surr */ |
| 5075 | 0x02, 0x03, 0x04, 0x05 |
| 5076 | }; |
| 5077 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5078 | /* identical with ALC880 */ |
| 5079 | #define alc882_adc_nids alc880_adc_nids |
| 5080 | #define alc882_adc_nids_alt alc880_adc_nids_alt |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5081 | |
| 5082 | /* input MUX */ |
| 5083 | /* FIXME: should be a matrix-type input source selection */ |
| 5084 | |
| 5085 | static struct hda_input_mux alc882_capture_source = { |
| 5086 | .num_items = 4, |
| 5087 | .items = { |
| 5088 | { "Mic", 0x0 }, |
| 5089 | { "Front Mic", 0x1 }, |
| 5090 | { "Line", 0x2 }, |
| 5091 | { "CD", 0x4 }, |
| 5092 | }, |
| 5093 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5094 | #define alc882_mux_enum_info alc_mux_enum_info |
| 5095 | #define alc882_mux_enum_get alc_mux_enum_get |
| 5096 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5097 | static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 5098 | struct snd_ctl_elem_value *ucontrol) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5099 | { |
| 5100 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 5101 | struct alc_spec *spec = codec->spec; |
| 5102 | const struct hda_input_mux *imux = spec->input_mux; |
| 5103 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 5104 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 5105 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 5106 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 5107 | unsigned int i, idx; |
| 5108 | |
| 5109 | idx = ucontrol->value.enumerated.item[0]; |
| 5110 | if (idx >= imux->num_items) |
| 5111 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5112 | if (*cur_val == idx) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5113 | return 0; |
| 5114 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5115 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 5116 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5117 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5118 | HDA_AMP_MUTE, v); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5119 | } |
| 5120 | *cur_val = idx; |
| 5121 | return 1; |
| 5122 | } |
| 5123 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5124 | /* |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5125 | * 2ch mode |
| 5126 | */ |
| 5127 | static struct hda_verb alc882_3ST_ch2_init[] = { |
| 5128 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 5129 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5130 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5131 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 5132 | { } /* end */ |
| 5133 | }; |
| 5134 | |
| 5135 | /* |
| 5136 | * 6ch mode |
| 5137 | */ |
| 5138 | static struct hda_verb alc882_3ST_ch6_init[] = { |
| 5139 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5140 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5141 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 5142 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5143 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 5144 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5145 | { } /* end */ |
| 5146 | }; |
| 5147 | |
| 5148 | static struct hda_channel_mode alc882_3ST_6ch_modes[2] = { |
| 5149 | { 2, alc882_3ST_ch2_init }, |
| 5150 | { 6, alc882_3ST_ch6_init }, |
| 5151 | }; |
| 5152 | |
| 5153 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5154 | * 6ch mode |
| 5155 | */ |
| 5156 | static struct hda_verb alc882_sixstack_ch6_init[] = { |
| 5157 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 5158 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5159 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5160 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5161 | { } /* end */ |
| 5162 | }; |
| 5163 | |
| 5164 | /* |
| 5165 | * 8ch mode |
| 5166 | */ |
| 5167 | static struct hda_verb alc882_sixstack_ch8_init[] = { |
| 5168 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5169 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5170 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5171 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5172 | { } /* end */ |
| 5173 | }; |
| 5174 | |
| 5175 | static struct hda_channel_mode alc882_sixstack_modes[2] = { |
| 5176 | { 6, alc882_sixstack_ch6_init }, |
| 5177 | { 8, alc882_sixstack_ch8_init }, |
| 5178 | }; |
| 5179 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5180 | /* |
| 5181 | * macbook pro ALC885 can switch LineIn to LineOut without loosing Mic |
| 5182 | */ |
| 5183 | |
| 5184 | /* |
| 5185 | * 2ch mode |
| 5186 | */ |
| 5187 | static struct hda_verb alc885_mbp_ch2_init[] = { |
| 5188 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 5189 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5190 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5191 | { } /* end */ |
| 5192 | }; |
| 5193 | |
| 5194 | /* |
| 5195 | * 6ch mode |
| 5196 | */ |
| 5197 | static struct hda_verb alc885_mbp_ch6_init[] = { |
| 5198 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 5199 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5200 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 5201 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5202 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5203 | { } /* end */ |
| 5204 | }; |
| 5205 | |
| 5206 | static struct hda_channel_mode alc885_mbp_6ch_modes[2] = { |
| 5207 | { 2, alc885_mbp_ch2_init }, |
| 5208 | { 6, alc885_mbp_ch6_init }, |
| 5209 | }; |
| 5210 | |
| 5211 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5212 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 5213 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 5214 | */ |
Takashi Iwai | c8b6bf9 | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 5215 | static struct snd_kcontrol_new alc882_base_mixer[] = { |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5216 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5217 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5218 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5219 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5220 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 5221 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5222 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 5223 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5224 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
Takashi Iwai | 985be54 | 2005-11-02 18:26:49 +0100 | [diff] [blame] | 5225 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5226 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5227 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5228 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5229 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5230 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5231 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5232 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5233 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5234 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 5235 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5236 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 5237 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5238 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5239 | { } /* end */ |
| 5240 | }; |
| 5241 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5242 | static struct snd_kcontrol_new alc885_mbp3_mixer[] = { |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5243 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5244 | HDA_BIND_MUTE ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), |
| 5245 | HDA_CODEC_MUTE ("Speaker Playback Switch", 0x14, 0x00, HDA_OUTPUT), |
| 5246 | HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0d, 0x00, HDA_OUTPUT), |
| 5247 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5248 | HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5249 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x00, HDA_INPUT), |
| 5250 | HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x00, HDA_INPUT), |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 5251 | HDA_CODEC_VOLUME("Line Boost", 0x1a, 0x00, HDA_INPUT), |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5252 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x00, HDA_INPUT), |
| 5253 | { } /* end */ |
| 5254 | }; |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5255 | static struct snd_kcontrol_new alc882_w2jc_mixer[] = { |
| 5256 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5257 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5258 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5259 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5260 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5261 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5262 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5263 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5264 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5265 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5266 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5267 | { } /* end */ |
| 5268 | }; |
| 5269 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5270 | static struct snd_kcontrol_new alc882_targa_mixer[] = { |
| 5271 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5272 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5273 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 5274 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5275 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5276 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5277 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5278 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5279 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5280 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5281 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 5282 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5283 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5284 | { } /* end */ |
| 5285 | }; |
| 5286 | |
| 5287 | /* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ??? |
| 5288 | * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c |
| 5289 | */ |
| 5290 | static struct snd_kcontrol_new alc882_asus_a7j_mixer[] = { |
| 5291 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5292 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 5293 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5294 | HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
| 5295 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5296 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5297 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5298 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5299 | HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT), |
| 5300 | HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT), |
| 5301 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5302 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 96fe7cc8 | 2007-09-07 10:57:44 +0200 | [diff] [blame] | 5303 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5304 | { } /* end */ |
| 5305 | }; |
| 5306 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5307 | static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { |
| 5308 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 5309 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 5310 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 5311 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 5312 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 5313 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5314 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5315 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 5316 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 5317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 5318 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 5319 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 5320 | { } /* end */ |
| 5321 | }; |
| 5322 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5323 | static struct snd_kcontrol_new alc882_chmode_mixer[] = { |
| 5324 | { |
| 5325 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5326 | .name = "Channel Mode", |
| 5327 | .info = alc_ch_mode_info, |
| 5328 | .get = alc_ch_mode_get, |
| 5329 | .put = alc_ch_mode_put, |
| 5330 | }, |
| 5331 | { } /* end */ |
| 5332 | }; |
| 5333 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5334 | static struct hda_verb alc882_init_verbs[] = { |
| 5335 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5336 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5337 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5338 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5339 | /* Rear mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5340 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5341 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5342 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5343 | /* CLFE mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5344 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5345 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5346 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5347 | /* Side mixer */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5348 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5349 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5350 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5351 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5352 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5353 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5354 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5355 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5356 | /* Rear Pin: output 1 (0x0d) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5357 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5358 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5359 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5360 | /* CLFE Pin: output 2 (0x0e) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5361 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5362 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5363 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5364 | /* Side Pin: output 3 (0x0f) */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5365 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5366 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5367 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5368 | /* Mic (rear) pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5369 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5370 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5371 | /* Front Mic pin: input vref at 80% */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 5372 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5373 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5374 | /* Line In pin: input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5375 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 5376 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5377 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 5378 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5379 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5380 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5381 | /* CD pin widget for input */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5382 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5383 | |
| 5384 | /* FIXME: use matrix-type input source selection */ |
| 5385 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5386 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5387 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5388 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5389 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5390 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5391 | /* Input mixer2 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5392 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5393 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5394 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5396 | /* Input mixer3 */ |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5397 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5398 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5399 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5400 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5401 | /* ADC1: mute amp left and right */ |
| 5402 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5403 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5404 | /* ADC2: mute amp left and right */ |
| 5405 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5406 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Takashi Iwai | 05acb86 | 2005-06-10 19:50:25 +0200 | [diff] [blame] | 5407 | /* ADC3: mute amp left and right */ |
| 5408 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
Takashi Iwai | 71fe7b8 | 2005-05-25 18:11:40 +0200 | [diff] [blame] | 5409 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5410 | |
| 5411 | { } |
| 5412 | }; |
| 5413 | |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5414 | static struct hda_verb alc882_eapd_verbs[] = { |
| 5415 | /* change to EAPD mode */ |
| 5416 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 5417 | {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5418 | { } |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5419 | }; |
| 5420 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5421 | /* Mac Pro test */ |
| 5422 | static struct snd_kcontrol_new alc882_macpro_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", 0x18, 0x0, HDA_OUTPUT), |
| 5426 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 5427 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 5428 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 5429 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 5430 | { } /* end */ |
| 5431 | }; |
| 5432 | |
| 5433 | static struct hda_verb alc882_macpro_init_verbs[] = { |
| 5434 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5435 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5436 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5437 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5438 | /* Front Pin: output 0 (0x0c) */ |
| 5439 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5440 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5441 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5442 | /* Front Mic pin: input vref at 80% */ |
| 5443 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5444 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5445 | /* Speaker: output */ |
| 5446 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5447 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5448 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, |
| 5449 | /* Headphone output (output 0 - 0x0c) */ |
| 5450 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5451 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5452 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5453 | |
| 5454 | /* FIXME: use matrix-type input source selection */ |
| 5455 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5456 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5457 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5458 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5459 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5460 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5461 | /* Input mixer2 */ |
| 5462 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5463 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5464 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5465 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5466 | /* Input mixer3 */ |
| 5467 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5468 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5469 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5470 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5471 | /* ADC1: mute amp left and right */ |
| 5472 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5473 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5474 | /* ADC2: mute amp left and right */ |
| 5475 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5476 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5477 | /* ADC3: mute amp left and right */ |
| 5478 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5479 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5480 | |
| 5481 | { } |
| 5482 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5483 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5484 | /* Macbook Pro rev3 */ |
| 5485 | static struct hda_verb alc885_mbp3_init_verbs[] = { |
| 5486 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 5487 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5488 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5489 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5490 | /* Rear mixer */ |
| 5491 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5492 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5493 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5494 | /* Front Pin: output 0 (0x0c) */ |
| 5495 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5496 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5497 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5498 | /* HP Pin: output 0 (0x0d) */ |
| 5499 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, |
| 5500 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5501 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5502 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5503 | /* Mic (rear) pin: input vref at 80% */ |
| 5504 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5505 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5506 | /* Front Mic pin: input vref at 80% */ |
| 5507 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5508 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5509 | /* Line In pin: use output 1 when in LineOut mode */ |
| 5510 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 5511 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5512 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 5513 | |
| 5514 | /* FIXME: use matrix-type input source selection */ |
| 5515 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5516 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5517 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5518 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5519 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5520 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5521 | /* Input mixer2 */ |
| 5522 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5523 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5524 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5525 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5526 | /* Input mixer3 */ |
| 5527 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5528 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5529 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5530 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 5531 | /* ADC1: mute amp left and right */ |
| 5532 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5533 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5534 | /* ADC2: mute amp left and right */ |
| 5535 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5536 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5537 | /* ADC3: mute amp left and right */ |
| 5538 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5539 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5540 | |
| 5541 | { } |
| 5542 | }; |
| 5543 | |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5544 | /* iMac 24 mixer. */ |
| 5545 | static struct snd_kcontrol_new alc885_imac24_mixer[] = { |
| 5546 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT), |
| 5547 | HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT), |
| 5548 | { } /* end */ |
| 5549 | }; |
| 5550 | |
| 5551 | /* iMac 24 init verbs. */ |
| 5552 | static struct hda_verb alc885_imac24_init_verbs[] = { |
| 5553 | /* Internal speakers: output 0 (0x0c) */ |
| 5554 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5555 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5556 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5557 | /* Internal speakers: output 0 (0x0c) */ |
| 5558 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5559 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5560 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5561 | /* Headphone: output 0 (0x0c) */ |
| 5562 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5563 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 5564 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5565 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5566 | /* Front Mic: input vref at 80% */ |
| 5567 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 5568 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 5569 | { } |
| 5570 | }; |
| 5571 | |
| 5572 | /* Toggle speaker-output according to the hp-jack state */ |
| 5573 | static void alc885_imac24_automute(struct hda_codec *codec) |
| 5574 | { |
| 5575 | unsigned int present; |
| 5576 | |
| 5577 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5578 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5579 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, |
| 5580 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5581 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, |
| 5582 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5583 | } |
| 5584 | |
| 5585 | /* Processes unsolicited events. */ |
| 5586 | static void alc885_imac24_unsol_event(struct hda_codec *codec, |
| 5587 | unsigned int res) |
| 5588 | { |
| 5589 | /* Headphone insertion or removal. */ |
| 5590 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5591 | alc885_imac24_automute(codec); |
| 5592 | } |
| 5593 | |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5594 | static void alc885_mbp3_automute(struct hda_codec *codec) |
| 5595 | { |
| 5596 | unsigned int present; |
| 5597 | |
| 5598 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 5599 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 5600 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 5601 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 5602 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 5603 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
| 5604 | |
| 5605 | } |
| 5606 | static void alc885_mbp3_unsol_event(struct hda_codec *codec, |
| 5607 | unsigned int res) |
| 5608 | { |
| 5609 | /* Headphone insertion or removal. */ |
| 5610 | if ((res >> 26) == ALC880_HP_EVENT) |
| 5611 | alc885_mbp3_automute(codec); |
| 5612 | } |
| 5613 | |
| 5614 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5615 | static struct hda_verb alc882_targa_verbs[] = { |
| 5616 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5617 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5618 | |
| 5619 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5620 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5621 | |
| 5622 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5623 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5624 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5625 | |
| 5626 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 5627 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 5628 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 5629 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 5630 | { } /* end */ |
| 5631 | }; |
| 5632 | |
| 5633 | /* toggle speaker-output according to the hp-jack state */ |
| 5634 | static void alc882_targa_automute(struct hda_codec *codec) |
| 5635 | { |
| 5636 | unsigned int present; |
| 5637 | |
| 5638 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 5639 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 5640 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 5641 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 5642 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 5643 | present ? 1 : 3); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5644 | } |
| 5645 | |
| 5646 | static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res) |
| 5647 | { |
| 5648 | /* Looks like the unsol event is incompatible with the standard |
| 5649 | * definition. 4bit tag is placed at 26 bit! |
| 5650 | */ |
| 5651 | if (((res >> 26) == ALC880_HP_EVENT)) { |
| 5652 | alc882_targa_automute(codec); |
| 5653 | } |
| 5654 | } |
| 5655 | |
| 5656 | static struct hda_verb alc882_asus_a7j_verbs[] = { |
| 5657 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5658 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5659 | |
| 5660 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5661 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5662 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5663 | |
| 5664 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5665 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5666 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5667 | |
| 5668 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5669 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5670 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5671 | { } /* end */ |
| 5672 | }; |
| 5673 | |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5674 | static struct hda_verb alc882_asus_a7m_verbs[] = { |
| 5675 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5676 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5677 | |
| 5678 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 5679 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5680 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 5681 | |
| 5682 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5683 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5684 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
| 5685 | |
| 5686 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 5687 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 5688 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 5689 | { } /* end */ |
| 5690 | }; |
| 5691 | |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5692 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 5693 | { |
| 5694 | unsigned int gpiostate, gpiomask, gpiodir; |
| 5695 | |
| 5696 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 5697 | AC_VERB_GET_GPIO_DATA, 0); |
| 5698 | |
| 5699 | if (!muted) |
| 5700 | gpiostate |= (1 << pin); |
| 5701 | else |
| 5702 | gpiostate &= ~(1 << pin); |
| 5703 | |
| 5704 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 5705 | AC_VERB_GET_GPIO_MASK, 0); |
| 5706 | gpiomask |= (1 << pin); |
| 5707 | |
| 5708 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 5709 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 5710 | gpiodir |= (1 << pin); |
| 5711 | |
| 5712 | |
| 5713 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5714 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 5715 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5716 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 5717 | |
| 5718 | msleep(1); |
| 5719 | |
| 5720 | snd_hda_codec_write(codec, codec->afg, 0, |
| 5721 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 5722 | } |
| 5723 | |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5724 | /* set up GPIO at initialization */ |
| 5725 | static void alc885_macpro_init_hook(struct hda_codec *codec) |
| 5726 | { |
| 5727 | alc882_gpio_mute(codec, 0, 0); |
| 5728 | alc882_gpio_mute(codec, 1, 0); |
| 5729 | } |
| 5730 | |
| 5731 | /* set up GPIO and update auto-muting at initialization */ |
| 5732 | static void alc885_imac24_init_hook(struct hda_codec *codec) |
| 5733 | { |
| 5734 | alc885_macpro_init_hook(codec); |
| 5735 | alc885_imac24_automute(codec); |
| 5736 | } |
| 5737 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5738 | /* |
| 5739 | * generic initialization of ADC, input mixers and output mixers |
| 5740 | */ |
| 5741 | static struct hda_verb alc882_auto_init_verbs[] = { |
| 5742 | /* |
| 5743 | * Unmute ADC0-2 and set the default input to mic-in |
| 5744 | */ |
| 5745 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5746 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5747 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5748 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5749 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 5750 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5751 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5752 | /* 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] | 5753 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 5754 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 5755 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5756 | */ |
| 5757 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5758 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 5759 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 5760 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 5761 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 5762 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5763 | |
| 5764 | /* |
| 5765 | * Set up output mixers (0x0c - 0x0f) |
| 5766 | */ |
| 5767 | /* set vol=0 to output mixers */ |
| 5768 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5769 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5770 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5771 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 5772 | /* set up input amps for analog loopback */ |
| 5773 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 5774 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5775 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5776 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5777 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5778 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5779 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5780 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5781 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5782 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 5783 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 5784 | |
| 5785 | /* FIXME: use matrix-type input source selection */ |
| 5786 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 5787 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 5788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5790 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5791 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5792 | /* Input mixer2 */ |
| 5793 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5795 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5796 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5797 | /* Input mixer3 */ |
| 5798 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 5799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 5800 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 5801 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 5802 | |
| 5803 | { } |
| 5804 | }; |
| 5805 | |
| 5806 | /* capture mixer elements */ |
| 5807 | static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { |
| 5808 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 5809 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 5810 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 5811 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 5812 | { |
| 5813 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5814 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5815 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5816 | */ |
| 5817 | /* .name = "Capture Source", */ |
| 5818 | .name = "Input Source", |
| 5819 | .count = 2, |
| 5820 | .info = alc882_mux_enum_info, |
| 5821 | .get = alc882_mux_enum_get, |
| 5822 | .put = alc882_mux_enum_put, |
| 5823 | }, |
| 5824 | { } /* end */ |
| 5825 | }; |
| 5826 | |
| 5827 | static struct snd_kcontrol_new alc882_capture_mixer[] = { |
| 5828 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 5829 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 5830 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), |
| 5831 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), |
| 5832 | HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), |
| 5833 | HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), |
| 5834 | { |
| 5835 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 5836 | /* The multiple "Capture Source" controls confuse alsamixer |
| 5837 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5838 | */ |
| 5839 | /* .name = "Capture Source", */ |
| 5840 | .name = "Input Source", |
| 5841 | .count = 3, |
| 5842 | .info = alc882_mux_enum_info, |
| 5843 | .get = alc882_mux_enum_get, |
| 5844 | .put = alc882_mux_enum_put, |
| 5845 | }, |
| 5846 | { } /* end */ |
| 5847 | }; |
| 5848 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 5849 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 5850 | #define alc882_loopbacks alc880_loopbacks |
| 5851 | #endif |
| 5852 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5853 | /* pcm configuration: identiacal with ALC880 */ |
| 5854 | #define alc882_pcm_analog_playback alc880_pcm_analog_playback |
| 5855 | #define alc882_pcm_analog_capture alc880_pcm_analog_capture |
| 5856 | #define alc882_pcm_digital_playback alc880_pcm_digital_playback |
| 5857 | #define alc882_pcm_digital_capture alc880_pcm_digital_capture |
| 5858 | |
| 5859 | /* |
| 5860 | * configuration and preset |
| 5861 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5862 | static const char *alc882_models[ALC882_MODEL_LAST] = { |
| 5863 | [ALC882_3ST_DIG] = "3stack-dig", |
| 5864 | [ALC882_6ST_DIG] = "6stack-dig", |
| 5865 | [ALC882_ARIMA] = "arima", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5866 | [ALC882_W2JC] = "w2jc", |
Takashi Iwai | 0438a00 | 2007-09-06 14:54:11 +0200 | [diff] [blame] | 5867 | [ALC882_TARGA] = "targa", |
| 5868 | [ALC882_ASUS_A7J] = "asus-a7j", |
| 5869 | [ALC882_ASUS_A7M] = "asus-a7m", |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5870 | [ALC885_MACPRO] = "macpro", |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5871 | [ALC885_MBP3] = "mbp3", |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5872 | [ALC885_IMAC24] = "imac24", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 5873 | [ALC882_AUTO] = "auto", |
| 5874 | }; |
| 5875 | |
| 5876 | static struct snd_pci_quirk alc882_cfg_tbl[] = { |
| 5877 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5878 | SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J), |
Kailang Yang | ac8842a | 2007-09-20 12:51:39 +0200 | [diff] [blame] | 5879 | SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J), |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 5880 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5881 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC), |
Claudio Matsuoka | c5d9f1c | 2007-07-19 23:18:32 +0200 | [diff] [blame] | 5882 | SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG), |
Tobin Davis | 7b9470d | 2006-12-28 13:56:48 +0100 | [diff] [blame] | 5883 | SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5884 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), |
Jiang zhe | 4444704 | 2008-01-28 12:28:24 +0100 | [diff] [blame] | 5885 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 5886 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
| 5887 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
| 5888 | SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5889 | {} |
| 5890 | }; |
| 5891 | |
| 5892 | static struct alc_config_preset alc882_presets[] = { |
| 5893 | [ALC882_3ST_DIG] = { |
| 5894 | .mixers = { alc882_base_mixer }, |
| 5895 | .init_verbs = { alc882_init_verbs }, |
| 5896 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5897 | .dac_nids = alc882_dac_nids, |
| 5898 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5899 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5900 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5901 | .channel_mode = alc882_ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 5902 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5903 | .input_mux = &alc882_capture_source, |
| 5904 | }, |
| 5905 | [ALC882_6ST_DIG] = { |
| 5906 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5907 | .init_verbs = { alc882_init_verbs }, |
| 5908 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5909 | .dac_nids = alc882_dac_nids, |
| 5910 | .dig_out_nid = ALC882_DIGOUT_NID, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 5911 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5912 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5913 | .channel_mode = alc882_sixstack_modes, |
| 5914 | .input_mux = &alc882_capture_source, |
| 5915 | }, |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 5916 | [ALC882_ARIMA] = { |
| 5917 | .mixers = { alc882_base_mixer, alc882_chmode_mixer }, |
| 5918 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, |
| 5919 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5920 | .dac_nids = alc882_dac_nids, |
| 5921 | .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), |
| 5922 | .channel_mode = alc882_sixstack_modes, |
| 5923 | .input_mux = &alc882_capture_source, |
| 5924 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 5925 | [ALC882_W2JC] = { |
| 5926 | .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer }, |
| 5927 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 5928 | alc880_gpio1_init_verbs }, |
| 5929 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5930 | .dac_nids = alc882_dac_nids, |
| 5931 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 5932 | .channel_mode = alc880_threestack_modes, |
| 5933 | .need_dac_fix = 1, |
| 5934 | .input_mux = &alc882_capture_source, |
| 5935 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5936 | }, |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 5937 | [ALC885_MBP3] = { |
| 5938 | .mixers = { alc885_mbp3_mixer, alc882_chmode_mixer }, |
| 5939 | .init_verbs = { alc885_mbp3_init_verbs, |
| 5940 | alc880_gpio1_init_verbs }, |
| 5941 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5942 | .dac_nids = alc882_dac_nids, |
| 5943 | .channel_mode = alc885_mbp_6ch_modes, |
| 5944 | .num_channel_mode = ARRAY_SIZE(alc885_mbp_6ch_modes), |
| 5945 | .input_mux = &alc882_capture_source, |
| 5946 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5947 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5948 | .unsol_event = alc885_mbp3_unsol_event, |
| 5949 | .init_hook = alc885_mbp3_automute, |
| 5950 | }, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5951 | [ALC885_MACPRO] = { |
| 5952 | .mixers = { alc882_macpro_mixer }, |
| 5953 | .init_verbs = { alc882_macpro_init_verbs }, |
| 5954 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5955 | .dac_nids = alc882_dac_nids, |
| 5956 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5957 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5958 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5959 | .channel_mode = alc882_ch_modes, |
| 5960 | .input_mux = &alc882_capture_source, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5961 | .init_hook = alc885_macpro_init_hook, |
Tobin Davis | 9102cd1 | 2006-12-15 10:02:12 +0100 | [diff] [blame] | 5962 | }, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5963 | [ALC885_IMAC24] = { |
| 5964 | .mixers = { alc885_imac24_mixer }, |
| 5965 | .init_verbs = { alc885_imac24_init_verbs }, |
| 5966 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5967 | .dac_nids = alc882_dac_nids, |
| 5968 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5969 | .dig_in_nid = ALC882_DIGIN_NID, |
| 5970 | .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), |
| 5971 | .channel_mode = alc882_ch_modes, |
| 5972 | .input_mux = &alc882_capture_source, |
| 5973 | .unsol_event = alc885_imac24_unsol_event, |
Takashi Iwai | 7debbe5 | 2007-08-16 15:01:03 +0200 | [diff] [blame] | 5974 | .init_hook = alc885_imac24_init_hook, |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 5975 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 5976 | [ALC882_TARGA] = { |
| 5977 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer, |
| 5978 | alc882_capture_mixer }, |
| 5979 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, |
| 5980 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5981 | .dac_nids = alc882_dac_nids, |
| 5982 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5983 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 5984 | .adc_nids = alc882_adc_nids, |
| 5985 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 5986 | .channel_mode = alc882_3ST_6ch_modes, |
| 5987 | .need_dac_fix = 1, |
| 5988 | .input_mux = &alc882_capture_source, |
| 5989 | .unsol_event = alc882_targa_unsol_event, |
| 5990 | .init_hook = alc882_targa_automute, |
| 5991 | }, |
| 5992 | [ALC882_ASUS_A7J] = { |
| 5993 | .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer, |
| 5994 | alc882_capture_mixer }, |
| 5995 | .init_verbs = { alc882_init_verbs, alc882_asus_a7j_verbs}, |
| 5996 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 5997 | .dac_nids = alc882_dac_nids, |
| 5998 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 5999 | .num_adc_nids = ARRAY_SIZE(alc882_adc_nids), |
| 6000 | .adc_nids = alc882_adc_nids, |
| 6001 | .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes), |
| 6002 | .channel_mode = alc882_3ST_6ch_modes, |
| 6003 | .need_dac_fix = 1, |
| 6004 | .input_mux = &alc882_capture_source, |
| 6005 | }, |
Takashi Iwai | 914759b | 2007-09-06 14:52:04 +0200 | [diff] [blame] | 6006 | [ALC882_ASUS_A7M] = { |
| 6007 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
| 6008 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
| 6009 | alc880_gpio1_init_verbs, |
| 6010 | alc882_asus_a7m_verbs }, |
| 6011 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
| 6012 | .dac_nids = alc882_dac_nids, |
| 6013 | .dig_out_nid = ALC882_DIGOUT_NID, |
| 6014 | .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), |
| 6015 | .channel_mode = alc880_threestack_modes, |
| 6016 | .need_dac_fix = 1, |
| 6017 | .input_mux = &alc882_capture_source, |
| 6018 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6019 | }; |
| 6020 | |
| 6021 | |
| 6022 | /* |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6023 | * Pin config fixes |
| 6024 | */ |
| 6025 | enum { |
| 6026 | PINFIX_ABIT_AW9D_MAX |
| 6027 | }; |
| 6028 | |
| 6029 | static struct alc_pincfg alc882_abit_aw9d_pinfix[] = { |
| 6030 | { 0x15, 0x01080104 }, /* side */ |
| 6031 | { 0x16, 0x01011012 }, /* rear */ |
| 6032 | { 0x17, 0x01016011 }, /* clfe */ |
| 6033 | { } |
| 6034 | }; |
| 6035 | |
| 6036 | static const struct alc_pincfg *alc882_pin_fixes[] = { |
| 6037 | [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, |
| 6038 | }; |
| 6039 | |
| 6040 | static struct snd_pci_quirk alc882_pinfix_tbl[] = { |
| 6041 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), |
| 6042 | {} |
| 6043 | }; |
| 6044 | |
| 6045 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6046 | * BIOS auto configuration |
| 6047 | */ |
| 6048 | static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, |
| 6049 | hda_nid_t nid, int pin_type, |
| 6050 | int dac_idx) |
| 6051 | { |
| 6052 | /* set as output */ |
| 6053 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6054 | int idx; |
| 6055 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6056 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 6057 | idx = 4; |
| 6058 | else |
| 6059 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 6060 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6061 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6062 | pin_type); |
| 6063 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 6064 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6065 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 6066 | |
| 6067 | } |
| 6068 | |
| 6069 | static void alc882_auto_init_multi_out(struct hda_codec *codec) |
| 6070 | { |
| 6071 | struct alc_spec *spec = codec->spec; |
| 6072 | int i; |
| 6073 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6074 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6075 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6076 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6077 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6078 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 6079 | alc882_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6080 | i); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6081 | } |
| 6082 | } |
| 6083 | |
| 6084 | static void alc882_auto_init_hp_out(struct hda_codec *codec) |
| 6085 | { |
| 6086 | struct alc_spec *spec = codec->spec; |
| 6087 | hda_nid_t pin; |
| 6088 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 6089 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6090 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6091 | /* use dac 0 */ |
| 6092 | alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6093 | } |
| 6094 | |
| 6095 | #define alc882_is_input_pin(nid) alc880_is_input_pin(nid) |
| 6096 | #define ALC882_PIN_CD_NID ALC880_PIN_CD_NID |
| 6097 | |
| 6098 | static void alc882_auto_init_analog_input(struct hda_codec *codec) |
| 6099 | { |
| 6100 | struct alc_spec *spec = codec->spec; |
| 6101 | int i; |
| 6102 | |
| 6103 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 6104 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 6105 | if (alc882_is_input_pin(nid)) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6106 | snd_hda_codec_write(codec, nid, 0, |
| 6107 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 6108 | i <= AUTO_PIN_FRONT_MIC ? |
| 6109 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6110 | if (nid != ALC882_PIN_CD_NID) |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6111 | snd_hda_codec_write(codec, nid, 0, |
| 6112 | AC_VERB_SET_AMP_GAIN_MUTE, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6113 | AMP_OUT_MUTE); |
| 6114 | } |
| 6115 | } |
| 6116 | } |
| 6117 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6118 | /* add mic boosts if needed */ |
| 6119 | static int alc_auto_add_mic_boost(struct hda_codec *codec) |
| 6120 | { |
| 6121 | struct alc_spec *spec = codec->spec; |
| 6122 | int err; |
| 6123 | hda_nid_t nid; |
| 6124 | |
| 6125 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6126 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6127 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6128 | "Mic Boost", |
| 6129 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6130 | if (err < 0) |
| 6131 | return err; |
| 6132 | } |
| 6133 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; |
Takashi Iwai | ce22e03 | 2008-01-11 17:38:35 +0100 | [diff] [blame] | 6134 | if (nid && (get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) { |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6135 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 6136 | "Front Mic Boost", |
| 6137 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 6138 | if (err < 0) |
| 6139 | return err; |
| 6140 | } |
| 6141 | return 0; |
| 6142 | } |
| 6143 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6144 | /* almost identical with ALC880 parser... */ |
| 6145 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 6146 | { |
| 6147 | struct alc_spec *spec = codec->spec; |
| 6148 | int err = alc880_parse_auto_config(codec); |
| 6149 | |
| 6150 | if (err < 0) |
| 6151 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 6152 | else if (!err) |
| 6153 | return 0; /* no config found */ |
| 6154 | |
| 6155 | err = alc_auto_add_mic_boost(codec); |
| 6156 | if (err < 0) |
| 6157 | return err; |
| 6158 | |
| 6159 | /* hack - override the init verbs */ |
| 6160 | spec->init_verbs[0] = alc882_auto_init_verbs; |
| 6161 | |
| 6162 | return 1; /* config found */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6163 | } |
| 6164 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6165 | /* additional initialization for auto-configuration model */ |
| 6166 | static void alc882_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6167 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6168 | alc882_auto_init_multi_out(codec); |
| 6169 | alc882_auto_init_hp_out(codec); |
| 6170 | alc882_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6171 | } |
| 6172 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6173 | static int patch_alc882(struct hda_codec *codec) |
| 6174 | { |
| 6175 | struct alc_spec *spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6176 | int err, board_config; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6177 | |
Takashi Iwai | e560d8d | 2005-09-09 14:21:46 +0200 | [diff] [blame] | 6178 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6179 | if (spec == NULL) |
| 6180 | return -ENOMEM; |
| 6181 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6182 | codec->spec = spec; |
| 6183 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 6184 | board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, |
| 6185 | alc882_models, |
| 6186 | alc882_cfg_tbl); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6187 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6188 | if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6189 | /* Pick up systems that don't supply PCI SSID */ |
| 6190 | switch (codec->subsystem_id) { |
| 6191 | case 0x106b0c00: /* Mac Pro */ |
| 6192 | board_config = ALC885_MACPRO; |
| 6193 | break; |
Nicola Fagnani | c54728d | 2007-07-19 23:28:52 +0200 | [diff] [blame] | 6194 | case 0x106b1000: /* iMac 24 */ |
| 6195 | board_config = ALC885_IMAC24; |
| 6196 | break; |
Jiang zhe | 3d5fa2e | 2008-01-10 13:05:47 +0100 | [diff] [blame] | 6197 | case 0x106b00a1: /* Macbook */ |
Takashi Iwai | 87350ad | 2007-08-16 18:19:38 +0200 | [diff] [blame] | 6198 | case 0x106b2c00: /* Macbook Pro rev3 */ |
| 6199 | board_config = ALC885_MBP3; |
| 6200 | break; |
Tobin Davis | 081d17c | 2007-02-15 17:46:18 +0100 | [diff] [blame] | 6201 | default: |
| 6202 | printk(KERN_INFO "hda_codec: Unknown model for ALC882, " |
| 6203 | "trying auto-probe from BIOS...\n"); |
| 6204 | board_config = ALC882_AUTO; |
| 6205 | } |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6206 | } |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 6207 | |
Takashi Iwai | f95474e | 2007-07-10 00:47:43 +0200 | [diff] [blame] | 6208 | alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); |
| 6209 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6210 | if (board_config == ALC882_AUTO) { |
| 6211 | /* automatic parse from the BIOS config */ |
| 6212 | err = alc882_parse_auto_config(codec); |
| 6213 | if (err < 0) { |
| 6214 | alc_free(codec); |
| 6215 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6216 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6217 | printk(KERN_INFO |
| 6218 | "hda_codec: Cannot set up configuration " |
| 6219 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6220 | board_config = ALC882_3ST_DIG; |
| 6221 | } |
| 6222 | } |
| 6223 | |
| 6224 | if (board_config != ALC882_AUTO) |
| 6225 | setup_preset(spec, &alc882_presets[board_config]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6226 | |
| 6227 | spec->stream_name_analog = "ALC882 Analog"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6228 | spec->stream_analog_playback = &alc882_pcm_analog_playback; |
| 6229 | spec->stream_analog_capture = &alc882_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 6230 | /* FIXME: setup DAC5 */ |
| 6231 | /*spec->stream_analog_alt_playback = &alc880_pcm_analog_alt_playback;*/ |
| 6232 | spec->stream_analog_alt_capture = &alc880_pcm_analog_alt_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6233 | |
| 6234 | spec->stream_name_digital = "ALC882 Digital"; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6235 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
| 6236 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6237 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6238 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6239 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 6240 | unsigned int wcap = get_wcaps(codec, 0x07); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6241 | /* get type */ |
| 6242 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6243 | if (wcap != AC_WID_AUD_IN) { |
| 6244 | spec->adc_nids = alc882_adc_nids_alt; |
| 6245 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6246 | spec->mixers[spec->num_mixers] = |
| 6247 | alc882_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6248 | spec->num_mixers++; |
| 6249 | } else { |
| 6250 | spec->adc_nids = alc882_adc_nids; |
| 6251 | spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); |
| 6252 | spec->mixers[spec->num_mixers] = alc882_capture_mixer; |
| 6253 | spec->num_mixers++; |
| 6254 | } |
| 6255 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6256 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 6257 | spec->vmaster_nid = 0x0c; |
| 6258 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6259 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6260 | if (board_config == ALC882_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 6261 | spec->init_hook = alc882_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6262 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 6263 | if (!spec->loopback.amplist) |
| 6264 | spec->loopback.amplist = alc882_loopbacks; |
| 6265 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6266 | |
| 6267 | return 0; |
| 6268 | } |
| 6269 | |
| 6270 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6271 | * ALC883 support |
| 6272 | * |
| 6273 | * ALC883 is almost identical with ALC880 but has cleaner and more flexible |
| 6274 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 6275 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 6276 | * 6-channel independent captures. |
| 6277 | * |
| 6278 | * In addition, an independent DAC for the multi-playback (not used in this |
| 6279 | * driver yet). |
| 6280 | */ |
| 6281 | #define ALC883_DIGOUT_NID 0x06 |
| 6282 | #define ALC883_DIGIN_NID 0x0a |
| 6283 | |
| 6284 | static hda_nid_t alc883_dac_nids[4] = { |
| 6285 | /* front, rear, clfe, rear_surr */ |
| 6286 | 0x02, 0x04, 0x03, 0x05 |
| 6287 | }; |
| 6288 | |
| 6289 | static hda_nid_t alc883_adc_nids[2] = { |
| 6290 | /* ADC1-2 */ |
| 6291 | 0x08, 0x09, |
| 6292 | }; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6293 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6294 | /* input MUX */ |
| 6295 | /* FIXME: should be a matrix-type input source selection */ |
| 6296 | |
| 6297 | static struct hda_input_mux alc883_capture_source = { |
| 6298 | .num_items = 4, |
| 6299 | .items = { |
| 6300 | { "Mic", 0x0 }, |
| 6301 | { "Front Mic", 0x1 }, |
| 6302 | { "Line", 0x2 }, |
| 6303 | { "CD", 0x4 }, |
| 6304 | }, |
| 6305 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6306 | |
| 6307 | static struct hda_input_mux alc883_lenovo_101e_capture_source = { |
| 6308 | .num_items = 2, |
| 6309 | .items = { |
| 6310 | { "Mic", 0x1 }, |
| 6311 | { "Line", 0x2 }, |
| 6312 | }, |
| 6313 | }; |
| 6314 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6315 | static struct hda_input_mux alc883_lenovo_nb0763_capture_source = { |
| 6316 | .num_items = 4, |
| 6317 | .items = { |
| 6318 | { "Mic", 0x0 }, |
| 6319 | { "iMic", 0x1 }, |
| 6320 | { "Line", 0x2 }, |
| 6321 | { "CD", 0x4 }, |
| 6322 | }, |
| 6323 | }; |
| 6324 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6325 | #define alc883_mux_enum_info alc_mux_enum_info |
| 6326 | #define alc883_mux_enum_get alc_mux_enum_get |
| 6327 | |
| 6328 | static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 6329 | struct snd_ctl_elem_value *ucontrol) |
| 6330 | { |
| 6331 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 6332 | struct alc_spec *spec = codec->spec; |
| 6333 | const struct hda_input_mux *imux = spec->input_mux; |
| 6334 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 6335 | static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; |
| 6336 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 6337 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 6338 | unsigned int i, idx; |
| 6339 | |
| 6340 | idx = ucontrol->value.enumerated.item[0]; |
| 6341 | if (idx >= imux->num_items) |
| 6342 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6343 | if (*cur_val == idx) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6344 | return 0; |
| 6345 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6346 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 6347 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 6348 | imux->items[i].index, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 6349 | HDA_AMP_MUTE, v); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6350 | } |
| 6351 | *cur_val = idx; |
| 6352 | return 1; |
| 6353 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6354 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6355 | /* |
| 6356 | * 2ch mode |
| 6357 | */ |
| 6358 | static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { |
| 6359 | { 2, NULL } |
| 6360 | }; |
| 6361 | |
| 6362 | /* |
| 6363 | * 2ch mode |
| 6364 | */ |
| 6365 | static struct hda_verb alc883_3ST_ch2_init[] = { |
| 6366 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6367 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6368 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 6369 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6370 | { } /* end */ |
| 6371 | }; |
| 6372 | |
| 6373 | /* |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6374 | * 4ch mode |
| 6375 | */ |
| 6376 | static struct hda_verb alc883_3ST_ch4_init[] = { |
| 6377 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 6378 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 6379 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6380 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6381 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6382 | { } /* end */ |
| 6383 | }; |
| 6384 | |
| 6385 | /* |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6386 | * 6ch mode |
| 6387 | */ |
| 6388 | static struct hda_verb alc883_3ST_ch6_init[] = { |
| 6389 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6390 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6391 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 6392 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6393 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 6394 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 6395 | { } /* end */ |
| 6396 | }; |
| 6397 | |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6398 | static struct hda_channel_mode alc883_3ST_6ch_modes[3] = { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6399 | { 2, alc883_3ST_ch2_init }, |
Tobin Davis | b201131 | 2007-09-17 12:45:11 +0200 | [diff] [blame] | 6400 | { 4, alc883_3ST_ch4_init }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6401 | { 6, alc883_3ST_ch6_init }, |
| 6402 | }; |
| 6403 | |
| 6404 | /* |
| 6405 | * 6ch mode |
| 6406 | */ |
| 6407 | static struct hda_verb alc883_sixstack_ch6_init[] = { |
| 6408 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 6409 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6410 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6411 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6412 | { } /* end */ |
| 6413 | }; |
| 6414 | |
| 6415 | /* |
| 6416 | * 8ch mode |
| 6417 | */ |
| 6418 | static struct hda_verb alc883_sixstack_ch8_init[] = { |
| 6419 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6420 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6421 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6422 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 6423 | { } /* end */ |
| 6424 | }; |
| 6425 | |
| 6426 | static struct hda_channel_mode alc883_sixstack_modes[2] = { |
| 6427 | { 6, alc883_sixstack_ch6_init }, |
| 6428 | { 8, alc883_sixstack_ch8_init }, |
| 6429 | }; |
| 6430 | |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 6431 | static struct hda_verb alc883_medion_eapd_verbs[] = { |
| 6432 | /* eanable EAPD on medion laptop */ |
| 6433 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 6434 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 6435 | { } |
| 6436 | }; |
| 6437 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6438 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 6439 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 6440 | */ |
| 6441 | |
| 6442 | static struct snd_kcontrol_new alc883_base_mixer[] = { |
| 6443 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6444 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6445 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6446 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6447 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6448 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6449 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6450 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6451 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6452 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6453 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6454 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6455 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6456 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6457 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6458 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6459 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6460 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6461 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6462 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6463 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6464 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6465 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6466 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6467 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6468 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6469 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6470 | { |
| 6471 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6472 | /* .name = "Capture Source", */ |
| 6473 | .name = "Input Source", |
| 6474 | .count = 2, |
| 6475 | .info = alc883_mux_enum_info, |
| 6476 | .get = alc883_mux_enum_get, |
| 6477 | .put = alc883_mux_enum_put, |
| 6478 | }, |
| 6479 | { } /* end */ |
| 6480 | }; |
| 6481 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6482 | static struct snd_kcontrol_new alc883_mitac_mixer[] = { |
| 6483 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6484 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6485 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6486 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6487 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6488 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6489 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6490 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6491 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6492 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6493 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6494 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6495 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6496 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6497 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6498 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6499 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6500 | { |
| 6501 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6502 | /* .name = "Capture Source", */ |
| 6503 | .name = "Input Source", |
| 6504 | .count = 2, |
| 6505 | .info = alc883_mux_enum_info, |
| 6506 | .get = alc883_mux_enum_get, |
| 6507 | .put = alc883_mux_enum_put, |
| 6508 | }, |
| 6509 | { } /* end */ |
| 6510 | }; |
| 6511 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6512 | static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { |
| 6513 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6514 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6515 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6516 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6517 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6518 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6519 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6520 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6521 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6523 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6524 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6525 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6526 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6527 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6528 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6529 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6530 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6531 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6532 | { |
| 6533 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6534 | /* .name = "Capture Source", */ |
| 6535 | .name = "Input Source", |
| 6536 | .count = 2, |
| 6537 | .info = alc883_mux_enum_info, |
| 6538 | .get = alc883_mux_enum_get, |
| 6539 | .put = alc883_mux_enum_put, |
| 6540 | }, |
| 6541 | { } /* end */ |
| 6542 | }; |
| 6543 | |
| 6544 | static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { |
| 6545 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6546 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6547 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6548 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6549 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6550 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6551 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6552 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6553 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6554 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6555 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6556 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6557 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6558 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6559 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6560 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6561 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6562 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6563 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6564 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6565 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6566 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6567 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6568 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6569 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6570 | { |
| 6571 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6572 | /* .name = "Capture Source", */ |
| 6573 | .name = "Input Source", |
| 6574 | .count = 2, |
| 6575 | .info = alc883_mux_enum_info, |
| 6576 | .get = alc883_mux_enum_get, |
| 6577 | .put = alc883_mux_enum_put, |
| 6578 | }, |
| 6579 | { } /* end */ |
| 6580 | }; |
| 6581 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 6582 | static struct snd_kcontrol_new alc883_fivestack_mixer[] = { |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6583 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6584 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6585 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6586 | HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6587 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6588 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6589 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), |
| 6590 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 6591 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6592 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6593 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6594 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6595 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6596 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6597 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6598 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6599 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6600 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 6601 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6602 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6603 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6604 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6605 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6606 | |
| 6607 | { |
| 6608 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6609 | /* .name = "Capture Source", */ |
| 6610 | .name = "Input Source", |
| 6611 | .count = 1, |
| 6612 | .info = alc883_mux_enum_info, |
| 6613 | .get = alc883_mux_enum_get, |
| 6614 | .put = alc883_mux_enum_put, |
| 6615 | }, |
| 6616 | { } /* end */ |
| 6617 | }; |
| 6618 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6619 | static struct snd_kcontrol_new alc883_tagra_mixer[] = { |
| 6620 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6622 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6623 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6624 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 6625 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), |
| 6626 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 6627 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 6628 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 6629 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6630 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6631 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6632 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6633 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6634 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6635 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6636 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6637 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6638 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6639 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6640 | { |
| 6641 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6642 | /* .name = "Capture Source", */ |
| 6643 | .name = "Input Source", |
| 6644 | .count = 2, |
| 6645 | .info = alc883_mux_enum_info, |
| 6646 | .get = alc883_mux_enum_get, |
| 6647 | .put = alc883_mux_enum_put, |
| 6648 | }, |
| 6649 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6650 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6651 | |
| 6652 | static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { |
| 6653 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6654 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6655 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6656 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6657 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6658 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
Thomas De Schampheleire | 3236041 | 2007-01-24 16:13:35 +0100 | [diff] [blame] | 6659 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6660 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6661 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6662 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6663 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6664 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6665 | { |
| 6666 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6667 | /* .name = "Capture Source", */ |
| 6668 | .name = "Input Source", |
| 6669 | .count = 2, |
| 6670 | .info = alc883_mux_enum_info, |
| 6671 | .get = alc883_mux_enum_get, |
| 6672 | .put = alc883_mux_enum_put, |
| 6673 | }, |
| 6674 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6675 | }; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 6676 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6677 | static struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = { |
| 6678 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6679 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 6680 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 6681 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6682 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6683 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6684 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6685 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6686 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6687 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6688 | { |
| 6689 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6690 | /* .name = "Capture Source", */ |
| 6691 | .name = "Input Source", |
| 6692 | .count = 1, |
| 6693 | .info = alc883_mux_enum_info, |
| 6694 | .get = alc883_mux_enum_get, |
| 6695 | .put = alc883_mux_enum_put, |
| 6696 | }, |
| 6697 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 6698 | }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 6699 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 6700 | static struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = { |
| 6701 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6702 | HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6703 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6704 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6705 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6706 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6707 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6708 | HDA_CODEC_VOLUME("iMic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6709 | HDA_CODEC_MUTE("iMic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6710 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6711 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6712 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6713 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6714 | { |
| 6715 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6716 | /* .name = "Capture Source", */ |
| 6717 | .name = "Input Source", |
| 6718 | .count = 2, |
| 6719 | .info = alc883_mux_enum_info, |
| 6720 | .get = alc883_mux_enum_get, |
| 6721 | .put = alc883_mux_enum_put, |
| 6722 | }, |
| 6723 | { } /* end */ |
| 6724 | }; |
| 6725 | |
| 6726 | static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { |
| 6727 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6728 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 6729 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 6730 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6731 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6732 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6733 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6734 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6735 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6736 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6737 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6738 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6739 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6740 | { |
| 6741 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6742 | /* .name = "Capture Source", */ |
| 6743 | .name = "Input Source", |
| 6744 | .count = 2, |
| 6745 | .info = alc883_mux_enum_info, |
| 6746 | .get = alc883_mux_enum_get, |
| 6747 | .put = alc883_mux_enum_put, |
| 6748 | }, |
| 6749 | { } /* end */ |
| 6750 | }; |
| 6751 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6752 | static struct snd_kcontrol_new alc888_6st_hp_mixer[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 6753 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6754 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6755 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6756 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6757 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6758 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6759 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6760 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6761 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6762 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6763 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 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), |
| 6769 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6770 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6771 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6772 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6773 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6774 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6775 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6776 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6777 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6778 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6779 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6780 | { |
| 6781 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6782 | /* .name = "Capture Source", */ |
| 6783 | .name = "Input Source", |
| 6784 | .count = 2, |
| 6785 | .info = alc883_mux_enum_info, |
| 6786 | .get = alc883_mux_enum_get, |
| 6787 | .put = alc883_mux_enum_put, |
| 6788 | }, |
| 6789 | { } /* end */ |
| 6790 | }; |
| 6791 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 6792 | static struct snd_kcontrol_new alc888_3st_hp_mixer[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 6793 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6794 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6795 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6796 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6797 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6798 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6799 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6800 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6801 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6802 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6803 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6804 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6805 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6806 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6807 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6808 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6809 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6810 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6811 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6812 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6813 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6814 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6815 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6816 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6817 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6818 | { |
| 6819 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6820 | /* .name = "Capture Source", */ |
| 6821 | .name = "Input Source", |
| 6822 | .count = 2, |
| 6823 | .info = alc883_mux_enum_info, |
| 6824 | .get = alc883_mux_enum_get, |
| 6825 | .put = alc883_mux_enum_put, |
| 6826 | }, |
| 6827 | { } /* end */ |
| 6828 | }; |
| 6829 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 6830 | static struct snd_kcontrol_new alc888_6st_dell_mixer[] = { |
| 6831 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6832 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 6833 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 6834 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), |
| 6835 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), |
| 6836 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), |
| 6837 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), |
| 6838 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), |
| 6839 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), |
| 6840 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 6841 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 6842 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 6843 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 6844 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6845 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 6846 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6847 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6848 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 6849 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 6850 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 6851 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 6852 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 6853 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 6854 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6855 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6856 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6857 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6858 | { |
| 6859 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6860 | /* .name = "Capture Source", */ |
| 6861 | .name = "Input Source", |
| 6862 | .count = 2, |
| 6863 | .info = alc883_mux_enum_info, |
| 6864 | .get = alc883_mux_enum_get, |
| 6865 | .put = alc883_mux_enum_put, |
| 6866 | }, |
| 6867 | { } /* end */ |
| 6868 | }; |
| 6869 | |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6870 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6871 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 6872 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6873 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6874 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 6875 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6876 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 6877 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 6878 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6879 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 6880 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 6881 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 6882 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 6883 | { |
| 6884 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6885 | /* .name = "Capture Source", */ |
| 6886 | .name = "Input Source", |
| 6887 | .count = 2, |
| 6888 | .info = alc883_mux_enum_info, |
| 6889 | .get = alc883_mux_enum_get, |
| 6890 | .put = alc883_mux_enum_put, |
| 6891 | }, |
| 6892 | { } /* end */ |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 6893 | }; |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 6894 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6895 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
| 6896 | { |
| 6897 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 6898 | .name = "Channel Mode", |
| 6899 | .info = alc_ch_mode_info, |
| 6900 | .get = alc_ch_mode_get, |
| 6901 | .put = alc_ch_mode_put, |
| 6902 | }, |
| 6903 | { } /* end */ |
| 6904 | }; |
| 6905 | |
| 6906 | static struct hda_verb alc883_init_verbs[] = { |
| 6907 | /* ADC1: mute amp left and right */ |
| 6908 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6909 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6910 | /* ADC2: mute amp left and right */ |
| 6911 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6912 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6913 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 6914 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6915 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6916 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6917 | /* Rear mixer */ |
| 6918 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6921 | /* CLFE mixer */ |
| 6922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6923 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6924 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6925 | /* Side mixer */ |
| 6926 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 6927 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6928 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6929 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 6930 | /* mute analog input loopbacks */ |
| 6931 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 6932 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 6933 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 6934 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 6935 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 6936 | |
| 6937 | /* Front Pin: output 0 (0x0c) */ |
| 6938 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6939 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6940 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6941 | /* Rear Pin: output 1 (0x0d) */ |
| 6942 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6943 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6944 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 6945 | /* CLFE Pin: output 2 (0x0e) */ |
| 6946 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6947 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6948 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 6949 | /* Side Pin: output 3 (0x0f) */ |
| 6950 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 6951 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6952 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 6953 | /* Mic (rear) pin: input vref at 80% */ |
| 6954 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6955 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6956 | /* Front Mic pin: input vref at 80% */ |
| 6957 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 6958 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6959 | /* Line In pin: input */ |
| 6960 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6961 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 6962 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 6963 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 6964 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 6965 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 6966 | /* CD pin widget for input */ |
| 6967 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 6968 | |
| 6969 | /* FIXME: use matrix-type input source selection */ |
| 6970 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 6971 | /* Input mixer2 */ |
| 6972 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6973 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6974 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6975 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6976 | /* Input mixer3 */ |
| 6977 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 6978 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 6979 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 6980 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 6981 | { } |
| 6982 | }; |
| 6983 | |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 6984 | /* toggle speaker-output according to the hp-jack state */ |
| 6985 | static void alc883_mitac_hp_automute(struct hda_codec *codec) |
| 6986 | { |
| 6987 | unsigned int present; |
| 6988 | |
| 6989 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 6990 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 6991 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 6992 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6993 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 6994 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 6995 | } |
| 6996 | |
| 6997 | /* auto-toggle front mic */ |
| 6998 | /* |
| 6999 | static void alc883_mitac_mic_automute(struct hda_codec *codec) |
| 7000 | { |
| 7001 | unsigned int present; |
| 7002 | unsigned char bits; |
| 7003 | |
| 7004 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 7005 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7006 | bits = present ? HDA_AMP_MUTE : 0; |
| 7007 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits); |
| 7008 | } |
| 7009 | */ |
| 7010 | |
| 7011 | static void alc883_mitac_automute(struct hda_codec *codec) |
| 7012 | { |
| 7013 | alc883_mitac_hp_automute(codec); |
| 7014 | /* alc883_mitac_mic_automute(codec); */ |
| 7015 | } |
| 7016 | |
| 7017 | static void alc883_mitac_unsol_event(struct hda_codec *codec, |
| 7018 | unsigned int res) |
| 7019 | { |
| 7020 | switch (res >> 26) { |
| 7021 | case ALC880_HP_EVENT: |
| 7022 | alc883_mitac_hp_automute(codec); |
| 7023 | break; |
| 7024 | case ALC880_MIC_EVENT: |
| 7025 | /* alc883_mitac_mic_automute(codec); */ |
| 7026 | break; |
| 7027 | } |
| 7028 | } |
| 7029 | |
| 7030 | static struct hda_verb alc883_mitac_verbs[] = { |
| 7031 | /* HP */ |
| 7032 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7033 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7034 | /* Subwoofer */ |
| 7035 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 7036 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7037 | |
| 7038 | /* enable unsolicited event */ |
| 7039 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7040 | /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, */ |
| 7041 | |
| 7042 | { } /* end */ |
| 7043 | }; |
| 7044 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7045 | static struct hda_verb alc883_tagra_verbs[] = { |
| 7046 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7047 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7048 | |
| 7049 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7051 | |
| 7052 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
| 7053 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
| 7054 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
| 7055 | |
| 7056 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7057 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 7058 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 7059 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7060 | |
| 7061 | { } /* end */ |
| 7062 | }; |
| 7063 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7064 | static struct hda_verb alc883_lenovo_101e_verbs[] = { |
| 7065 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7066 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT|AC_USRSP_EN}, |
| 7067 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT|AC_USRSP_EN}, |
| 7068 | { } /* end */ |
| 7069 | }; |
| 7070 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7071 | static struct hda_verb alc883_lenovo_nb0763_verbs[] = { |
| 7072 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7073 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7074 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7075 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7076 | { } /* end */ |
| 7077 | }; |
| 7078 | |
| 7079 | static struct hda_verb alc888_lenovo_ms7195_verbs[] = { |
| 7080 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7081 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7083 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_FRONT_EVENT | AC_USRSP_EN}, |
| 7084 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7085 | { } /* end */ |
| 7086 | }; |
| 7087 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7088 | static struct hda_verb alc883_haier_w66_verbs[] = { |
| 7089 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7090 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7091 | |
| 7092 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7093 | |
| 7094 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7095 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7096 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7097 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7098 | { } /* end */ |
| 7099 | }; |
| 7100 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7101 | static struct hda_verb alc888_6st_hp_verbs[] = { |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7102 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7103 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 2 (0x0e) */ |
| 7104 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 1 (0x0d) */ |
| 7105 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7106 | { } |
| 7107 | }; |
| 7108 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7109 | static struct hda_verb alc888_3st_hp_verbs[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7110 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7111 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
| 7112 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
| 7113 | { } |
| 7114 | }; |
| 7115 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7116 | static struct hda_verb alc888_6st_dell_verbs[] = { |
| 7117 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
| 7118 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x02}, /* Rear : output 1 (0x0e) */ |
| 7119 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* CLFE : output 2 (0x0d) */ |
| 7120 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, /* Side : output 3 (0x0f) */ |
| 7121 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7122 | { } |
| 7123 | }; |
| 7124 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7125 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7126 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 7127 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7128 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 7129 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 7130 | { } |
| 7131 | }; |
| 7132 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7133 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7134 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7135 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7136 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 7137 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 7138 | { } |
| 7139 | }; |
| 7140 | |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7141 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { |
| 7142 | { 2, alc888_3st_hp_2ch_init }, |
| 7143 | { 6, alc888_3st_hp_6ch_init }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7144 | }; |
| 7145 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7146 | /* toggle front-jack and RCA according to the hp-jack state */ |
| 7147 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
| 7148 | { |
| 7149 | unsigned int present; |
| 7150 | |
| 7151 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7152 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7153 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7154 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7155 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7156 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7157 | } |
| 7158 | |
| 7159 | /* toggle RCA according to the front-jack state */ |
| 7160 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
| 7161 | { |
| 7162 | unsigned int present; |
| 7163 | |
| 7164 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7165 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7166 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7167 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7168 | } |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7169 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7170 | static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, |
| 7171 | unsigned int res) |
| 7172 | { |
| 7173 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7174 | alc888_lenovo_ms7195_front_automute(codec); |
| 7175 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7176 | alc888_lenovo_ms7195_rca_automute(codec); |
| 7177 | } |
| 7178 | |
| 7179 | static struct hda_verb alc883_medion_md2_verbs[] = { |
| 7180 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7181 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7182 | |
| 7183 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7184 | |
| 7185 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 7186 | { } /* end */ |
| 7187 | }; |
| 7188 | |
| 7189 | /* toggle speaker-output according to the hp-jack state */ |
| 7190 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
| 7191 | { |
| 7192 | unsigned int present; |
| 7193 | |
| 7194 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7195 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7196 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7197 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7198 | } |
| 7199 | |
| 7200 | static void alc883_medion_md2_unsol_event(struct hda_codec *codec, |
| 7201 | unsigned int res) |
| 7202 | { |
| 7203 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7204 | alc883_medion_md2_automute(codec); |
| 7205 | } |
| 7206 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7207 | /* toggle speaker-output according to the hp-jack state */ |
| 7208 | static void alc883_tagra_automute(struct hda_codec *codec) |
| 7209 | { |
| 7210 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7211 | unsigned char bits; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7212 | |
| 7213 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7214 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7215 | bits = present ? HDA_AMP_MUTE : 0; |
| 7216 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 7217 | HDA_AMP_MUTE, bits); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 7218 | snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, |
| 7219 | present ? 1 : 3); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7220 | } |
| 7221 | |
| 7222 | static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) |
| 7223 | { |
| 7224 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7225 | alc883_tagra_automute(codec); |
| 7226 | } |
| 7227 | |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7228 | static void alc883_haier_w66_automute(struct hda_codec *codec) |
| 7229 | { |
| 7230 | unsigned int present; |
| 7231 | unsigned char bits; |
| 7232 | |
| 7233 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7234 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7235 | bits = present ? 0x80 : 0; |
| 7236 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7237 | 0x80, bits); |
| 7238 | } |
| 7239 | |
| 7240 | static void alc883_haier_w66_unsol_event(struct hda_codec *codec, |
| 7241 | unsigned int res) |
| 7242 | { |
| 7243 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7244 | alc883_haier_w66_automute(codec); |
| 7245 | } |
| 7246 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7247 | static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 7248 | { |
| 7249 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7250 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7251 | |
| 7252 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7253 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7254 | bits = present ? HDA_AMP_MUTE : 0; |
| 7255 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7256 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7257 | } |
| 7258 | |
| 7259 | static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) |
| 7260 | { |
| 7261 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7262 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7263 | |
| 7264 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7265 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 7266 | bits = present ? HDA_AMP_MUTE : 0; |
| 7267 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7268 | HDA_AMP_MUTE, bits); |
| 7269 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7270 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7271 | } |
| 7272 | |
| 7273 | static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 7274 | unsigned int res) |
| 7275 | { |
| 7276 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7277 | alc883_lenovo_101e_all_automute(codec); |
| 7278 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 7279 | alc883_lenovo_101e_ispeaker_automute(codec); |
| 7280 | } |
| 7281 | |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7282 | /* toggle speaker-output according to the hp-jack state */ |
| 7283 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
| 7284 | { |
| 7285 | unsigned int present; |
| 7286 | |
| 7287 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 7288 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7289 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7290 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7291 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7292 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7293 | } |
| 7294 | |
| 7295 | static void alc883_acer_aspire_unsol_event(struct hda_codec *codec, |
| 7296 | unsigned int res) |
| 7297 | { |
| 7298 | if ((res >> 26) == ALC880_HP_EVENT) |
| 7299 | alc883_acer_aspire_automute(codec); |
| 7300 | } |
| 7301 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7302 | static struct hda_verb alc883_acer_eapd_verbs[] = { |
| 7303 | /* HP Pin: output 0 (0x0c) */ |
| 7304 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 7305 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 7306 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7307 | /* Front Pin: output 0 (0x0c) */ |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7308 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 7309 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7310 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7311 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7312 | /* eanable EAPD on medion laptop */ |
| 7313 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 7314 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7315 | /* enable unsolicited event */ |
| 7316 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7317 | { } |
| 7318 | }; |
| 7319 | |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7320 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
| 7321 | { |
| 7322 | unsigned int present; |
| 7323 | |
| 7324 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 7325 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 7326 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 7327 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7328 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 7329 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7330 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, |
| 7331 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7332 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, |
| 7333 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 7334 | } |
| 7335 | |
| 7336 | static void alc888_6st_dell_unsol_event(struct hda_codec *codec, |
| 7337 | unsigned int res) |
| 7338 | { |
| 7339 | switch (res >> 26) { |
| 7340 | case ALC880_HP_EVENT: |
| 7341 | printk("hp_event\n"); |
| 7342 | alc888_6st_dell_front_automute(codec); |
| 7343 | break; |
| 7344 | } |
| 7345 | } |
| 7346 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7347 | /* |
| 7348 | * generic initialization of ADC, input mixers and output mixers |
| 7349 | */ |
| 7350 | static struct hda_verb alc883_auto_init_verbs[] = { |
| 7351 | /* |
| 7352 | * Unmute ADC0-2 and set the default input to mic-in |
| 7353 | */ |
| 7354 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7355 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7356 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 7357 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7358 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7359 | /* 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] | 7360 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7361 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 7362 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7363 | */ |
| 7364 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7365 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 7366 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 7367 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 7368 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 7369 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7370 | |
| 7371 | /* |
| 7372 | * Set up output mixers (0x0c - 0x0f) |
| 7373 | */ |
| 7374 | /* set vol=0 to output mixers */ |
| 7375 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7376 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7377 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7378 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 7379 | /* set up input amps for analog loopback */ |
| 7380 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 7381 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7382 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7383 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7384 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7385 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7386 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7387 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7388 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7389 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7390 | {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7391 | |
| 7392 | /* FIXME: use matrix-type input source selection */ |
| 7393 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 7394 | /* Input mixer1 */ |
| 7395 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7396 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7397 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7398 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7399 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
| 7400 | /* Input mixer2 */ |
| 7401 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 7402 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 7403 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7404 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, */ |
Andy Shevchenko | e3cde64 | 2007-12-03 16:50:58 +0100 | [diff] [blame] | 7405 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7406 | |
| 7407 | { } |
| 7408 | }; |
| 7409 | |
| 7410 | /* capture mixer elements */ |
| 7411 | static struct snd_kcontrol_new alc883_capture_mixer[] = { |
| 7412 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 7413 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 7414 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), |
| 7415 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), |
| 7416 | { |
| 7417 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 7418 | /* The multiple "Capture Source" controls confuse alsamixer |
| 7419 | * So call somewhat different.. |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7420 | */ |
| 7421 | /* .name = "Capture Source", */ |
| 7422 | .name = "Input Source", |
| 7423 | .count = 2, |
| 7424 | .info = alc882_mux_enum_info, |
| 7425 | .get = alc882_mux_enum_get, |
| 7426 | .put = alc882_mux_enum_put, |
| 7427 | }, |
| 7428 | { } /* end */ |
| 7429 | }; |
| 7430 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7431 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7432 | #define alc883_loopbacks alc880_loopbacks |
| 7433 | #endif |
| 7434 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7435 | /* pcm configuration: identiacal with ALC880 */ |
| 7436 | #define alc883_pcm_analog_playback alc880_pcm_analog_playback |
| 7437 | #define alc883_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7438 | #define alc883_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7439 | #define alc883_pcm_digital_playback alc880_pcm_digital_playback |
| 7440 | #define alc883_pcm_digital_capture alc880_pcm_digital_capture |
| 7441 | |
| 7442 | /* |
| 7443 | * configuration and preset |
| 7444 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7445 | static const char *alc883_models[ALC883_MODEL_LAST] = { |
| 7446 | [ALC883_3ST_2ch_DIG] = "3stack-dig", |
| 7447 | [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 7448 | [ALC883_3ST_6ch] = "3stack-6ch", |
| 7449 | [ALC883_6ST_DIG] = "6stack-dig", |
| 7450 | [ALC883_TARGA_DIG] = "targa-dig", |
| 7451 | [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7452 | [ALC883_ACER] = "acer", |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7453 | [ALC883_ACER_ASPIRE] = "acer-aspire", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7454 | [ALC883_MEDION] = "medion", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7455 | [ALC883_MEDION_MD2] = "medion-md2", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7456 | [ALC883_LAPTOP_EAPD] = "laptop-eapd", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7457 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7458 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
| 7459 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7460 | [ALC883_HAIER_W66] = "haier-w66", |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7461 | [ALC888_6ST_HP] = "6stack-hp", |
| 7462 | [ALC888_3ST_HP] = "3stack-hp", |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7463 | [ALC888_6ST_DELL] = "6stack-dell", |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7464 | [ALC883_MITAC] = "mitac", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7465 | [ALC883_AUTO] = "auto", |
| 7466 | }; |
| 7467 | |
| 7468 | static struct snd_pci_quirk alc883_cfg_tbl[] = { |
| 7469 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7470 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
| 7471 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
| 7472 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
| 7473 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7474 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
Tobin Davis | febe337 | 2007-06-12 11:27:46 +0200 | [diff] [blame] | 7475 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7476 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
| 7477 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
| 7478 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC888_6ST_HP), |
| 7479 | 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] | 7480 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7481 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
| 7482 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
| 7483 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
Tobin Davis | 57b14f2 | 2007-04-18 23:05:36 +0200 | [diff] [blame] | 7484 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7485 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
| 7486 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
| 7487 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
| 7488 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
| 7489 | SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), |
| 7490 | SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), |
| 7491 | SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), |
| 7492 | SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), |
| 7493 | SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), |
| 7494 | SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG), |
| 7495 | SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), |
| 7496 | SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), |
| 7497 | SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7498 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), |
| 7499 | SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 799f88a | 2007-05-29 14:29:08 +0200 | [diff] [blame] | 7500 | SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), |
Leonard Norrgard | 2a296cb | 2007-01-08 11:28:22 +0100 | [diff] [blame] | 7501 | SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), |
Tobin Davis | 2dcd522 | 2007-07-10 17:04:57 +0200 | [diff] [blame] | 7502 | SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7503 | SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7504 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
| 7505 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), |
Daniel T Chen | e60623b | 2007-05-29 03:41:55 -0400 | [diff] [blame] | 7506 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7507 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7508 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7509 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7510 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
| 7511 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7512 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7513 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 7514 | SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7515 | {} |
| 7516 | }; |
| 7517 | |
| 7518 | static struct alc_config_preset alc883_presets[] = { |
| 7519 | [ALC883_3ST_2ch_DIG] = { |
| 7520 | .mixers = { alc883_3ST_2ch_mixer }, |
| 7521 | .init_verbs = { alc883_init_verbs }, |
| 7522 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7523 | .dac_nids = alc883_dac_nids, |
| 7524 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7525 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7526 | .adc_nids = alc883_adc_nids, |
| 7527 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7528 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7529 | .channel_mode = alc883_3ST_2ch_modes, |
| 7530 | .input_mux = &alc883_capture_source, |
| 7531 | }, |
| 7532 | [ALC883_3ST_6ch_DIG] = { |
| 7533 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7534 | .init_verbs = { alc883_init_verbs }, |
| 7535 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7536 | .dac_nids = alc883_dac_nids, |
| 7537 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7538 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7539 | .adc_nids = alc883_adc_nids, |
| 7540 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7541 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7542 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7543 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7544 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7545 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7546 | [ALC883_3ST_6ch] = { |
| 7547 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7548 | .init_verbs = { alc883_init_verbs }, |
| 7549 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7550 | .dac_nids = alc883_dac_nids, |
| 7551 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7552 | .adc_nids = alc883_adc_nids, |
| 7553 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7554 | .channel_mode = alc883_3ST_6ch_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 7555 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7556 | .input_mux = &alc883_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7557 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7558 | [ALC883_6ST_DIG] = { |
| 7559 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
| 7560 | .init_verbs = { alc883_init_verbs }, |
| 7561 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7562 | .dac_nids = alc883_dac_nids, |
| 7563 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7564 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7565 | .adc_nids = alc883_adc_nids, |
| 7566 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7567 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7568 | .channel_mode = alc883_sixstack_modes, |
| 7569 | .input_mux = &alc883_capture_source, |
| 7570 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7571 | [ALC883_TARGA_DIG] = { |
| 7572 | .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, |
| 7573 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7574 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7575 | .dac_nids = alc883_dac_nids, |
| 7576 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7577 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7578 | .adc_nids = alc883_adc_nids, |
| 7579 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7580 | .channel_mode = alc883_3ST_6ch_modes, |
| 7581 | .need_dac_fix = 1, |
| 7582 | .input_mux = &alc883_capture_source, |
| 7583 | .unsol_event = alc883_tagra_unsol_event, |
| 7584 | .init_hook = alc883_tagra_automute, |
| 7585 | }, |
| 7586 | [ALC883_TARGA_2ch_DIG] = { |
| 7587 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7588 | .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, |
| 7589 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7590 | .dac_nids = alc883_dac_nids, |
| 7591 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7592 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7593 | .adc_nids = alc883_adc_nids, |
| 7594 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7595 | .channel_mode = alc883_3ST_2ch_modes, |
| 7596 | .input_mux = &alc883_capture_source, |
| 7597 | .unsol_event = alc883_tagra_unsol_event, |
| 7598 | .init_hook = alc883_tagra_automute, |
| 7599 | }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7600 | [ALC883_ACER] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7601 | .mixers = { alc883_base_mixer }, |
Vladimir Avdonin | bab282b9 | 2006-08-22 13:31:58 +0200 | [diff] [blame] | 7602 | /* On TravelMate laptops, GPIO 0 enables the internal speaker |
| 7603 | * and the headphone jack. Turn this on and rely on the |
| 7604 | * standard mute methods whenever the user wants to turn |
| 7605 | * these outputs off. |
| 7606 | */ |
| 7607 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, |
| 7608 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7609 | .dac_nids = alc883_dac_nids, |
| 7610 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7611 | .adc_nids = alc883_adc_nids, |
| 7612 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7613 | .channel_mode = alc883_3ST_2ch_modes, |
| 7614 | .input_mux = &alc883_capture_source, |
| 7615 | }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7616 | [ALC883_ACER_ASPIRE] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7617 | .mixers = { alc883_acer_aspire_mixer }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7618 | .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs }, |
Tobin Davis | 2880a86 | 2007-08-07 11:50:26 +0200 | [diff] [blame] | 7619 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7620 | .dac_nids = alc883_dac_nids, |
| 7621 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7622 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7623 | .adc_nids = alc883_adc_nids, |
| 7624 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7625 | .channel_mode = alc883_3ST_2ch_modes, |
| 7626 | .input_mux = &alc883_capture_source, |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7627 | .unsol_event = alc883_acer_aspire_unsol_event, |
| 7628 | .init_hook = alc883_acer_aspire_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 7629 | }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7630 | [ALC883_MEDION] = { |
| 7631 | .mixers = { alc883_fivestack_mixer, |
| 7632 | alc883_chmode_mixer }, |
| 7633 | .init_verbs = { alc883_init_verbs, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7634 | alc883_medion_eapd_verbs }, |
Tobin Davis | c07584c | 2006-10-13 12:32:16 +0200 | [diff] [blame] | 7635 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7636 | .dac_nids = alc883_dac_nids, |
| 7637 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7638 | .adc_nids = alc883_adc_nids, |
| 7639 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7640 | .channel_mode = alc883_sixstack_modes, |
| 7641 | .input_mux = &alc883_capture_source, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7642 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7643 | [ALC883_MEDION_MD2] = { |
| 7644 | .mixers = { alc883_medion_md2_mixer}, |
| 7645 | .init_verbs = { alc883_init_verbs, alc883_medion_md2_verbs}, |
| 7646 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7647 | .dac_nids = alc883_dac_nids, |
| 7648 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7649 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7650 | .adc_nids = alc883_adc_nids, |
| 7651 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7652 | .channel_mode = alc883_3ST_2ch_modes, |
| 7653 | .input_mux = &alc883_capture_source, |
| 7654 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7655 | .init_hook = alc883_medion_md2_automute, |
| 7656 | }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7657 | [ALC883_LAPTOP_EAPD] = { |
Takashi Iwai | 676a9b5 | 2007-08-16 15:23:35 +0200 | [diff] [blame] | 7658 | .mixers = { alc883_base_mixer }, |
Andrew L. Neporada | b373bde | 2006-11-07 11:37:08 +0100 | [diff] [blame] | 7659 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
| 7660 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7661 | .dac_nids = alc883_dac_nids, |
| 7662 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7663 | .adc_nids = alc883_adc_nids, |
| 7664 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7665 | .channel_mode = alc883_3ST_2ch_modes, |
| 7666 | .input_mux = &alc883_capture_source, |
| 7667 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7668 | [ALC883_LENOVO_101E_2ch] = { |
| 7669 | .mixers = { alc883_lenovo_101e_2ch_mixer}, |
| 7670 | .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs}, |
| 7671 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7672 | .dac_nids = alc883_dac_nids, |
| 7673 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7674 | .adc_nids = alc883_adc_nids, |
| 7675 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7676 | .channel_mode = alc883_3ST_2ch_modes, |
| 7677 | .input_mux = &alc883_lenovo_101e_capture_source, |
| 7678 | .unsol_event = alc883_lenovo_101e_unsol_event, |
| 7679 | .init_hook = alc883_lenovo_101e_all_automute, |
| 7680 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7681 | [ALC883_LENOVO_NB0763] = { |
| 7682 | .mixers = { alc883_lenovo_nb0763_mixer }, |
| 7683 | .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs}, |
| 7684 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7685 | .dac_nids = alc883_dac_nids, |
| 7686 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7687 | .adc_nids = alc883_adc_nids, |
| 7688 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7689 | .channel_mode = alc883_3ST_2ch_modes, |
| 7690 | .need_dac_fix = 1, |
| 7691 | .input_mux = &alc883_lenovo_nb0763_capture_source, |
| 7692 | .unsol_event = alc883_medion_md2_unsol_event, |
| 7693 | .init_hook = alc883_medion_md2_automute, |
| 7694 | }, |
| 7695 | [ALC888_LENOVO_MS7195_DIG] = { |
| 7696 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, |
| 7697 | .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs}, |
| 7698 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7699 | .dac_nids = alc883_dac_nids, |
| 7700 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7701 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7702 | .adc_nids = alc883_adc_nids, |
| 7703 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), |
| 7704 | .channel_mode = alc883_3ST_6ch_modes, |
| 7705 | .need_dac_fix = 1, |
| 7706 | .input_mux = &alc883_capture_source, |
| 7707 | .unsol_event = alc883_lenovo_ms7195_unsol_event, |
| 7708 | .init_hook = alc888_lenovo_ms7195_front_automute, |
Kailang Yang | 189609a | 2007-08-20 11:31:23 +0200 | [diff] [blame] | 7709 | }, |
| 7710 | [ALC883_HAIER_W66] = { |
| 7711 | .mixers = { alc883_tagra_2ch_mixer}, |
| 7712 | .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs}, |
| 7713 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7714 | .dac_nids = alc883_dac_nids, |
| 7715 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7716 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7717 | .adc_nids = alc883_adc_nids, |
| 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_haier_w66_unsol_event, |
| 7722 | .init_hook = alc883_haier_w66_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 7723 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7724 | [ALC888_6ST_HP] = { |
| 7725 | .mixers = { alc888_6st_hp_mixer, alc883_chmode_mixer }, |
| 7726 | .init_verbs = { alc883_init_verbs, alc888_6st_hp_verbs }, |
Claudio Matsuoka | cd1e3b4 | 2007-07-06 12:10:01 +0200 | [diff] [blame] | 7727 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7728 | .dac_nids = alc883_dac_nids, |
| 7729 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7730 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7731 | .adc_nids = alc883_adc_nids, |
| 7732 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7733 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7734 | .channel_mode = alc883_sixstack_modes, |
| 7735 | .input_mux = &alc883_capture_source, |
| 7736 | }, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7737 | [ALC888_3ST_HP] = { |
| 7738 | .mixers = { alc888_3st_hp_mixer, alc883_chmode_mixer }, |
| 7739 | .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs }, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7740 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7741 | .dac_nids = alc883_dac_nids, |
| 7742 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7743 | .adc_nids = alc883_adc_nids, |
Claudio Matsuoka | 4723c02 | 2007-07-13 14:36:19 +0200 | [diff] [blame] | 7744 | .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes), |
| 7745 | .channel_mode = alc888_3st_hp_modes, |
Claudio Matsuoka | 8341de6 | 2007-07-06 12:10:45 +0200 | [diff] [blame] | 7746 | .need_dac_fix = 1, |
| 7747 | .input_mux = &alc883_capture_source, |
| 7748 | }, |
Claudio Matsuoka | 5795b9e | 2008-01-13 11:58:27 +0100 | [diff] [blame] | 7749 | [ALC888_6ST_DELL] = { |
| 7750 | .mixers = { alc888_6st_dell_mixer, alc883_chmode_mixer }, |
| 7751 | .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs }, |
| 7752 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7753 | .dac_nids = alc883_dac_nids, |
| 7754 | .dig_out_nid = ALC883_DIGOUT_NID, |
| 7755 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7756 | .adc_nids = alc883_adc_nids, |
| 7757 | .dig_in_nid = ALC883_DIGIN_NID, |
| 7758 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
| 7759 | .channel_mode = alc883_sixstack_modes, |
| 7760 | .input_mux = &alc883_capture_source, |
| 7761 | .unsol_event = alc888_6st_dell_unsol_event, |
| 7762 | .init_hook = alc888_6st_dell_front_automute, |
| 7763 | }, |
Andy Shevchenko | a8848bd | 2007-12-13 17:32:26 +0100 | [diff] [blame] | 7764 | [ALC883_MITAC] = { |
| 7765 | .mixers = { alc883_mitac_mixer }, |
| 7766 | .init_verbs = { alc883_init_verbs, alc883_mitac_verbs }, |
| 7767 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
| 7768 | .dac_nids = alc883_dac_nids, |
| 7769 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
| 7770 | .adc_nids = alc883_adc_nids, |
| 7771 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 7772 | .channel_mode = alc883_3ST_2ch_modes, |
| 7773 | .input_mux = &alc883_capture_source, |
| 7774 | .unsol_event = alc883_mitac_unsol_event, |
| 7775 | .init_hook = alc883_mitac_automute, |
| 7776 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7777 | }; |
| 7778 | |
| 7779 | |
| 7780 | /* |
| 7781 | * BIOS auto configuration |
| 7782 | */ |
| 7783 | static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, |
| 7784 | hda_nid_t nid, int pin_type, |
| 7785 | int dac_idx) |
| 7786 | { |
| 7787 | /* set as output */ |
| 7788 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7789 | int idx; |
| 7790 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7791 | if (spec->multiout.dac_nids[dac_idx] == 0x25) |
| 7792 | idx = 4; |
| 7793 | else |
| 7794 | idx = spec->multiout.dac_nids[dac_idx] - 2; |
| 7795 | |
| 7796 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7797 | pin_type); |
| 7798 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 7799 | AMP_OUT_UNMUTE); |
| 7800 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); |
| 7801 | |
| 7802 | } |
| 7803 | |
| 7804 | static void alc883_auto_init_multi_out(struct hda_codec *codec) |
| 7805 | { |
| 7806 | struct alc_spec *spec = codec->spec; |
| 7807 | int i; |
| 7808 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7809 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7810 | for (i = 0; i <= HDA_SIDE; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7811 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7812 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7813 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 7814 | alc883_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7815 | i); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7816 | } |
| 7817 | } |
| 7818 | |
| 7819 | static void alc883_auto_init_hp_out(struct hda_codec *codec) |
| 7820 | { |
| 7821 | struct alc_spec *spec = codec->spec; |
| 7822 | hda_nid_t pin; |
| 7823 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 7824 | pin = spec->autocfg.hp_pins[0]; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7825 | if (pin) /* connect to front */ |
| 7826 | /* use dac 0 */ |
| 7827 | alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 7828 | } |
| 7829 | |
| 7830 | #define alc883_is_input_pin(nid) alc880_is_input_pin(nid) |
| 7831 | #define ALC883_PIN_CD_NID ALC880_PIN_CD_NID |
| 7832 | |
| 7833 | static void alc883_auto_init_analog_input(struct hda_codec *codec) |
| 7834 | { |
| 7835 | struct alc_spec *spec = codec->spec; |
| 7836 | int i; |
| 7837 | |
| 7838 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 7839 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 7840 | if (alc883_is_input_pin(nid)) { |
| 7841 | snd_hda_codec_write(codec, nid, 0, |
| 7842 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 7843 | (i <= AUTO_PIN_FRONT_MIC ? |
| 7844 | PIN_VREF80 : PIN_IN)); |
| 7845 | if (nid != ALC883_PIN_CD_NID) |
| 7846 | snd_hda_codec_write(codec, nid, 0, |
| 7847 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 7848 | AMP_OUT_MUTE); |
| 7849 | } |
| 7850 | } |
| 7851 | } |
| 7852 | |
| 7853 | /* almost identical with ALC880 parser... */ |
| 7854 | static int alc883_parse_auto_config(struct hda_codec *codec) |
| 7855 | { |
| 7856 | struct alc_spec *spec = codec->spec; |
| 7857 | int err = alc880_parse_auto_config(codec); |
| 7858 | |
| 7859 | if (err < 0) |
| 7860 | return err; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7861 | else if (!err) |
| 7862 | return 0; /* no config found */ |
| 7863 | |
| 7864 | err = alc_auto_add_mic_boost(codec); |
| 7865 | if (err < 0) |
| 7866 | return err; |
| 7867 | |
| 7868 | /* hack - override the init verbs */ |
| 7869 | spec->init_verbs[0] = alc883_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 7870 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
| 7871 | spec->num_mixers++; |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 7872 | |
| 7873 | return 1; /* config found */ |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7874 | } |
| 7875 | |
| 7876 | /* additional initialization for auto-configuration model */ |
| 7877 | static void alc883_auto_init(struct hda_codec *codec) |
| 7878 | { |
| 7879 | alc883_auto_init_multi_out(codec); |
| 7880 | alc883_auto_init_hp_out(codec); |
| 7881 | alc883_auto_init_analog_input(codec); |
| 7882 | } |
| 7883 | |
| 7884 | static int patch_alc883(struct hda_codec *codec) |
| 7885 | { |
| 7886 | struct alc_spec *spec; |
| 7887 | int err, board_config; |
| 7888 | |
| 7889 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 7890 | if (spec == NULL) |
| 7891 | return -ENOMEM; |
| 7892 | |
| 7893 | codec->spec = spec; |
| 7894 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 7895 | board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, |
| 7896 | alc883_models, |
| 7897 | alc883_cfg_tbl); |
| 7898 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7899 | printk(KERN_INFO "hda_codec: Unknown model for ALC883, " |
| 7900 | "trying auto-probe from BIOS...\n"); |
| 7901 | board_config = ALC883_AUTO; |
| 7902 | } |
| 7903 | |
| 7904 | if (board_config == ALC883_AUTO) { |
| 7905 | /* automatic parse from the BIOS config */ |
| 7906 | err = alc883_parse_auto_config(codec); |
| 7907 | if (err < 0) { |
| 7908 | alc_free(codec); |
| 7909 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7910 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7911 | printk(KERN_INFO |
| 7912 | "hda_codec: Cannot set up configuration " |
| 7913 | "from BIOS. Using base mode...\n"); |
| 7914 | board_config = ALC883_3ST_2ch_DIG; |
| 7915 | } |
| 7916 | } |
| 7917 | |
| 7918 | if (board_config != ALC883_AUTO) |
| 7919 | setup_preset(spec, &alc883_presets[board_config]); |
| 7920 | |
| 7921 | spec->stream_name_analog = "ALC883 Analog"; |
| 7922 | spec->stream_analog_playback = &alc883_pcm_analog_playback; |
| 7923 | spec->stream_analog_capture = &alc883_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 7924 | spec->stream_analog_alt_capture = &alc883_pcm_analog_alt_capture; |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7925 | |
| 7926 | spec->stream_name_digital = "ALC883 Digital"; |
| 7927 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
| 7928 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
| 7929 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 7930 | if (!spec->adc_nids && spec->input_mux) { |
Takashi Iwai | 4b146cb | 2006-07-28 14:42:36 +0200 | [diff] [blame] | 7931 | spec->adc_nids = alc883_adc_nids; |
| 7932 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); |
| 7933 | } |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7934 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 7935 | spec->vmaster_nid = 0x0c; |
| 7936 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7937 | codec->patch_ops = alc_patch_ops; |
| 7938 | if (board_config == ALC883_AUTO) |
| 7939 | spec->init_hook = alc883_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 7940 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 7941 | if (!spec->loopback.amplist) |
| 7942 | spec->loopback.amplist = alc883_loopbacks; |
| 7943 | #endif |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 7944 | |
| 7945 | return 0; |
| 7946 | } |
| 7947 | |
| 7948 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7949 | * ALC262 support |
| 7950 | */ |
| 7951 | |
| 7952 | #define ALC262_DIGOUT_NID ALC880_DIGOUT_NID |
| 7953 | #define ALC262_DIGIN_NID ALC880_DIGIN_NID |
| 7954 | |
| 7955 | #define alc262_dac_nids alc260_dac_nids |
| 7956 | #define alc262_adc_nids alc882_adc_nids |
| 7957 | #define alc262_adc_nids_alt alc882_adc_nids_alt |
| 7958 | |
| 7959 | #define alc262_modes alc260_modes |
Takashi Iwai | c5f2ea0 | 2005-12-06 18:54:31 +0100 | [diff] [blame] | 7960 | #define alc262_capture_source alc882_capture_source |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7961 | |
| 7962 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
| 7963 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7964 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7965 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7966 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7967 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7968 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7969 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7970 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7971 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7972 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7973 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7974 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7975 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7976 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7977 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
| 7978 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 7979 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 7980 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 7981 | { } /* end */ |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 7982 | }; |
| 7983 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7984 | static struct snd_kcontrol_new alc262_hippo1_mixer[] = { |
| 7985 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 7986 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 7987 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 7988 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 7989 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 7990 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 7991 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 7992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7993 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7994 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 7995 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 7996 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 7997 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 7998 | HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ |
| 7999 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
| 8000 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8001 | { } /* end */ |
| 8002 | }; |
| 8003 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8004 | static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { |
| 8005 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8006 | HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8007 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8008 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8009 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 8010 | |
| 8011 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8012 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8013 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8014 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8015 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8016 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8017 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8018 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 8019 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8020 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8021 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8022 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8023 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
| 8024 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
| 8025 | { } /* end */ |
| 8026 | }; |
| 8027 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8028 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { |
| 8029 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8030 | HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 8031 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8032 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8033 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
| 8034 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 8035 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 8036 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x02, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8037 | HDA_CODEC_VOLUME("Front Mic Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8038 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8039 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8040 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8041 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8042 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 8043 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 8044 | { } /* end */ |
| 8045 | }; |
| 8046 | |
| 8047 | static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { |
| 8048 | HDA_CODEC_VOLUME("Rear Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8049 | HDA_CODEC_MUTE("Rear Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | cc69d12 | 2007-02-15 19:29:26 +0100 | [diff] [blame] | 8050 | HDA_CODEC_VOLUME("Rear Mic Boost", 0x18, 0, HDA_INPUT), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8051 | { } /* end */ |
| 8052 | }; |
| 8053 | |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8054 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8055 | static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) |
| 8056 | { |
| 8057 | struct alc_spec *spec = codec->spec; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8058 | |
| 8059 | if (force || !spec->sense_updated) { |
| 8060 | unsigned int present; |
| 8061 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8062 | AC_VERB_GET_PIN_SENSE, 0); |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8063 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8064 | spec->sense_updated = 1; |
| 8065 | } |
Takashi Iwai | 4bb2613 | 2008-01-28 18:12:42 +0100 | [diff] [blame] | 8066 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, |
| 8067 | spec->jack_present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8068 | } |
| 8069 | |
| 8070 | static void alc262_hp_t5735_unsol_event(struct hda_codec *codec, |
| 8071 | unsigned int res) |
| 8072 | { |
| 8073 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8074 | return; |
| 8075 | alc262_hp_t5735_automute(codec, 1); |
| 8076 | } |
| 8077 | |
| 8078 | static void alc262_hp_t5735_init_hook(struct hda_codec *codec) |
| 8079 | { |
| 8080 | alc262_hp_t5735_automute(codec, 1); |
| 8081 | } |
| 8082 | |
| 8083 | static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8084 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8085 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 8086 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), |
| 8087 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8088 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8089 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8090 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8091 | { } /* end */ |
| 8092 | }; |
| 8093 | |
| 8094 | static struct hda_verb alc262_hp_t5735_verbs[] = { |
| 8095 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8096 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8097 | |
| 8098 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 8099 | { } |
| 8100 | }; |
| 8101 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8102 | static struct snd_kcontrol_new alc262_hp_rp5700_mixer[] = { |
Takashi Iwai | f2f48e1 | 2008-01-28 18:14:43 +0100 | [diff] [blame^] | 8103 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8104 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 8105 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0e, 0x0, HDA_OUTPUT), |
| 8106 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x16, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8107 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8108 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8109 | { } /* end */ |
| 8110 | }; |
| 8111 | |
| 8112 | static struct hda_verb alc262_hp_rp5700_verbs[] = { |
| 8113 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8114 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 8115 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8116 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 8117 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 8118 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8119 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8120 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8121 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8122 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x00 << 8))}, |
| 8123 | {} |
| 8124 | }; |
| 8125 | |
| 8126 | static struct hda_input_mux alc262_hp_rp5700_capture_source = { |
| 8127 | .num_items = 1, |
| 8128 | .items = { |
| 8129 | { "Line", 0x1 }, |
| 8130 | }, |
| 8131 | }; |
| 8132 | |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8133 | /* bind hp and internal speaker mute (with plug check) */ |
| 8134 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8135 | struct snd_ctl_elem_value *ucontrol) |
| 8136 | { |
| 8137 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8138 | long *valp = ucontrol->value.integer.value; |
| 8139 | int change; |
| 8140 | |
| 8141 | /* change hp mute */ |
| 8142 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, |
| 8143 | HDA_AMP_MUTE, |
| 8144 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 8145 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, |
| 8146 | HDA_AMP_MUTE, |
| 8147 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 8148 | if (change) { |
| 8149 | /* change speaker according to HP jack state */ |
| 8150 | struct alc_spec *spec = codec->spec; |
| 8151 | unsigned int mute; |
| 8152 | if (spec->jack_present) |
| 8153 | mute = HDA_AMP_MUTE; |
| 8154 | else |
| 8155 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, |
| 8156 | HDA_OUTPUT, 0); |
| 8157 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8158 | HDA_AMP_MUTE, mute); |
| 8159 | } |
| 8160 | return change; |
| 8161 | } |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8162 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8163 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
Takashi Iwai | 0724ea2 | 2007-08-23 00:31:43 +0200 | [diff] [blame] | 8164 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8165 | { |
| 8166 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8167 | .name = "Master Playback Switch", |
| 8168 | .info = snd_hda_mixer_amp_switch_info, |
| 8169 | .get = snd_hda_mixer_amp_switch_get, |
| 8170 | .put = alc262_sony_master_sw_put, |
| 8171 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), |
| 8172 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8173 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8174 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8175 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8176 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8177 | { } /* end */ |
| 8178 | }; |
| 8179 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8180 | static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { |
| 8181 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8182 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8183 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8184 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8185 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 8186 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8187 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8188 | { } /* end */ |
| 8189 | }; |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8190 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8191 | #define alc262_capture_mixer alc882_capture_mixer |
| 8192 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
| 8193 | |
| 8194 | /* |
| 8195 | * generic initialization of ADC, input mixers and output mixers |
| 8196 | */ |
| 8197 | static struct hda_verb alc262_init_verbs[] = { |
| 8198 | /* |
| 8199 | * Unmute ADC0-2 and set the default input to mic-in |
| 8200 | */ |
| 8201 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8202 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8203 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8204 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8205 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8206 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8207 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8208 | /* 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] | 8209 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8210 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8211 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8212 | */ |
| 8213 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8214 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8215 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8216 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8217 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8218 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8219 | |
| 8220 | /* |
| 8221 | * Set up output mixers (0x0c - 0x0e) |
| 8222 | */ |
| 8223 | /* set vol=0 to output mixers */ |
| 8224 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8225 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8226 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8227 | /* set up input amps for analog loopback */ |
| 8228 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8229 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8230 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8231 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8232 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8233 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8234 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8235 | |
| 8236 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8237 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8238 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8239 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8240 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8241 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8242 | |
| 8243 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8244 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8245 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8246 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8247 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8248 | |
| 8249 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8250 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8251 | |
| 8252 | /* FIXME: use matrix-type input source selection */ |
| 8253 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8254 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8255 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8256 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8257 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8258 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8259 | /* Input mixer2 */ |
| 8260 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8261 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8262 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8263 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8264 | /* Input mixer3 */ |
| 8265 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8266 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8267 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8268 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8269 | |
| 8270 | { } |
| 8271 | }; |
| 8272 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8273 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
| 8274 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8275 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8276 | {} |
| 8277 | }; |
| 8278 | |
| 8279 | static struct hda_verb alc262_hippo1_unsol_verbs[] = { |
| 8280 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8281 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8282 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
| 8283 | |
| 8284 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8285 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8286 | {} |
| 8287 | }; |
| 8288 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 8289 | static struct hda_verb alc262_sony_unsol_verbs[] = { |
| 8290 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8291 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8292 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic |
| 8293 | |
| 8294 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8295 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8296 | }; |
| 8297 | |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8298 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8299 | static void alc262_hippo_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8300 | { |
| 8301 | struct alc_spec *spec = codec->spec; |
| 8302 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8303 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8304 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8305 | /* need to execute and sync at first */ |
| 8306 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8307 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8308 | AC_VERB_GET_PIN_SENSE, 0); |
| 8309 | spec->jack_present = (present & 0x80000000) != 0; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8310 | if (spec->jack_present) { |
| 8311 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8312 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8313 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8314 | } else { |
| 8315 | /* unmute internal speaker if necessary */ |
| 8316 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8317 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8318 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8319 | } |
| 8320 | } |
| 8321 | |
| 8322 | /* unsolicited event for HP jack sensing */ |
| 8323 | static void alc262_hippo_unsol_event(struct hda_codec *codec, |
| 8324 | unsigned int res) |
| 8325 | { |
| 8326 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8327 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8328 | alc262_hippo_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8329 | } |
| 8330 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8331 | static void alc262_hippo1_automute(struct hda_codec *codec) |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8332 | { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8333 | unsigned int mute; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8334 | unsigned int present; |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8335 | |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8336 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8337 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 8338 | AC_VERB_GET_PIN_SENSE, 0); |
| 8339 | present = (present & 0x80000000) != 0; |
| 8340 | if (present) { |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8341 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8342 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8343 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8344 | } else { |
| 8345 | /* unmute internal speaker if necessary */ |
| 8346 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8347 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8348 | HDA_AMP_MUTE, mute); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8349 | } |
| 8350 | } |
| 8351 | |
| 8352 | /* unsolicited event for HP jack sensing */ |
| 8353 | static void alc262_hippo1_unsol_event(struct hda_codec *codec, |
| 8354 | unsigned int res) |
| 8355 | { |
| 8356 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8357 | return; |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 8358 | alc262_hippo1_automute(codec); |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 8359 | } |
| 8360 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8361 | /* |
| 8362 | * fujitsu model |
| 8363 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker |
| 8364 | */ |
| 8365 | |
| 8366 | #define ALC_HP_EVENT 0x37 |
| 8367 | |
| 8368 | static struct hda_verb alc262_fujitsu_unsol_verbs[] = { |
| 8369 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, |
| 8370 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8371 | {} |
| 8372 | }; |
| 8373 | |
| 8374 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8375 | .num_items = 3, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8376 | .items = { |
| 8377 | { "Mic", 0x0 }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8378 | { "Int Mic", 0x1 }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8379 | { "CD", 0x4 }, |
| 8380 | }, |
| 8381 | }; |
| 8382 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8383 | static struct hda_input_mux alc262_HP_capture_source = { |
| 8384 | .num_items = 5, |
| 8385 | .items = { |
| 8386 | { "Mic", 0x0 }, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8387 | { "Front Mic", 0x1 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8388 | { "Line", 0x2 }, |
| 8389 | { "CD", 0x4 }, |
| 8390 | { "AUX IN", 0x6 }, |
| 8391 | }, |
| 8392 | }; |
| 8393 | |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 8394 | static struct hda_input_mux alc262_HP_D7000_capture_source = { |
| 8395 | .num_items = 4, |
| 8396 | .items = { |
| 8397 | { "Mic", 0x0 }, |
| 8398 | { "Front Mic", 0x2 }, |
| 8399 | { "Line", 0x1 }, |
| 8400 | { "CD", 0x4 }, |
| 8401 | }, |
| 8402 | }; |
| 8403 | |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8404 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8405 | static void alc262_fujitsu_automute(struct hda_codec *codec, int force) |
| 8406 | { |
| 8407 | struct alc_spec *spec = codec->spec; |
| 8408 | unsigned int mute; |
| 8409 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8410 | if (force || !spec->sense_updated) { |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8411 | unsigned int present; |
| 8412 | /* need to execute and sync at first */ |
| 8413 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8414 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 8415 | AC_VERB_GET_PIN_SENSE, 0); |
| 8416 | spec->jack_present = (present & 0x80000000) != 0; |
| 8417 | spec->sense_updated = 1; |
| 8418 | } |
| 8419 | if (spec->jack_present) { |
| 8420 | /* mute internal speaker */ |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8421 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8422 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8423 | } else { |
| 8424 | /* unmute internal speaker if necessary */ |
| 8425 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8426 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 8427 | HDA_AMP_MUTE, mute); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8428 | } |
| 8429 | } |
| 8430 | |
| 8431 | /* unsolicited event for HP jack sensing */ |
| 8432 | static void alc262_fujitsu_unsol_event(struct hda_codec *codec, |
| 8433 | unsigned int res) |
| 8434 | { |
| 8435 | if ((res >> 26) != ALC_HP_EVENT) |
| 8436 | return; |
| 8437 | alc262_fujitsu_automute(codec, 1); |
| 8438 | } |
| 8439 | |
| 8440 | /* bind volumes of both NID 0x0c and 0x0d */ |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8441 | static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = { |
| 8442 | .ops = &snd_hda_bind_vol, |
| 8443 | .values = { |
| 8444 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), |
| 8445 | HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT), |
| 8446 | 0 |
| 8447 | }, |
| 8448 | }; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8449 | |
| 8450 | /* bind hp and internal speaker mute (with plug check) */ |
| 8451 | static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, |
| 8452 | struct snd_ctl_elem_value *ucontrol) |
| 8453 | { |
| 8454 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 8455 | long *valp = ucontrol->value.integer.value; |
| 8456 | int change; |
| 8457 | |
| 8458 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8459 | HDA_AMP_MUTE, |
| 8460 | valp[0] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8461 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 8462 | HDA_AMP_MUTE, |
| 8463 | valp[1] ? 0 : HDA_AMP_MUTE); |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 8464 | if (change) |
| 8465 | alc262_fujitsu_automute(codec, 0); |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8466 | return change; |
| 8467 | } |
| 8468 | |
| 8469 | static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { |
Takashi Iwai | cca3b37 | 2007-08-10 17:12:15 +0200 | [diff] [blame] | 8470 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8471 | { |
| 8472 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 8473 | .name = "Master Playback Switch", |
| 8474 | .info = snd_hda_mixer_amp_switch_info, |
| 8475 | .get = snd_hda_mixer_amp_switch_get, |
| 8476 | .put = alc262_fujitsu_master_sw_put, |
| 8477 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 8478 | }, |
| 8479 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 8480 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 8481 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 8482 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 8483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 8484 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
| 8485 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 8486 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 8487 | { } /* end */ |
| 8488 | }; |
| 8489 | |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 8490 | /* additional init verbs for Benq laptops */ |
| 8491 | static struct hda_verb alc262_EAPD_verbs[] = { |
| 8492 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8493 | {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, |
| 8494 | {} |
| 8495 | }; |
| 8496 | |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 8497 | static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { |
| 8498 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8499 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8500 | |
| 8501 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
| 8502 | {0x20, AC_VERB_SET_PROC_COEF, 0x3050}, |
| 8503 | {} |
| 8504 | }; |
| 8505 | |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8506 | /* Samsung Q1 Ultra Vista model setup */ |
| 8507 | static struct snd_kcontrol_new alc262_ultra_mixer[] = { |
| 8508 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
| 8509 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 8510 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 8511 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 8512 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 8513 | HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), |
| 8514 | { } /* end */ |
| 8515 | }; |
| 8516 | |
| 8517 | static struct hda_verb alc262_ultra_verbs[] = { |
| 8518 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 8519 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 8520 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 8521 | /* Mic is on Node 0x19 */ |
| 8522 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8523 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8524 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8525 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8526 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8527 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8528 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8529 | {} |
| 8530 | }; |
| 8531 | |
| 8532 | static struct hda_input_mux alc262_ultra_capture_source = { |
| 8533 | .num_items = 1, |
| 8534 | .items = { |
| 8535 | { "Mic", 0x1 }, |
| 8536 | }, |
| 8537 | }; |
| 8538 | |
| 8539 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 8540 | static void alc262_ultra_automute(struct hda_codec *codec) |
| 8541 | { |
| 8542 | struct alc_spec *spec = codec->spec; |
| 8543 | unsigned int mute; |
| 8544 | unsigned int present; |
| 8545 | |
| 8546 | /* need to execute and sync at first */ |
| 8547 | snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 8548 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 8549 | AC_VERB_GET_PIN_SENSE, 0); |
| 8550 | spec->jack_present = (present & 0x80000000) != 0; |
| 8551 | if (spec->jack_present) { |
| 8552 | /* mute internal speaker */ |
| 8553 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8554 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 8555 | } else { |
| 8556 | /* unmute internal speaker if necessary */ |
| 8557 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 8558 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 8559 | HDA_AMP_MUTE, mute); |
| 8560 | } |
| 8561 | } |
| 8562 | |
| 8563 | /* unsolicited event for HP jack sensing */ |
| 8564 | static void alc262_ultra_unsol_event(struct hda_codec *codec, |
| 8565 | unsigned int res) |
| 8566 | { |
| 8567 | if ((res >> 26) != ALC880_HP_EVENT) |
| 8568 | return; |
| 8569 | alc262_ultra_automute(codec); |
| 8570 | } |
| 8571 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8572 | /* add playback controls from the parsed DAC table */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8573 | static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 8574 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8575 | { |
| 8576 | hda_nid_t nid; |
| 8577 | int err; |
| 8578 | |
| 8579 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 8580 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 8581 | spec->multiout.dac_nids[0] = 2; |
| 8582 | |
| 8583 | nid = cfg->line_out_pins[0]; |
| 8584 | if (nid) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8585 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8586 | "Front Playback Volume", |
| 8587 | HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT)); |
| 8588 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8589 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8590 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8591 | "Front Playback Switch", |
| 8592 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 8593 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8594 | return err; |
| 8595 | } |
| 8596 | |
Takashi Iwai | 82bc955 | 2006-03-21 11:24:42 +0100 | [diff] [blame] | 8597 | nid = cfg->speaker_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8598 | if (nid) { |
| 8599 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8600 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8601 | "Speaker Playback Volume", |
| 8602 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8603 | HDA_OUTPUT)); |
| 8604 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8605 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8606 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8607 | "Speaker Playback Switch", |
| 8608 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8609 | HDA_OUTPUT)); |
| 8610 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8611 | return err; |
| 8612 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8613 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8614 | "Speaker Playback Switch", |
| 8615 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8616 | HDA_OUTPUT)); |
| 8617 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8618 | return err; |
| 8619 | } |
| 8620 | } |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 8621 | nid = cfg->hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8622 | if (nid) { |
| 8623 | /* spec->multiout.hp_nid = 2; */ |
| 8624 | if (nid == 0x16) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8625 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 8626 | "Headphone Playback Volume", |
| 8627 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
| 8628 | HDA_OUTPUT)); |
| 8629 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8630 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8631 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8632 | "Headphone Playback Switch", |
| 8633 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 8634 | HDA_OUTPUT)); |
| 8635 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8636 | return err; |
| 8637 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8638 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 8639 | "Headphone Playback Switch", |
| 8640 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 8641 | HDA_OUTPUT)); |
| 8642 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8643 | return err; |
| 8644 | } |
| 8645 | } |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8646 | return 0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8647 | } |
| 8648 | |
| 8649 | /* identical with ALC880 */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8650 | #define alc262_auto_create_analog_input_ctls \ |
| 8651 | alc880_auto_create_analog_input_ctls |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8652 | |
| 8653 | /* |
| 8654 | * generic initialization of ADC, input mixers and output mixers |
| 8655 | */ |
| 8656 | static struct hda_verb alc262_volume_init_verbs[] = { |
| 8657 | /* |
| 8658 | * Unmute ADC0-2 and set the default input to mic-in |
| 8659 | */ |
| 8660 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8661 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8662 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8663 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8664 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8665 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8666 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8667 | /* 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] | 8668 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8669 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8670 | * front panel mic (mic 2) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8671 | */ |
| 8672 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8673 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8674 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8675 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8676 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8677 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8678 | |
| 8679 | /* |
| 8680 | * Set up output mixers (0x0c - 0x0f) |
| 8681 | */ |
| 8682 | /* set vol=0 to output mixers */ |
| 8683 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8684 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8685 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8686 | |
| 8687 | /* set up input amps for analog loopback */ |
| 8688 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8689 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8690 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8691 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8692 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8693 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8694 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8695 | |
| 8696 | /* FIXME: use matrix-type input source selection */ |
| 8697 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8698 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8699 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8700 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8701 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8702 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8703 | /* Input mixer2 */ |
| 8704 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8705 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8706 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8707 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8708 | /* Input mixer3 */ |
| 8709 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8710 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, |
| 8711 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, |
| 8712 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, |
| 8713 | |
| 8714 | { } |
| 8715 | }; |
| 8716 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8717 | static struct hda_verb alc262_HP_BPC_init_verbs[] = { |
| 8718 | /* |
| 8719 | * Unmute ADC0-2 and set the default input to mic-in |
| 8720 | */ |
| 8721 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8722 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8723 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8724 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8725 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8726 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8727 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8728 | /* 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] | 8729 | * mixer widget |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8730 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 8731 | * front panel mic (mic 2) |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8732 | */ |
| 8733 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8734 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8735 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8736 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8737 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8738 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8739 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8740 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 8741 | |
| 8742 | /* |
| 8743 | * Set up output mixers (0x0c - 0x0e) |
| 8744 | */ |
| 8745 | /* set vol=0 to output mixers */ |
| 8746 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8747 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8748 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8749 | |
| 8750 | /* set up input amps for analog loopback */ |
| 8751 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8752 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8753 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8754 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8755 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8756 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8757 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8758 | |
| 8759 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 8760 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8761 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 8762 | |
| 8763 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8764 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8765 | |
| 8766 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8767 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8768 | |
| 8769 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8770 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8771 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 8772 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8773 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 8774 | |
| 8775 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8776 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8777 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8778 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8779 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8780 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8781 | |
| 8782 | |
| 8783 | /* FIXME: use matrix-type input source selection */ |
| 8784 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8785 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8786 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8787 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8788 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8789 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8790 | /* Input mixer2 */ |
| 8791 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8792 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8793 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8794 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8795 | /* Input mixer3 */ |
| 8796 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8797 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8798 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8799 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8800 | |
| 8801 | { } |
| 8802 | }; |
| 8803 | |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8804 | static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { |
| 8805 | /* |
| 8806 | * Unmute ADC0-2 and set the default input to mic-in |
| 8807 | */ |
| 8808 | {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8809 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8810 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8811 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8812 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8813 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8814 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8815 | /* 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] | 8816 | * mixer widget |
| 8817 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 8818 | * panel mic (mic 2) |
| 8819 | */ |
| 8820 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8821 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 8822 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 8823 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 8824 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 8825 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 8826 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 8827 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
| 8828 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8829 | /* |
| 8830 | * Set up output mixers (0x0c - 0x0e) |
| 8831 | */ |
| 8832 | /* set vol=0 to output mixers */ |
| 8833 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8834 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8835 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 8836 | |
| 8837 | /* set up input amps for analog loopback */ |
| 8838 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 8839 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8840 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8841 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8842 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8843 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 8844 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 8845 | |
| 8846 | |
| 8847 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP */ |
| 8848 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Mono */ |
| 8849 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* rear MIC */ |
| 8850 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* Line in */ |
| 8851 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ |
| 8852 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Line out */ |
| 8853 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD in */ |
| 8854 | |
| 8855 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8856 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 8857 | |
| 8858 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 8859 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 8860 | |
| 8861 | /* {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, */ |
| 8862 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8863 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8864 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, |
| 8865 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8866 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, |
| 8867 | |
| 8868 | /* FIXME: use matrix-type input source selection */ |
| 8869 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 8870 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 8871 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, /*rear MIC*/ |
| 8872 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /*Line in*/ |
| 8873 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, /*F MIC*/ |
| 8874 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, /*Front*/ |
| 8875 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, /*CD*/ |
| 8876 | /* {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8877 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, /*HP*/ |
| 8878 | /* Input mixer2 */ |
| 8879 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8880 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8881 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8882 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8883 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8884 | /* {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8885 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8886 | /* Input mixer3 */ |
| 8887 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 8888 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, |
| 8889 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, |
| 8890 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, |
| 8891 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, |
| 8892 | /* {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x06 << 8))}, */ |
| 8893 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x07 << 8))}, |
| 8894 | |
| 8895 | { } |
| 8896 | }; |
| 8897 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 8898 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 8899 | #define alc262_loopbacks alc880_loopbacks |
| 8900 | #endif |
| 8901 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8902 | /* pcm configuration: identiacal with ALC880 */ |
| 8903 | #define alc262_pcm_analog_playback alc880_pcm_analog_playback |
| 8904 | #define alc262_pcm_analog_capture alc880_pcm_analog_capture |
| 8905 | #define alc262_pcm_digital_playback alc880_pcm_digital_playback |
| 8906 | #define alc262_pcm_digital_capture alc880_pcm_digital_capture |
| 8907 | |
| 8908 | /* |
| 8909 | * BIOS auto configuration |
| 8910 | */ |
| 8911 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 8912 | { |
| 8913 | struct alc_spec *spec = codec->spec; |
| 8914 | int err; |
| 8915 | static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
| 8916 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8917 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 8918 | alc262_ignore); |
| 8919 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8920 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8921 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8922 | return 0; /* can't find valid BIOS pin config */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 8923 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 8924 | if (err < 0) |
| 8925 | return err; |
| 8926 | err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 8927 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8928 | return err; |
| 8929 | |
| 8930 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 8931 | |
| 8932 | if (spec->autocfg.dig_out_pin) |
| 8933 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
| 8934 | if (spec->autocfg.dig_in_pin) |
| 8935 | spec->dig_in_nid = ALC262_DIGIN_NID; |
| 8936 | |
| 8937 | if (spec->kctl_alloc) |
| 8938 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 8939 | |
| 8940 | spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 8941 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8942 | spec->input_mux = &spec->private_imux; |
| 8943 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 8944 | err = alc_auto_add_mic_boost(codec); |
| 8945 | if (err < 0) |
| 8946 | return err; |
| 8947 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8948 | return 1; |
| 8949 | } |
| 8950 | |
| 8951 | #define alc262_auto_init_multi_out alc882_auto_init_multi_out |
| 8952 | #define alc262_auto_init_hp_out alc882_auto_init_hp_out |
| 8953 | #define alc262_auto_init_analog_input alc882_auto_init_analog_input |
| 8954 | |
| 8955 | |
| 8956 | /* init callback for auto-configuration model -- overriding the default init */ |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 8957 | static void alc262_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8958 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8959 | alc262_auto_init_multi_out(codec); |
| 8960 | alc262_auto_init_hp_out(codec); |
| 8961 | alc262_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 8962 | } |
| 8963 | |
| 8964 | /* |
| 8965 | * configuration and preset |
| 8966 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8967 | static const char *alc262_models[ALC262_MODEL_LAST] = { |
| 8968 | [ALC262_BASIC] = "basic", |
| 8969 | [ALC262_HIPPO] = "hippo", |
| 8970 | [ALC262_HIPPO_1] = "hippo_1", |
| 8971 | [ALC262_FUJITSU] = "fujitsu", |
| 8972 | [ALC262_HP_BPC] = "hp-bpc", |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8973 | [ALC262_HP_BPC_D7000_WL]= "hp-bpc-d7000", |
Takashi Iwai | 61dc35d | 2007-11-14 12:26:44 +0100 | [diff] [blame] | 8974 | [ALC262_HP_TC_T5735] = "hp-tc-t5735", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 8975 | [ALC262_HP_RP5700] = "hp-rp5700", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8976 | [ALC262_BENQ_ED8] = "benq", |
Takashi Iwai | 0f40502 | 2007-07-06 12:24:11 +0200 | [diff] [blame] | 8977 | [ALC262_BENQ_T31] = "benq-t31", |
| 8978 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 8979 | [ALC262_ULTRA] = "ultra", |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 8980 | [ALC262_AUTO] = "auto", |
| 8981 | }; |
| 8982 | |
| 8983 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
| 8984 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
| 8985 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8986 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8987 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
| 8988 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), |
Kailang Yang | 7d87de2 | 2007-06-05 12:17:21 +0200 | [diff] [blame] | 8989 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8990 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8991 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), |
Takashi Iwai | b98f933 | 2007-11-07 14:18:01 +0100 | [diff] [blame] | 8992 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8993 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8994 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8995 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8996 | SND_PCI_QUIRK(0x103c, 0x2803, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8997 | SND_PCI_QUIRK(0x103c, 0x2804, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 8998 | SND_PCI_QUIRK(0x103c, 0x2805, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 8999 | SND_PCI_QUIRK(0x103c, 0x2806, "HP D7000", ALC262_HP_BPC_D7000_WL), |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9000 | SND_PCI_QUIRK(0x103c, 0x2807, "HP D7000", ALC262_HP_BPC_D7000_WF), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9001 | SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), |
| 9002 | SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), |
| 9003 | SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9004 | SND_PCI_QUIRK(0x103c, 0x302f, "HP Thin Client T5735", |
| 9005 | ALC262_HP_TC_T5735), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9006 | SND_PCI_QUIRK(0x103c, 0x2817, "HP RP5700", ALC262_HP_RP5700), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9007 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9008 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9009 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9010 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
| 9011 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9012 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9013 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9014 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9015 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9016 | SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9017 | {} |
| 9018 | }; |
| 9019 | |
| 9020 | static struct alc_config_preset alc262_presets[] = { |
| 9021 | [ALC262_BASIC] = { |
| 9022 | .mixers = { alc262_base_mixer }, |
| 9023 | .init_verbs = { alc262_init_verbs }, |
| 9024 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9025 | .dac_nids = alc262_dac_nids, |
| 9026 | .hp_nid = 0x03, |
| 9027 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9028 | .channel_mode = alc262_modes, |
Takashi Iwai | a3bcba3 | 2005-12-06 19:05:29 +0100 | [diff] [blame] | 9029 | .input_mux = &alc262_capture_source, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9030 | }, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9031 | [ALC262_HIPPO] = { |
| 9032 | .mixers = { alc262_base_mixer }, |
| 9033 | .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, |
| 9034 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9035 | .dac_nids = alc262_dac_nids, |
| 9036 | .hp_nid = 0x03, |
| 9037 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9038 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9039 | .channel_mode = alc262_modes, |
| 9040 | .input_mux = &alc262_capture_source, |
| 9041 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9042 | .init_hook = alc262_hippo_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9043 | }, |
| 9044 | [ALC262_HIPPO_1] = { |
| 9045 | .mixers = { alc262_hippo1_mixer }, |
| 9046 | .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, |
| 9047 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9048 | .dac_nids = alc262_dac_nids, |
| 9049 | .hp_nid = 0x02, |
| 9050 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9051 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9052 | .channel_mode = alc262_modes, |
| 9053 | .input_mux = &alc262_capture_source, |
| 9054 | .unsol_event = alc262_hippo1_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9055 | .init_hook = alc262_hippo1_automute, |
Kailang Yang | ccc656c | 2006-10-17 12:32:26 +0200 | [diff] [blame] | 9056 | }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9057 | [ALC262_FUJITSU] = { |
| 9058 | .mixers = { alc262_fujitsu_mixer }, |
Takashi Iwai | 39d3ed3 | 2007-10-12 15:03:48 +0200 | [diff] [blame] | 9059 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
| 9060 | alc262_fujitsu_unsol_verbs }, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9061 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9062 | .dac_nids = alc262_dac_nids, |
| 9063 | .hp_nid = 0x03, |
| 9064 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9065 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9066 | .channel_mode = alc262_modes, |
| 9067 | .input_mux = &alc262_fujitsu_capture_source, |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9068 | .unsol_event = alc262_fujitsu_unsol_event, |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9069 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9070 | [ALC262_HP_BPC] = { |
| 9071 | .mixers = { alc262_HP_BPC_mixer }, |
| 9072 | .init_verbs = { alc262_HP_BPC_init_verbs }, |
| 9073 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9074 | .dac_nids = alc262_dac_nids, |
| 9075 | .hp_nid = 0x03, |
| 9076 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9077 | .channel_mode = alc262_modes, |
| 9078 | .input_mux = &alc262_HP_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9079 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9080 | [ALC262_HP_BPC_D7000_WF] = { |
| 9081 | .mixers = { alc262_HP_BPC_WildWest_mixer }, |
| 9082 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9083 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9084 | .dac_nids = alc262_dac_nids, |
| 9085 | .hp_nid = 0x03, |
| 9086 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9087 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9088 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9089 | }, |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9090 | [ALC262_HP_BPC_D7000_WL] = { |
| 9091 | .mixers = { alc262_HP_BPC_WildWest_mixer, |
| 9092 | alc262_HP_BPC_WildWest_option_mixer }, |
| 9093 | .init_verbs = { alc262_HP_BPC_WildWest_init_verbs }, |
| 9094 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9095 | .dac_nids = alc262_dac_nids, |
| 9096 | .hp_nid = 0x03, |
| 9097 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9098 | .channel_mode = alc262_modes, |
zhejiang | accbe49 | 2007-08-31 12:36:05 +0200 | [diff] [blame] | 9099 | .input_mux = &alc262_HP_D7000_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9100 | }, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9101 | [ALC262_HP_TC_T5735] = { |
| 9102 | .mixers = { alc262_hp_t5735_mixer }, |
| 9103 | .init_verbs = { alc262_init_verbs, alc262_hp_t5735_verbs }, |
| 9104 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9105 | .dac_nids = alc262_dac_nids, |
| 9106 | .hp_nid = 0x03, |
| 9107 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9108 | .channel_mode = alc262_modes, |
| 9109 | .input_mux = &alc262_capture_source, |
| 9110 | .unsol_event = alc262_hp_t5735_unsol_event, |
| 9111 | .init_hook = alc262_hp_t5735_init_hook, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 9112 | }, |
| 9113 | [ALC262_HP_RP5700] = { |
| 9114 | .mixers = { alc262_hp_rp5700_mixer }, |
| 9115 | .init_verbs = { alc262_init_verbs, alc262_hp_rp5700_verbs }, |
| 9116 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9117 | .dac_nids = alc262_dac_nids, |
| 9118 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9119 | .channel_mode = alc262_modes, |
| 9120 | .input_mux = &alc262_hp_rp5700_capture_source, |
Kailang Yang | 66d2a9d | 2007-11-14 12:06:21 +0100 | [diff] [blame] | 9121 | }, |
Takashi Iwai | 304dcaa | 2006-07-25 14:51:16 +0200 | [diff] [blame] | 9122 | [ALC262_BENQ_ED8] = { |
| 9123 | .mixers = { alc262_base_mixer }, |
| 9124 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, |
| 9125 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9126 | .dac_nids = alc262_dac_nids, |
| 9127 | .hp_nid = 0x03, |
| 9128 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9129 | .channel_mode = alc262_modes, |
| 9130 | .input_mux = &alc262_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9131 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9132 | [ALC262_SONY_ASSAMD] = { |
| 9133 | .mixers = { alc262_sony_mixer }, |
| 9134 | .init_verbs = { alc262_init_verbs, alc262_sony_unsol_verbs}, |
| 9135 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9136 | .dac_nids = alc262_dac_nids, |
| 9137 | .hp_nid = 0x02, |
| 9138 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9139 | .channel_mode = alc262_modes, |
| 9140 | .input_mux = &alc262_capture_source, |
| 9141 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9142 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 9143 | }, |
| 9144 | [ALC262_BENQ_T31] = { |
| 9145 | .mixers = { alc262_benq_t31_mixer }, |
| 9146 | .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs, alc262_hippo_unsol_verbs }, |
| 9147 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9148 | .dac_nids = alc262_dac_nids, |
| 9149 | .hp_nid = 0x03, |
| 9150 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9151 | .channel_mode = alc262_modes, |
| 9152 | .input_mux = &alc262_capture_source, |
| 9153 | .unsol_event = alc262_hippo_unsol_event, |
Takashi Iwai | 5b31954 | 2007-07-26 11:49:22 +0200 | [diff] [blame] | 9154 | .init_hook = alc262_hippo_automute, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 9155 | }, |
Tobin Davis | f651b50 | 2007-10-26 12:40:47 +0200 | [diff] [blame] | 9156 | [ALC262_ULTRA] = { |
| 9157 | .mixers = { alc262_ultra_mixer }, |
| 9158 | .init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, |
| 9159 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
| 9160 | .dac_nids = alc262_dac_nids, |
| 9161 | .hp_nid = 0x03, |
| 9162 | .dig_out_nid = ALC262_DIGOUT_NID, |
| 9163 | .num_channel_mode = ARRAY_SIZE(alc262_modes), |
| 9164 | .channel_mode = alc262_modes, |
| 9165 | .input_mux = &alc262_ultra_capture_source, |
| 9166 | .unsol_event = alc262_ultra_unsol_event, |
| 9167 | .init_hook = alc262_ultra_automute, |
| 9168 | }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9169 | }; |
| 9170 | |
| 9171 | static int patch_alc262(struct hda_codec *codec) |
| 9172 | { |
| 9173 | struct alc_spec *spec; |
| 9174 | int board_config; |
| 9175 | int err; |
| 9176 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 9177 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9178 | if (spec == NULL) |
| 9179 | return -ENOMEM; |
| 9180 | |
| 9181 | codec->spec = spec; |
| 9182 | #if 0 |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9183 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 9184 | * under-run |
| 9185 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9186 | { |
| 9187 | int tmp; |
| 9188 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9189 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 9190 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 9191 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 9192 | } |
| 9193 | #endif |
| 9194 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9195 | board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, |
| 9196 | alc262_models, |
| 9197 | alc262_cfg_tbl); |
Kailang Yang | cd7509a | 2007-01-26 18:33:17 +0100 | [diff] [blame] | 9198 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 9199 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9200 | printk(KERN_INFO "hda_codec: Unknown model for ALC262, " |
| 9201 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9202 | board_config = ALC262_AUTO; |
| 9203 | } |
| 9204 | |
| 9205 | if (board_config == ALC262_AUTO) { |
| 9206 | /* automatic parse from the BIOS config */ |
| 9207 | err = alc262_parse_auto_config(codec); |
| 9208 | if (err < 0) { |
| 9209 | alc_free(codec); |
| 9210 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9211 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 9212 | printk(KERN_INFO |
| 9213 | "hda_codec: Cannot set up configuration " |
| 9214 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9215 | board_config = ALC262_BASIC; |
| 9216 | } |
| 9217 | } |
| 9218 | |
| 9219 | if (board_config != ALC262_AUTO) |
| 9220 | setup_preset(spec, &alc262_presets[board_config]); |
| 9221 | |
| 9222 | spec->stream_name_analog = "ALC262 Analog"; |
| 9223 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
| 9224 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
| 9225 | |
| 9226 | spec->stream_name_digital = "ALC262 Digital"; |
| 9227 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
| 9228 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
| 9229 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9230 | if (!spec->adc_nids && spec->input_mux) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9231 | /* check whether NID 0x07 is valid */ |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 9232 | unsigned int wcap = get_wcaps(codec, 0x07); |
| 9233 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9234 | /* get type */ |
| 9235 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9236 | if (wcap != AC_WID_AUD_IN) { |
| 9237 | spec->adc_nids = alc262_adc_nids_alt; |
| 9238 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 9239 | spec->mixers[spec->num_mixers] = |
| 9240 | alc262_capture_alt_mixer; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9241 | spec->num_mixers++; |
| 9242 | } else { |
| 9243 | spec->adc_nids = alc262_adc_nids; |
| 9244 | spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); |
| 9245 | spec->mixers[spec->num_mixers] = alc262_capture_mixer; |
| 9246 | spec->num_mixers++; |
| 9247 | } |
| 9248 | } |
| 9249 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 9250 | spec->vmaster_nid = 0x0c; |
| 9251 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9252 | codec->patch_ops = alc_patch_ops; |
| 9253 | if (board_config == ALC262_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 9254 | spec->init_hook = alc262_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 9255 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 9256 | if (!spec->loopback.amplist) |
| 9257 | spec->loopback.amplist = alc262_loopbacks; |
| 9258 | #endif |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 9259 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9260 | return 0; |
| 9261 | } |
| 9262 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 9263 | /* |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9264 | * ALC268 channel source setting (2 channel) |
| 9265 | */ |
| 9266 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
| 9267 | #define alc268_modes alc260_modes |
| 9268 | |
| 9269 | static hda_nid_t alc268_dac_nids[2] = { |
| 9270 | /* front, hp */ |
| 9271 | 0x02, 0x03 |
| 9272 | }; |
| 9273 | |
| 9274 | static hda_nid_t alc268_adc_nids[2] = { |
| 9275 | /* ADC0-1 */ |
| 9276 | 0x08, 0x07 |
| 9277 | }; |
| 9278 | |
| 9279 | static hda_nid_t alc268_adc_nids_alt[1] = { |
| 9280 | /* ADC0 */ |
| 9281 | 0x08 |
| 9282 | }; |
| 9283 | |
| 9284 | static struct snd_kcontrol_new alc268_base_mixer[] = { |
| 9285 | /* output mixer control */ |
| 9286 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9287 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9288 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9289 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9290 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9291 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 9292 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9293 | { } |
| 9294 | }; |
| 9295 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9296 | static struct hda_verb alc268_eapd_verbs[] = { |
| 9297 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9298 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 9299 | { } |
| 9300 | }; |
| 9301 | |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9302 | /* Toshiba specific */ |
| 9303 | #define alc268_toshiba_automute alc262_hippo_automute |
| 9304 | |
| 9305 | static struct hda_verb alc268_toshiba_verbs[] = { |
| 9306 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9307 | { } /* end */ |
| 9308 | }; |
| 9309 | |
| 9310 | /* Acer specific */ |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9311 | /* bind volumes of both NID 0x02 and 0x03 */ |
Takashi Iwai | 6bc9685 | 2007-08-17 09:02:12 +0200 | [diff] [blame] | 9312 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
| 9313 | .ops = &snd_hda_bind_vol, |
| 9314 | .values = { |
| 9315 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), |
| 9316 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), |
| 9317 | 0 |
| 9318 | }, |
| 9319 | }; |
| 9320 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9321 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9322 | static void alc268_acer_automute(struct hda_codec *codec, int force) |
| 9323 | { |
| 9324 | struct alc_spec *spec = codec->spec; |
| 9325 | unsigned int mute; |
| 9326 | |
| 9327 | if (force || !spec->sense_updated) { |
| 9328 | unsigned int present; |
| 9329 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 9330 | AC_VERB_GET_PIN_SENSE, 0); |
| 9331 | spec->jack_present = (present & 0x80000000) != 0; |
| 9332 | spec->sense_updated = 1; |
| 9333 | } |
| 9334 | if (spec->jack_present) |
| 9335 | mute = HDA_AMP_MUTE; /* mute internal speaker */ |
| 9336 | else /* unmute internal speaker if necessary */ |
| 9337 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 9338 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 9339 | HDA_AMP_MUTE, mute); |
| 9340 | } |
| 9341 | |
| 9342 | |
| 9343 | /* bind hp and internal speaker mute (with plug check) */ |
| 9344 | static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, |
| 9345 | struct snd_ctl_elem_value *ucontrol) |
| 9346 | { |
| 9347 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9348 | long *valp = ucontrol->value.integer.value; |
| 9349 | int change; |
| 9350 | |
| 9351 | change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, |
| 9352 | HDA_AMP_MUTE, |
| 9353 | valp[0] ? 0 : HDA_AMP_MUTE); |
| 9354 | change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, |
| 9355 | HDA_AMP_MUTE, |
| 9356 | valp[1] ? 0 : HDA_AMP_MUTE); |
| 9357 | if (change) |
| 9358 | alc268_acer_automute(codec, 0); |
| 9359 | return change; |
| 9360 | } |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9361 | |
| 9362 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
| 9363 | /* output mixer control */ |
| 9364 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
| 9365 | { |
| 9366 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9367 | .name = "Master Playback Switch", |
| 9368 | .info = snd_hda_mixer_amp_switch_info, |
| 9369 | .get = snd_hda_mixer_amp_switch_get, |
| 9370 | .put = alc268_acer_master_sw_put, |
| 9371 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), |
| 9372 | }, |
Takashi Iwai | 33bf17a | 2007-08-21 11:51:42 +0200 | [diff] [blame] | 9373 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9374 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9375 | HDA_CODEC_VOLUME("Line In Boost", 0x1a, 0, HDA_INPUT), |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9376 | { } |
| 9377 | }; |
| 9378 | |
| 9379 | static struct hda_verb alc268_acer_verbs[] = { |
| 9380 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9381 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 9382 | |
| 9383 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9384 | { } |
| 9385 | }; |
| 9386 | |
| 9387 | /* unsolicited event for HP jack sensing */ |
| 9388 | static void alc268_toshiba_unsol_event(struct hda_codec *codec, |
| 9389 | unsigned int res) |
| 9390 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9391 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9392 | return; |
| 9393 | alc268_toshiba_automute(codec); |
| 9394 | } |
| 9395 | |
| 9396 | static void alc268_acer_unsol_event(struct hda_codec *codec, |
| 9397 | unsigned int res) |
| 9398 | { |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9399 | if ((res >> 26) != ALC880_HP_EVENT) |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9400 | return; |
| 9401 | alc268_acer_automute(codec, 1); |
| 9402 | } |
| 9403 | |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9404 | static void alc268_acer_init_hook(struct hda_codec *codec) |
| 9405 | { |
| 9406 | alc268_acer_automute(codec, 1); |
| 9407 | } |
| 9408 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9409 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
| 9410 | /* output mixer control */ |
| 9411 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9412 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9413 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9414 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9415 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 9416 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
| 9417 | { } |
| 9418 | }; |
| 9419 | |
| 9420 | static struct hda_verb alc268_dell_verbs[] = { |
| 9421 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9422 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 9423 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
| 9424 | { } |
| 9425 | }; |
| 9426 | |
| 9427 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
| 9428 | static void alc268_dell_automute(struct hda_codec *codec) |
| 9429 | { |
| 9430 | unsigned int present; |
| 9431 | unsigned int mute; |
| 9432 | |
| 9433 | present = snd_hda_codec_read(codec, 0x15, 0, AC_VERB_GET_PIN_SENSE, 0); |
| 9434 | if (present & 0x80000000) |
| 9435 | mute = HDA_AMP_MUTE; |
| 9436 | else |
| 9437 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); |
| 9438 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 9439 | HDA_AMP_MUTE, mute); |
| 9440 | } |
| 9441 | |
| 9442 | static void alc268_dell_unsol_event(struct hda_codec *codec, |
| 9443 | unsigned int res) |
| 9444 | { |
| 9445 | if ((res >> 26) != ALC880_HP_EVENT) |
| 9446 | return; |
| 9447 | alc268_dell_automute(codec); |
| 9448 | } |
| 9449 | |
| 9450 | #define alc268_dell_init_hook alc268_dell_automute |
| 9451 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9452 | /* |
| 9453 | * generic initialization of ADC, input mixers and output mixers |
| 9454 | */ |
| 9455 | static struct hda_verb alc268_base_init_verbs[] = { |
| 9456 | /* Unmute DAC0-1 and set vol = 0 */ |
| 9457 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9458 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9459 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9460 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9461 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9462 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9463 | |
| 9464 | /* |
| 9465 | * Set up output mixers (0x0c - 0x0e) |
| 9466 | */ |
| 9467 | /* set vol=0 to output mixers */ |
| 9468 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9469 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9470 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9471 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9472 | |
| 9473 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9474 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9475 | |
| 9476 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9477 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, |
| 9478 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, |
| 9479 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9480 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9481 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9482 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9483 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9484 | |
| 9485 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9486 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9487 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9488 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9489 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9490 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9491 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9492 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, |
| 9493 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9494 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
| 9495 | |
| 9496 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9497 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 9498 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 9499 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9500 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9501 | { } |
| 9502 | }; |
| 9503 | |
| 9504 | /* |
| 9505 | * generic initialization of ADC, input mixers and output mixers |
| 9506 | */ |
| 9507 | static struct hda_verb alc268_volume_init_verbs[] = { |
| 9508 | /* set output DAC */ |
| 9509 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9510 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9511 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9512 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9513 | |
| 9514 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9515 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
| 9516 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9517 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9518 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
| 9519 | |
| 9520 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 9521 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9522 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 9523 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9524 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 9525 | |
| 9526 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9527 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9528 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9529 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 9530 | |
| 9531 | /* set PCBEEP vol = 0 */ |
| 9532 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, |
| 9533 | |
| 9534 | { } |
| 9535 | }; |
| 9536 | |
| 9537 | #define alc268_mux_enum_info alc_mux_enum_info |
| 9538 | #define alc268_mux_enum_get alc_mux_enum_get |
| 9539 | |
| 9540 | static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 9541 | struct snd_ctl_elem_value *ucontrol) |
| 9542 | { |
| 9543 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 9544 | struct alc_spec *spec = codec->spec; |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9545 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9546 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 9547 | static hda_nid_t capture_mixers[3] = { 0x23, 0x24 }; |
| 9548 | hda_nid_t nid = capture_mixers[adc_idx]; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9549 | |
Jiang Zhe | a9b3aa8 | 2007-12-20 13:13:13 +0100 | [diff] [blame] | 9550 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
| 9551 | nid, |
| 9552 | &spec->cur_mux[adc_idx]); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9553 | } |
| 9554 | |
| 9555 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
| 9556 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9557 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9558 | { |
| 9559 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9560 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9561 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9562 | */ |
| 9563 | /* .name = "Capture Source", */ |
| 9564 | .name = "Input Source", |
| 9565 | .count = 1, |
| 9566 | .info = alc268_mux_enum_info, |
| 9567 | .get = alc268_mux_enum_get, |
| 9568 | .put = alc268_mux_enum_put, |
| 9569 | }, |
| 9570 | { } /* end */ |
| 9571 | }; |
| 9572 | |
| 9573 | static struct snd_kcontrol_new alc268_capture_mixer[] = { |
| 9574 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9575 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
| 9576 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9577 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
| 9578 | { |
| 9579 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 9580 | /* The multiple "Capture Source" controls confuse alsamixer |
| 9581 | * So call somewhat different.. |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9582 | */ |
| 9583 | /* .name = "Capture Source", */ |
| 9584 | .name = "Input Source", |
| 9585 | .count = 2, |
| 9586 | .info = alc268_mux_enum_info, |
| 9587 | .get = alc268_mux_enum_get, |
| 9588 | .put = alc268_mux_enum_put, |
| 9589 | }, |
| 9590 | { } /* end */ |
| 9591 | }; |
| 9592 | |
| 9593 | static struct hda_input_mux alc268_capture_source = { |
| 9594 | .num_items = 4, |
| 9595 | .items = { |
| 9596 | { "Mic", 0x0 }, |
| 9597 | { "Front Mic", 0x1 }, |
| 9598 | { "Line", 0x2 }, |
| 9599 | { "CD", 0x3 }, |
| 9600 | }, |
| 9601 | }; |
| 9602 | |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9603 | #ifdef CONFIG_SND_DEBUG |
| 9604 | static struct snd_kcontrol_new alc268_test_mixer[] = { |
| 9605 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 9606 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 9607 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 9608 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 9609 | |
| 9610 | /* Volume widgets */ |
| 9611 | HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 9612 | HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 9613 | HDA_BIND_MUTE_MONO("Mono sum Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 9614 | HDA_BIND_MUTE("LINE-OUT sum Playback Switch", 0x0f, 2, HDA_INPUT), |
| 9615 | HDA_BIND_MUTE("HP-OUT sum Playback Switch", 0x10, 2, HDA_INPUT), |
| 9616 | HDA_BIND_MUTE("LINE-OUT Playback Switch", 0x14, 2, HDA_OUTPUT), |
| 9617 | HDA_BIND_MUTE("HP-OUT Playback Switch", 0x15, 2, HDA_OUTPUT), |
| 9618 | HDA_BIND_MUTE("Mono Playback Switch", 0x16, 2, HDA_OUTPUT), |
| 9619 | HDA_CODEC_VOLUME("MIC1 Capture Volume", 0x18, 0x0, HDA_INPUT), |
| 9620 | HDA_BIND_MUTE("MIC1 Capture Switch", 0x18, 2, HDA_OUTPUT), |
| 9621 | HDA_CODEC_VOLUME("MIC2 Capture Volume", 0x19, 0x0, HDA_INPUT), |
| 9622 | HDA_CODEC_VOLUME("LINE1 Capture Volume", 0x1a, 0x0, HDA_INPUT), |
| 9623 | HDA_BIND_MUTE("LINE1 Capture Switch", 0x1a, 2, HDA_OUTPUT), |
Takashi Iwai | f0747ee | 2008-01-15 11:41:41 +0100 | [diff] [blame] | 9624 | /* The below appears problematic on some hardwares */ |
| 9625 | /*HDA_CODEC_VOLUME("PCBEEP Playback Volume", 0x1d, 0x0, HDA_INPUT),*/ |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9626 | HDA_CODEC_VOLUME("PCM-IN1 Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
| 9627 | HDA_BIND_MUTE("PCM-IN1 Capture Switch", 0x23, 2, HDA_OUTPUT), |
| 9628 | HDA_CODEC_VOLUME("PCM-IN2 Capture Volume", 0x24, 0x0, HDA_OUTPUT), |
| 9629 | HDA_BIND_MUTE("PCM-IN2 Capture Switch", 0x24, 2, HDA_OUTPUT), |
| 9630 | |
| 9631 | /* Modes for retasking pin widgets */ |
| 9632 | ALC_PIN_MODE("LINE-OUT pin mode", 0x14, ALC_PIN_DIR_INOUT), |
| 9633 | ALC_PIN_MODE("HP-OUT pin mode", 0x15, ALC_PIN_DIR_INOUT), |
| 9634 | ALC_PIN_MODE("MIC1 pin mode", 0x18, ALC_PIN_DIR_INOUT), |
| 9635 | ALC_PIN_MODE("LINE1 pin mode", 0x1a, ALC_PIN_DIR_INOUT), |
| 9636 | |
| 9637 | /* Controls for GPIO pins, assuming they are configured as outputs */ |
| 9638 | ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), |
| 9639 | ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), |
| 9640 | ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), |
| 9641 | ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), |
| 9642 | |
| 9643 | /* Switches to allow the digital SPDIF output pin to be enabled. |
| 9644 | * The ALC268 does not have an SPDIF input. |
| 9645 | */ |
| 9646 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x06, 0x01), |
| 9647 | |
| 9648 | /* A switch allowing EAPD to be enabled. Some laptops seem to use |
| 9649 | * this output to turn on an external amplifier. |
| 9650 | */ |
| 9651 | ALC_EAPD_CTRL_SWITCH("LINE-OUT EAPD Enable Switch", 0x0f, 0x02), |
| 9652 | ALC_EAPD_CTRL_SWITCH("HP-OUT EAPD Enable Switch", 0x10, 0x02), |
| 9653 | |
| 9654 | { } /* end */ |
| 9655 | }; |
| 9656 | #endif |
| 9657 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9658 | /* create input playback/capture controls for the given pin */ |
| 9659 | static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid, |
| 9660 | const char *ctlname, int idx) |
| 9661 | { |
| 9662 | char name[32]; |
| 9663 | int err; |
| 9664 | |
| 9665 | sprintf(name, "%s Playback Volume", ctlname); |
| 9666 | if (nid == 0x14) { |
| 9667 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9668 | HDA_COMPOSE_AMP_VAL(0x02, 3, idx, |
| 9669 | HDA_OUTPUT)); |
| 9670 | if (err < 0) |
| 9671 | return err; |
| 9672 | } else if (nid == 0x15) { |
| 9673 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 9674 | HDA_COMPOSE_AMP_VAL(0x03, 3, idx, |
| 9675 | HDA_OUTPUT)); |
| 9676 | if (err < 0) |
| 9677 | return err; |
| 9678 | } else |
| 9679 | return -1; |
| 9680 | sprintf(name, "%s Playback Switch", ctlname); |
| 9681 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 9682 | HDA_COMPOSE_AMP_VAL(nid, 3, idx, HDA_OUTPUT)); |
| 9683 | if (err < 0) |
| 9684 | return err; |
| 9685 | return 0; |
| 9686 | } |
| 9687 | |
| 9688 | /* add playback controls from the parsed DAC table */ |
| 9689 | static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 9690 | const struct auto_pin_cfg *cfg) |
| 9691 | { |
| 9692 | hda_nid_t nid; |
| 9693 | int err; |
| 9694 | |
| 9695 | spec->multiout.num_dacs = 2; /* only use one dac */ |
| 9696 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 9697 | spec->multiout.dac_nids[0] = 2; |
| 9698 | spec->multiout.dac_nids[1] = 3; |
| 9699 | |
| 9700 | nid = cfg->line_out_pins[0]; |
| 9701 | if (nid) |
| 9702 | alc268_new_analog_output(spec, nid, "Front", 0); |
| 9703 | |
| 9704 | nid = cfg->speaker_pins[0]; |
| 9705 | if (nid == 0x1d) { |
| 9706 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 9707 | "Speaker Playback Volume", |
| 9708 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); |
| 9709 | if (err < 0) |
| 9710 | return err; |
| 9711 | } |
| 9712 | nid = cfg->hp_pins[0]; |
| 9713 | if (nid) |
| 9714 | alc268_new_analog_output(spec, nid, "Headphone", 0); |
| 9715 | |
| 9716 | nid = cfg->line_out_pins[1] | cfg->line_out_pins[2]; |
| 9717 | if (nid == 0x16) { |
| 9718 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 9719 | "Mono Playback Switch", |
| 9720 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_INPUT)); |
| 9721 | if (err < 0) |
| 9722 | return err; |
| 9723 | } |
| 9724 | return 0; |
| 9725 | } |
| 9726 | |
| 9727 | /* create playback/capture controls for input pins */ |
| 9728 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 9729 | const struct auto_pin_cfg *cfg) |
| 9730 | { |
| 9731 | struct hda_input_mux *imux = &spec->private_imux; |
| 9732 | int i, idx1; |
| 9733 | |
| 9734 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 9735 | switch(cfg->input_pins[i]) { |
| 9736 | case 0x18: |
| 9737 | idx1 = 0; /* Mic 1 */ |
| 9738 | break; |
| 9739 | case 0x19: |
| 9740 | idx1 = 1; /* Mic 2 */ |
| 9741 | break; |
| 9742 | case 0x1a: |
| 9743 | idx1 = 2; /* Line In */ |
| 9744 | break; |
| 9745 | case 0x1c: |
| 9746 | idx1 = 3; /* CD */ |
| 9747 | break; |
| 9748 | default: |
| 9749 | continue; |
| 9750 | } |
| 9751 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
| 9752 | imux->items[imux->num_items].index = idx1; |
| 9753 | imux->num_items++; |
| 9754 | } |
| 9755 | return 0; |
| 9756 | } |
| 9757 | |
| 9758 | static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) |
| 9759 | { |
| 9760 | struct alc_spec *spec = codec->spec; |
| 9761 | hda_nid_t speaker_nid = spec->autocfg.speaker_pins[0]; |
| 9762 | hda_nid_t hp_nid = spec->autocfg.hp_pins[0]; |
| 9763 | hda_nid_t line_nid = spec->autocfg.line_out_pins[0]; |
| 9764 | unsigned int dac_vol1, dac_vol2; |
| 9765 | |
| 9766 | if (speaker_nid) { |
| 9767 | snd_hda_codec_write(codec, speaker_nid, 0, |
| 9768 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); |
| 9769 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9770 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9771 | AMP_IN_UNMUTE(1)); |
| 9772 | snd_hda_codec_write(codec, 0x10, 0, |
| 9773 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 9774 | AMP_IN_UNMUTE(1)); |
| 9775 | } else { |
| 9776 | snd_hda_codec_write(codec, 0x0f, 0, |
| 9777 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9778 | snd_hda_codec_write(codec, 0x10, 0, |
| 9779 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)); |
| 9780 | } |
| 9781 | |
| 9782 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
| 9783 | if (line_nid == 0x14) |
| 9784 | dac_vol2 = AMP_OUT_ZERO; |
| 9785 | else if (line_nid == 0x15) |
| 9786 | dac_vol1 = AMP_OUT_ZERO; |
| 9787 | if (hp_nid == 0x14) |
| 9788 | dac_vol2 = AMP_OUT_ZERO; |
| 9789 | else if (hp_nid == 0x15) |
| 9790 | dac_vol1 = AMP_OUT_ZERO; |
| 9791 | if (line_nid != 0x16 || hp_nid != 0x16 || |
| 9792 | spec->autocfg.line_out_pins[1] != 0x16 || |
| 9793 | spec->autocfg.line_out_pins[2] != 0x16) |
| 9794 | dac_vol1 = dac_vol2 = AMP_OUT_ZERO; |
| 9795 | |
| 9796 | snd_hda_codec_write(codec, 0x02, 0, |
| 9797 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol1); |
| 9798 | snd_hda_codec_write(codec, 0x03, 0, |
| 9799 | AC_VERB_SET_AMP_GAIN_MUTE, dac_vol2); |
| 9800 | } |
| 9801 | |
| 9802 | /* pcm configuration: identiacal with ALC880 */ |
| 9803 | #define alc268_pcm_analog_playback alc880_pcm_analog_playback |
| 9804 | #define alc268_pcm_analog_capture alc880_pcm_analog_capture |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 9805 | #define alc268_pcm_analog_alt_capture alc880_pcm_analog_alt_capture |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9806 | #define alc268_pcm_digital_playback alc880_pcm_digital_playback |
| 9807 | |
| 9808 | /* |
| 9809 | * BIOS auto configuration |
| 9810 | */ |
| 9811 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 9812 | { |
| 9813 | struct alc_spec *spec = codec->spec; |
| 9814 | int err; |
| 9815 | static hda_nid_t alc268_ignore[] = { 0 }; |
| 9816 | |
| 9817 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 9818 | alc268_ignore); |
| 9819 | if (err < 0) |
| 9820 | return err; |
| 9821 | if (!spec->autocfg.line_outs) |
| 9822 | return 0; /* can't find valid BIOS pin config */ |
| 9823 | |
| 9824 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 9825 | if (err < 0) |
| 9826 | return err; |
| 9827 | err = alc268_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 9828 | if (err < 0) |
| 9829 | return err; |
| 9830 | |
| 9831 | spec->multiout.max_channels = 2; |
| 9832 | |
| 9833 | /* digital only support output */ |
| 9834 | if (spec->autocfg.dig_out_pin) |
| 9835 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
| 9836 | |
| 9837 | if (spec->kctl_alloc) |
| 9838 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 9839 | |
| 9840 | spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; |
| 9841 | spec->num_mux_defs = 1; |
| 9842 | spec->input_mux = &spec->private_imux; |
| 9843 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 9844 | err = alc_auto_add_mic_boost(codec); |
| 9845 | if (err < 0) |
| 9846 | return err; |
| 9847 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9848 | return 1; |
| 9849 | } |
| 9850 | |
| 9851 | #define alc268_auto_init_multi_out alc882_auto_init_multi_out |
| 9852 | #define alc268_auto_init_hp_out alc882_auto_init_hp_out |
| 9853 | #define alc268_auto_init_analog_input alc882_auto_init_analog_input |
| 9854 | |
| 9855 | /* init callback for auto-configuration model -- overriding the default init */ |
| 9856 | static void alc268_auto_init(struct hda_codec *codec) |
| 9857 | { |
| 9858 | alc268_auto_init_multi_out(codec); |
| 9859 | alc268_auto_init_hp_out(codec); |
| 9860 | alc268_auto_init_mono_speaker_out(codec); |
| 9861 | alc268_auto_init_analog_input(codec); |
| 9862 | } |
| 9863 | |
| 9864 | /* |
| 9865 | * configuration and preset |
| 9866 | */ |
| 9867 | static const char *alc268_models[ALC268_MODEL_LAST] = { |
| 9868 | [ALC268_3ST] = "3stack", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 9869 | [ALC268_TOSHIBA] = "toshiba", |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9870 | [ALC268_ACER] = "acer", |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9871 | [ALC268_DELL] = "dell", |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9872 | #ifdef CONFIG_SND_DEBUG |
| 9873 | [ALC268_TEST] = "test", |
| 9874 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9875 | [ALC268_AUTO] = "auto", |
| 9876 | }; |
| 9877 | |
| 9878 | static struct snd_pci_quirk alc268_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9879 | SND_PCI_QUIRK(0x1025, 0x0126, "Acer", ALC268_ACER), |
Andy Shevchenko | dafc835 | 2008-01-25 11:53:50 +0100 | [diff] [blame] | 9880 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9881 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
Andy Shevchenko | 29a52c2 | 2008-01-24 17:29:00 +0100 | [diff] [blame] | 9882 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9883 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 9884 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9885 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9886 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
Takashi Iwai | 8e7f00f | 2007-09-07 10:58:58 +0200 | [diff] [blame] | 9887 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
Takashi Iwai | b875bf3 | 2007-09-06 15:00:27 +0200 | [diff] [blame] | 9888 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9889 | {} |
| 9890 | }; |
| 9891 | |
| 9892 | static struct alc_config_preset alc268_presets[] = { |
| 9893 | [ALC268_3ST] = { |
| 9894 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
| 9895 | .init_verbs = { alc268_base_init_verbs }, |
| 9896 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9897 | .dac_nids = alc268_dac_nids, |
| 9898 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9899 | .adc_nids = alc268_adc_nids_alt, |
| 9900 | .hp_nid = 0x03, |
| 9901 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9902 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9903 | .channel_mode = alc268_modes, |
| 9904 | .input_mux = &alc268_capture_source, |
| 9905 | }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9906 | [ALC268_TOSHIBA] = { |
| 9907 | .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9908 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9909 | alc268_toshiba_verbs }, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9910 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9911 | .dac_nids = alc268_dac_nids, |
| 9912 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9913 | .adc_nids = alc268_adc_nids_alt, |
| 9914 | .hp_nid = 0x03, |
| 9915 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9916 | .channel_mode = alc268_modes, |
| 9917 | .input_mux = &alc268_capture_source, |
Takashi Iwai | d273809 | 2007-08-16 14:59:45 +0200 | [diff] [blame] | 9918 | .unsol_event = alc268_toshiba_unsol_event, |
| 9919 | .init_hook = alc268_toshiba_automute, |
| 9920 | }, |
| 9921 | [ALC268_ACER] = { |
| 9922 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, |
| 9923 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9924 | alc268_acer_verbs }, |
| 9925 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9926 | .dac_nids = alc268_dac_nids, |
| 9927 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9928 | .adc_nids = alc268_adc_nids_alt, |
| 9929 | .hp_nid = 0x02, |
| 9930 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9931 | .channel_mode = alc268_modes, |
| 9932 | .input_mux = &alc268_capture_source, |
| 9933 | .unsol_event = alc268_acer_unsol_event, |
Takashi Iwai | 889c439 | 2007-08-23 18:56:52 +0200 | [diff] [blame] | 9934 | .init_hook = alc268_acer_init_hook, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 9935 | }, |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 9936 | [ALC268_DELL] = { |
| 9937 | .mixers = { alc268_dell_mixer }, |
| 9938 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9939 | alc268_dell_verbs }, |
| 9940 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9941 | .dac_nids = alc268_dac_nids, |
| 9942 | .hp_nid = 0x02, |
| 9943 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9944 | .channel_mode = alc268_modes, |
| 9945 | .unsol_event = alc268_dell_unsol_event, |
| 9946 | .init_hook = alc268_dell_init_hook, |
| 9947 | .input_mux = &alc268_capture_source, |
| 9948 | }, |
Jonathan Woithe | 86c53bd | 2008-01-08 12:33:19 +0100 | [diff] [blame] | 9949 | #ifdef CONFIG_SND_DEBUG |
| 9950 | [ALC268_TEST] = { |
| 9951 | .mixers = { alc268_test_mixer, alc268_capture_mixer }, |
| 9952 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
| 9953 | alc268_volume_init_verbs }, |
| 9954 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
| 9955 | .dac_nids = alc268_dac_nids, |
| 9956 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), |
| 9957 | .adc_nids = alc268_adc_nids_alt, |
| 9958 | .hp_nid = 0x03, |
| 9959 | .dig_out_nid = ALC268_DIGOUT_NID, |
| 9960 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
| 9961 | .channel_mode = alc268_modes, |
| 9962 | .input_mux = &alc268_capture_source, |
| 9963 | }, |
| 9964 | #endif |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 9965 | }; |
| 9966 | |
| 9967 | static int patch_alc268(struct hda_codec *codec) |
| 9968 | { |
| 9969 | struct alc_spec *spec; |
| 9970 | int board_config; |
| 9971 | int err; |
| 9972 | |
| 9973 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
| 9974 | if (spec == NULL) |
| 9975 | return -ENOMEM; |
| 9976 | |
| 9977 | codec->spec = spec; |
| 9978 | |
| 9979 | board_config = snd_hda_check_board_config(codec, ALC268_MODEL_LAST, |
| 9980 | alc268_models, |
| 9981 | alc268_cfg_tbl); |
| 9982 | |
| 9983 | if (board_config < 0 || board_config >= ALC268_MODEL_LAST) { |
| 9984 | printk(KERN_INFO "hda_codec: Unknown model for ALC268, " |
| 9985 | "trying auto-probe from BIOS...\n"); |
| 9986 | board_config = ALC268_AUTO; |
| 9987 | } |
| 9988 | |
| 9989 | if (board_config == ALC268_AUTO) { |
| 9990 | /* automatic parse from the BIOS config */ |
| 9991 | err = alc268_parse_auto_config(codec); |
| 9992 | if (err < 0) { |
| 9993 | alc_free(codec); |
| 9994 | return err; |
| 9995 | } else if (!err) { |
| 9996 | printk(KERN_INFO |
| 9997 | "hda_codec: Cannot set up configuration " |
| 9998 | "from BIOS. Using base mode...\n"); |
| 9999 | board_config = ALC268_3ST; |
| 10000 | } |
| 10001 | } |
| 10002 | |
| 10003 | if (board_config != ALC268_AUTO) |
| 10004 | setup_preset(spec, &alc268_presets[board_config]); |
| 10005 | |
| 10006 | spec->stream_name_analog = "ALC268 Analog"; |
| 10007 | spec->stream_analog_playback = &alc268_pcm_analog_playback; |
| 10008 | spec->stream_analog_capture = &alc268_pcm_analog_capture; |
Takashi Iwai | 6330079 | 2008-01-24 15:31:36 +0100 | [diff] [blame] | 10009 | spec->stream_analog_alt_capture = &alc268_pcm_analog_alt_capture; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10010 | |
| 10011 | spec->stream_name_digital = "ALC268 Digital"; |
| 10012 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
| 10013 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10014 | if (!spec->adc_nids && spec->input_mux) { |
| 10015 | /* check whether NID 0x07 is valid */ |
| 10016 | unsigned int wcap = get_wcaps(codec, 0x07); |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10017 | |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10018 | /* get type */ |
| 10019 | wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
| 10020 | if (wcap != AC_WID_AUD_IN) { |
| 10021 | spec->adc_nids = alc268_adc_nids_alt; |
| 10022 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
| 10023 | spec->mixers[spec->num_mixers] = |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10024 | alc268_capture_alt_mixer; |
Takashi Iwai | 3866f0b | 2008-01-15 12:37:42 +0100 | [diff] [blame] | 10025 | spec->num_mixers++; |
| 10026 | } else { |
| 10027 | spec->adc_nids = alc268_adc_nids; |
| 10028 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |
| 10029 | spec->mixers[spec->num_mixers] = |
| 10030 | alc268_capture_mixer; |
| 10031 | spec->num_mixers++; |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10032 | } |
| 10033 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 10034 | |
| 10035 | spec->vmaster_nid = 0x02; |
| 10036 | |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 10037 | codec->patch_ops = alc_patch_ops; |
| 10038 | if (board_config == ALC268_AUTO) |
| 10039 | spec->init_hook = alc268_auto_init; |
| 10040 | |
| 10041 | return 0; |
| 10042 | } |
| 10043 | |
| 10044 | /* |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10045 | * ALC269 channel source setting (2 channel) |
| 10046 | */ |
| 10047 | #define ALC269_DIGOUT_NID ALC880_DIGOUT_NID |
| 10048 | |
| 10049 | #define alc269_dac_nids alc260_dac_nids |
| 10050 | |
| 10051 | static hda_nid_t alc269_adc_nids[1] = { |
| 10052 | /* ADC1 */ |
| 10053 | 0x07, |
| 10054 | }; |
| 10055 | |
| 10056 | #define alc269_modes alc260_modes |
| 10057 | #define alc269_capture_source alc880_lg_lw_capture_source |
| 10058 | |
| 10059 | static struct snd_kcontrol_new alc269_base_mixer[] = { |
| 10060 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 10061 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 10062 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 10063 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 10064 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 10065 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 10066 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 10067 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
| 10068 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
| 10069 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 10070 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10071 | HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), |
| 10072 | { } /* end */ |
| 10073 | }; |
| 10074 | |
| 10075 | /* capture mixer elements */ |
| 10076 | static struct snd_kcontrol_new alc269_capture_mixer[] = { |
| 10077 | HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), |
| 10078 | HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), |
| 10079 | { |
| 10080 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10081 | /* The multiple "Capture Source" controls confuse alsamixer |
| 10082 | * So call somewhat different.. |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 10083 | */ |
| 10084 | /* .name = "Capture Source", */ |
| 10085 | .name = "Input Source", |
| 10086 | .count = 1, |
| 10087 | .info = alc_mux_enum_info, |
| 10088 | .get = alc_mux_enum_get, |
| 10089 | .put = alc_mux_enum_put, |
| 10090 | }, |
| 10091 | { } /* end */ |
| 10092 | }; |
| 10093 | |
| 10094 | /* |
| 10095 | * generic initialization of ADC, input mixers and output mixers |
| 10096 | */ |
| 10097 | static struct hda_verb alc269_init_verbs[] = { |
| 10098 | /* |
| 10099 | * Unmute ADC0 and set the default input to mic-in |
| 10100 | */ |
| 10101 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10102 | |
| 10103 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the |
| 10104 | * analog-loopback mixer widget |
| 10105 | * Note: PASD motherboards uses the Line In 2 as the input for |
| 10106 | * front panel mic (mic 2) |
| 10107 | */ |
| 10108 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
| 10109 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10110 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10111 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10112 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10113 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 10114 | |
| 10115 | /* |
| 10116 | * Set up output mixers (0x0c - 0x0e) |
| 10117 | */ |
| 10118 | /* set vol=0 to output mixers */ |
| 10119 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10120 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 10121 | |
| 10122 | /* set up input amps for analog loopback */ |
| 10123 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 10124 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10125 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10126 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10127 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10128 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10129 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10130 | |
| 10131 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10132 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 10133 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 10134 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10135 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 10136 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10137 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 10138 | |
| 10139 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10140 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10141 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10142 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10143 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10144 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10145 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10146 | |
| 10147 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10148 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10149 | |
| 10150 | /* FIXME: use matrix-type input source selection */ |
| 10151 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ |
| 10152 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
| 10153 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10154 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 10155 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 10156 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 10157 | |
| 10158 | /* set EAPD */ |
| 10159 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10160 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 10161 | { } |
| 10162 | }; |
| 10163 | |
| 10164 | /* add playback controls from the parsed DAC table */ |
| 10165 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 10166 | const struct auto_pin_cfg *cfg) |
| 10167 | { |
| 10168 | hda_nid_t nid; |
| 10169 | int err; |
| 10170 | |
| 10171 | spec->multiout.num_dacs = 1; /* only use one dac */ |
| 10172 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 10173 | spec->multiout.dac_nids[0] = 2; |
| 10174 | |
| 10175 | nid = cfg->line_out_pins[0]; |
| 10176 | if (nid) { |
| 10177 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10178 | "Front Playback Volume", |
| 10179 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT)); |
| 10180 | if (err < 0) |
| 10181 | return err; |
| 10182 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10183 | "Front Playback Switch", |
| 10184 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 10185 | if (err < 0) |
| 10186 | return err; |
| 10187 | } |
| 10188 | |
| 10189 | nid = cfg->speaker_pins[0]; |
| 10190 | if (nid) { |
| 10191 | if (!cfg->line_out_pins[0]) { |
| 10192 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10193 | "Speaker Playback Volume", |
| 10194 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10195 | HDA_OUTPUT)); |
| 10196 | if (err < 0) |
| 10197 | return err; |
| 10198 | } |
| 10199 | if (nid == 0x16) { |
| 10200 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10201 | "Speaker Playback Switch", |
| 10202 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10203 | HDA_OUTPUT)); |
| 10204 | if (err < 0) |
| 10205 | return err; |
| 10206 | } else { |
| 10207 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10208 | "Speaker Playback Switch", |
| 10209 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10210 | HDA_OUTPUT)); |
| 10211 | if (err < 0) |
| 10212 | return err; |
| 10213 | } |
| 10214 | } |
| 10215 | nid = cfg->hp_pins[0]; |
| 10216 | if (nid) { |
| 10217 | /* spec->multiout.hp_nid = 2; */ |
| 10218 | if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) { |
| 10219 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 10220 | "Headphone Playback Volume", |
| 10221 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, |
| 10222 | HDA_OUTPUT)); |
| 10223 | if (err < 0) |
| 10224 | return err; |
| 10225 | } |
| 10226 | if (nid == 0x16) { |
| 10227 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10228 | "Headphone Playback Switch", |
| 10229 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 10230 | HDA_OUTPUT)); |
| 10231 | if (err < 0) |
| 10232 | return err; |
| 10233 | } else { |
| 10234 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 10235 | "Headphone Playback Switch", |
| 10236 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 10237 | HDA_OUTPUT)); |
| 10238 | if (err < 0) |
| 10239 | return err; |
| 10240 | } |
| 10241 | } |
| 10242 | return 0; |
| 10243 | } |
| 10244 | |
| 10245 | #define alc269_auto_create_analog_input_ctls \ |
| 10246 | alc880_auto_create_analog_input_ctls |
| 10247 | |
| 10248 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10249 | #define alc269_loopbacks alc880_loopbacks |
| 10250 | #endif |
| 10251 | |
| 10252 | /* pcm configuration: identiacal with ALC880 */ |
| 10253 | #define alc269_pcm_analog_playback alc880_pcm_analog_playback |
| 10254 | #define alc269_pcm_analog_capture alc880_pcm_analog_capture |
| 10255 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
| 10256 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
| 10257 | |
| 10258 | /* |
| 10259 | * BIOS auto configuration |
| 10260 | */ |
| 10261 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 10262 | { |
| 10263 | struct alc_spec *spec = codec->spec; |
| 10264 | int err; |
| 10265 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
| 10266 | |
| 10267 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 10268 | alc269_ignore); |
| 10269 | if (err < 0) |
| 10270 | return err; |
| 10271 | |
| 10272 | err = alc269_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 10273 | if (err < 0) |
| 10274 | return err; |
| 10275 | err = alc269_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 10276 | if (err < 0) |
| 10277 | return err; |
| 10278 | |
| 10279 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 10280 | |
| 10281 | if (spec->autocfg.dig_out_pin) |
| 10282 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
| 10283 | |
| 10284 | if (spec->kctl_alloc) |
| 10285 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 10286 | |
| 10287 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
| 10288 | spec->num_mux_defs = 1; |
| 10289 | spec->input_mux = &spec->private_imux; |
| 10290 | |
| 10291 | err = alc_auto_add_mic_boost(codec); |
| 10292 | if (err < 0) |
| 10293 | return err; |
| 10294 | |
| 10295 | return 1; |
| 10296 | } |
| 10297 | |
| 10298 | #define alc269_auto_init_multi_out alc882_auto_init_multi_out |
| 10299 | #define alc269_auto_init_hp_out alc882_auto_init_hp_out |
| 10300 | #define alc269_auto_init_analog_input alc882_auto_init_analog_input |
| 10301 | |
| 10302 | |
| 10303 | /* init callback for auto-configuration model -- overriding the default init */ |
| 10304 | static void alc269_auto_init(struct hda_codec *codec) |
| 10305 | { |
| 10306 | alc269_auto_init_multi_out(codec); |
| 10307 | alc269_auto_init_hp_out(codec); |
| 10308 | alc269_auto_init_analog_input(codec); |
| 10309 | } |
| 10310 | |
| 10311 | /* |
| 10312 | * configuration and preset |
| 10313 | */ |
| 10314 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
| 10315 | [ALC269_BASIC] = "basic", |
| 10316 | }; |
| 10317 | |
| 10318 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
| 10319 | {} |
| 10320 | }; |
| 10321 | |
| 10322 | static struct alc_config_preset alc269_presets[] = { |
| 10323 | [ALC269_BASIC] = { |
| 10324 | .mixers = { alc269_base_mixer }, |
| 10325 | .init_verbs = { alc269_init_verbs }, |
| 10326 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), |
| 10327 | .dac_nids = alc269_dac_nids, |
| 10328 | .hp_nid = 0x03, |
| 10329 | .num_channel_mode = ARRAY_SIZE(alc269_modes), |
| 10330 | .channel_mode = alc269_modes, |
| 10331 | .input_mux = &alc269_capture_source, |
| 10332 | }, |
| 10333 | }; |
| 10334 | |
| 10335 | static int patch_alc269(struct hda_codec *codec) |
| 10336 | { |
| 10337 | struct alc_spec *spec; |
| 10338 | int board_config; |
| 10339 | int err; |
| 10340 | |
| 10341 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 10342 | if (spec == NULL) |
| 10343 | return -ENOMEM; |
| 10344 | |
| 10345 | codec->spec = spec; |
| 10346 | |
| 10347 | board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, |
| 10348 | alc269_models, |
| 10349 | alc269_cfg_tbl); |
| 10350 | |
| 10351 | if (board_config < 0) { |
| 10352 | printk(KERN_INFO "hda_codec: Unknown model for ALC269, " |
| 10353 | "trying auto-probe from BIOS...\n"); |
| 10354 | board_config = ALC269_AUTO; |
| 10355 | } |
| 10356 | |
| 10357 | if (board_config == ALC269_AUTO) { |
| 10358 | /* automatic parse from the BIOS config */ |
| 10359 | err = alc269_parse_auto_config(codec); |
| 10360 | if (err < 0) { |
| 10361 | alc_free(codec); |
| 10362 | return err; |
| 10363 | } else if (!err) { |
| 10364 | printk(KERN_INFO |
| 10365 | "hda_codec: Cannot set up configuration " |
| 10366 | "from BIOS. Using base mode...\n"); |
| 10367 | board_config = ALC269_BASIC; |
| 10368 | } |
| 10369 | } |
| 10370 | |
| 10371 | if (board_config != ALC269_AUTO) |
| 10372 | setup_preset(spec, &alc269_presets[board_config]); |
| 10373 | |
| 10374 | spec->stream_name_analog = "ALC269 Analog"; |
| 10375 | spec->stream_analog_playback = &alc269_pcm_analog_playback; |
| 10376 | spec->stream_analog_capture = &alc269_pcm_analog_capture; |
| 10377 | |
| 10378 | spec->stream_name_digital = "ALC269 Digital"; |
| 10379 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
| 10380 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
| 10381 | |
| 10382 | spec->adc_nids = alc269_adc_nids; |
| 10383 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
| 10384 | spec->mixers[spec->num_mixers] = alc269_capture_mixer; |
| 10385 | spec->num_mixers++; |
| 10386 | |
| 10387 | codec->patch_ops = alc_patch_ops; |
| 10388 | if (board_config == ALC269_AUTO) |
| 10389 | spec->init_hook = alc269_auto_init; |
| 10390 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 10391 | if (!spec->loopback.amplist) |
| 10392 | spec->loopback.amplist = alc269_loopbacks; |
| 10393 | #endif |
| 10394 | |
| 10395 | return 0; |
| 10396 | } |
| 10397 | |
| 10398 | /* |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10399 | * ALC861 channel source setting (2/6 channel selection for 3-stack) |
| 10400 | */ |
| 10401 | |
| 10402 | /* |
| 10403 | * set the path ways for 2 channel output |
| 10404 | * need to set the codec line out and mic 1 pin widgets to inputs |
| 10405 | */ |
| 10406 | static struct hda_verb alc861_threestack_ch2_init[] = { |
| 10407 | /* set pin widget 1Ah (line in) for input */ |
| 10408 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10409 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10410 | * the vref |
| 10411 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10412 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10413 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10414 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10415 | #if 0 |
| 10416 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10417 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10418 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10419 | { } /* end */ |
| 10420 | }; |
| 10421 | /* |
| 10422 | * 6ch mode |
| 10423 | * need to set the codec line out and mic 1 pin widgets to outputs |
| 10424 | */ |
| 10425 | static struct hda_verb alc861_threestack_ch6_init[] = { |
| 10426 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10427 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10428 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10429 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10430 | |
| 10431 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10432 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10433 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 10434 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10435 | #if 0 |
| 10436 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10437 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10438 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10439 | { } /* end */ |
| 10440 | }; |
| 10441 | |
| 10442 | static struct hda_channel_mode alc861_threestack_modes[2] = { |
| 10443 | { 2, alc861_threestack_ch2_init }, |
| 10444 | { 6, alc861_threestack_ch6_init }, |
| 10445 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10446 | /* Set mic1 as input and unmute the mixer */ |
| 10447 | static struct hda_verb alc861_uniwill_m31_ch2_init[] = { |
| 10448 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10449 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10450 | { } /* end */ |
| 10451 | }; |
| 10452 | /* Set mic1 as output and mute mixer */ |
| 10453 | static struct hda_verb alc861_uniwill_m31_ch4_init[] = { |
| 10454 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10455 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10456 | { } /* end */ |
| 10457 | }; |
| 10458 | |
| 10459 | static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { |
| 10460 | { 2, alc861_uniwill_m31_ch2_init }, |
| 10461 | { 4, alc861_uniwill_m31_ch4_init }, |
| 10462 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10463 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10464 | /* Set mic1 and line-in as input and unmute the mixer */ |
| 10465 | static struct hda_verb alc861_asus_ch2_init[] = { |
| 10466 | /* set pin widget 1Ah (line in) for input */ |
| 10467 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10468 | /* set pin widget 18h (mic1/2) for input, for mic also enable |
| 10469 | * the vref |
| 10470 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10471 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10472 | |
| 10473 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, |
| 10474 | #if 0 |
| 10475 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ |
| 10476 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ |
| 10477 | #endif |
| 10478 | { } /* end */ |
| 10479 | }; |
| 10480 | /* Set mic1 nad line-in as output and mute mixer */ |
| 10481 | static struct hda_verb alc861_asus_ch6_init[] = { |
| 10482 | /* set pin widget 1Ah (line in) for output (Back Surround)*/ |
| 10483 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10484 | /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10485 | /* set pin widget 18h (mic1) for output (CLFE)*/ |
| 10486 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10487 | /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ |
| 10488 | { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10489 | { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10490 | |
| 10491 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, |
| 10492 | #if 0 |
| 10493 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ |
| 10494 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ |
| 10495 | #endif |
| 10496 | { } /* end */ |
| 10497 | }; |
| 10498 | |
| 10499 | static struct hda_channel_mode alc861_asus_modes[2] = { |
| 10500 | { 2, alc861_asus_ch2_init }, |
| 10501 | { 6, alc861_asus_ch6_init }, |
| 10502 | }; |
| 10503 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10504 | /* patch-ALC861 */ |
| 10505 | |
| 10506 | static struct snd_kcontrol_new alc861_base_mixer[] = { |
| 10507 | /* output mixer control */ |
| 10508 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10509 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10510 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10511 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10512 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10513 | |
| 10514 | /*Input mixer control */ |
| 10515 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10516 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10517 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10518 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10519 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10520 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10521 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10522 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10523 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10524 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10525 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10526 | /* Capture mixer control */ |
| 10527 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10528 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10529 | { |
| 10530 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10531 | .name = "Capture Source", |
| 10532 | .count = 1, |
| 10533 | .info = alc_mux_enum_info, |
| 10534 | .get = alc_mux_enum_get, |
| 10535 | .put = alc_mux_enum_put, |
| 10536 | }, |
| 10537 | { } /* end */ |
| 10538 | }; |
| 10539 | |
| 10540 | static struct snd_kcontrol_new alc861_3ST_mixer[] = { |
| 10541 | /* output mixer control */ |
| 10542 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10543 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10544 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10545 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10546 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10547 | |
| 10548 | /* Input mixer control */ |
| 10549 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10550 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10552 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10553 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10554 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10555 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10556 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10557 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10558 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10559 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10560 | /* Capture mixer control */ |
| 10561 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10562 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10563 | { |
| 10564 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10565 | .name = "Capture Source", |
| 10566 | .count = 1, |
| 10567 | .info = alc_mux_enum_info, |
| 10568 | .get = alc_mux_enum_get, |
| 10569 | .put = alc_mux_enum_put, |
| 10570 | }, |
| 10571 | { |
| 10572 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10573 | .name = "Channel Mode", |
| 10574 | .info = alc_ch_mode_info, |
| 10575 | .get = alc_ch_mode_get, |
| 10576 | .put = alc_ch_mode_put, |
| 10577 | .private_value = ARRAY_SIZE(alc861_threestack_modes), |
| 10578 | }, |
| 10579 | { } /* end */ |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10580 | }; |
| 10581 | |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10582 | static struct snd_kcontrol_new alc861_toshiba_mixer[] = { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10583 | /* output mixer control */ |
| 10584 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10585 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10586 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10587 | |
| 10588 | /*Capture mixer control */ |
| 10589 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10590 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10591 | { |
| 10592 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10593 | .name = "Capture Source", |
| 10594 | .count = 1, |
| 10595 | .info = alc_mux_enum_info, |
| 10596 | .get = alc_mux_enum_get, |
| 10597 | .put = alc_mux_enum_put, |
| 10598 | }, |
| 10599 | |
| 10600 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10601 | }; |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 10602 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10603 | static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { |
| 10604 | /* output mixer control */ |
| 10605 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10606 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10607 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10608 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10609 | /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ |
| 10610 | |
| 10611 | /* Input mixer control */ |
| 10612 | /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10613 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ |
| 10614 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10615 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10616 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10617 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10618 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10619 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10620 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
| 10621 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10622 | |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10623 | /* Capture mixer control */ |
| 10624 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10625 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10626 | { |
| 10627 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10628 | .name = "Capture Source", |
| 10629 | .count = 1, |
| 10630 | .info = alc_mux_enum_info, |
| 10631 | .get = alc_mux_enum_get, |
| 10632 | .put = alc_mux_enum_put, |
| 10633 | }, |
| 10634 | { |
| 10635 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10636 | .name = "Channel Mode", |
| 10637 | .info = alc_ch_mode_info, |
| 10638 | .get = alc_ch_mode_get, |
| 10639 | .put = alc_ch_mode_put, |
| 10640 | .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 10641 | }, |
| 10642 | { } /* end */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10643 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10644 | |
| 10645 | static struct snd_kcontrol_new alc861_asus_mixer[] = { |
| 10646 | /* output mixer control */ |
| 10647 | HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 10648 | HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), |
| 10649 | HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), |
| 10650 | HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), |
| 10651 | HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), |
| 10652 | |
| 10653 | /* Input mixer control */ |
| 10654 | HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), |
| 10655 | HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
| 10656 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10657 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10658 | HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), |
| 10659 | HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), |
| 10660 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
| 10661 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
| 10662 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10663 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), |
| 10664 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10665 | /* Capture mixer control */ |
| 10666 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 10667 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 10668 | { |
| 10669 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10670 | .name = "Capture Source", |
| 10671 | .count = 1, |
| 10672 | .info = alc_mux_enum_info, |
| 10673 | .get = alc_mux_enum_get, |
| 10674 | .put = alc_mux_enum_put, |
| 10675 | }, |
| 10676 | { |
| 10677 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 10678 | .name = "Channel Mode", |
| 10679 | .info = alc_ch_mode_info, |
| 10680 | .get = alc_ch_mode_get, |
| 10681 | .put = alc_ch_mode_put, |
| 10682 | .private_value = ARRAY_SIZE(alc861_asus_modes), |
| 10683 | }, |
| 10684 | { } |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10685 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10686 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10687 | /* additional mixer */ |
Takashi Iwai | d1d985f | 2006-11-23 19:27:12 +0100 | [diff] [blame] | 10688 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10689 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
| 10690 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
| 10691 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), |
| 10692 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), |
| 10693 | { } |
| 10694 | }; |
| 10695 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10696 | /* |
| 10697 | * generic initialization of ADC, input mixers and output mixers |
| 10698 | */ |
| 10699 | static struct hda_verb alc861_base_init_verbs[] = { |
| 10700 | /* |
| 10701 | * Unmute ADC0 and set the default input to mic-in |
| 10702 | */ |
| 10703 | /* port-A for surround (rear panel) */ |
| 10704 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10705 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10706 | /* port-B for mic-in (rear panel) with vref */ |
| 10707 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10708 | /* port-C for line-in (rear panel) */ |
| 10709 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10710 | /* port-D for Front */ |
| 10711 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10712 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10713 | /* port-E for HP out (front panel) */ |
| 10714 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10715 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10716 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10717 | /* port-F for mic-in (front panel) with vref */ |
| 10718 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10719 | /* port-G for CLFE (rear panel) */ |
| 10720 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10721 | { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10722 | /* port-H for side (rear panel) */ |
| 10723 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10724 | { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10725 | /* CD-in */ |
| 10726 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10727 | /* route front mic to ADC1*/ |
| 10728 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10729 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10730 | |
| 10731 | /* Unmute DAC0~3 & spdif out*/ |
| 10732 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10733 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10734 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10735 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10736 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10737 | |
| 10738 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10739 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10740 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10741 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10742 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10743 | |
| 10744 | /* Unmute Stereo Mixer 15 */ |
| 10745 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10746 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10747 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10748 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10749 | |
| 10750 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10751 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10752 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10753 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10754 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10755 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10756 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10757 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10758 | /* hp used DAC 3 (Front) */ |
| 10759 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10760 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10761 | |
| 10762 | { } |
| 10763 | }; |
| 10764 | |
| 10765 | static struct hda_verb alc861_threestack_init_verbs[] = { |
| 10766 | /* |
| 10767 | * Unmute ADC0 and set the default input to mic-in |
| 10768 | */ |
| 10769 | /* port-A for surround (rear panel) */ |
| 10770 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10771 | /* port-B for mic-in (rear panel) with vref */ |
| 10772 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10773 | /* port-C for line-in (rear panel) */ |
| 10774 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10775 | /* port-D for Front */ |
| 10776 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10777 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10778 | /* port-E for HP out (front panel) */ |
| 10779 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, |
| 10780 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10781 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10782 | /* port-F for mic-in (front panel) with vref */ |
| 10783 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10784 | /* port-G for CLFE (rear panel) */ |
| 10785 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10786 | /* port-H for side (rear panel) */ |
| 10787 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10788 | /* CD-in */ |
| 10789 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10790 | /* route front mic to ADC1*/ |
| 10791 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10792 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10793 | /* Unmute DAC0~3 & spdif out*/ |
| 10794 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10795 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10796 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10797 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10798 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10799 | |
| 10800 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10801 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10802 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10803 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10804 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10805 | |
| 10806 | /* Unmute Stereo Mixer 15 */ |
| 10807 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10808 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10809 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10810 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10811 | |
| 10812 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10813 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10814 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10815 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10816 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10817 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10818 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10819 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10820 | /* hp used DAC 3 (Front) */ |
| 10821 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10822 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10823 | { } |
| 10824 | }; |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10825 | |
| 10826 | static struct hda_verb alc861_uniwill_m31_init_verbs[] = { |
| 10827 | /* |
| 10828 | * Unmute ADC0 and set the default input to mic-in |
| 10829 | */ |
| 10830 | /* port-A for surround (rear panel) */ |
| 10831 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10832 | /* port-B for mic-in (rear panel) with vref */ |
| 10833 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10834 | /* port-C for line-in (rear panel) */ |
| 10835 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10836 | /* port-D for Front */ |
| 10837 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10838 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10839 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10840 | /* this has to be set to VREF80 */ |
| 10841 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10842 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10843 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10844 | /* port-F for mic-in (front panel) with vref */ |
| 10845 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10846 | /* port-G for CLFE (rear panel) */ |
| 10847 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10848 | /* port-H for side (rear panel) */ |
| 10849 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 10850 | /* CD-in */ |
| 10851 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10852 | /* route front mic to ADC1*/ |
| 10853 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10854 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10855 | /* Unmute DAC0~3 & spdif out*/ |
| 10856 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10857 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10858 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10859 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10860 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10861 | |
| 10862 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10863 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10864 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10865 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10866 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10867 | |
| 10868 | /* Unmute Stereo Mixer 15 */ |
| 10869 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10870 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10871 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10872 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10873 | |
| 10874 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10875 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10876 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10877 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10878 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10879 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10880 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10881 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10882 | /* hp used DAC 3 (Front) */ |
| 10883 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 10884 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10885 | { } |
| 10886 | }; |
| 10887 | |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10888 | static struct hda_verb alc861_asus_init_verbs[] = { |
| 10889 | /* |
| 10890 | * Unmute ADC0 and set the default input to mic-in |
| 10891 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10892 | /* port-A for surround (rear panel) |
| 10893 | * according to codec#0 this is the HP jack |
| 10894 | */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10895 | { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ |
| 10896 | /* route front PCM to HP */ |
| 10897 | { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 10898 | /* port-B for mic-in (rear panel) with vref */ |
| 10899 | { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10900 | /* port-C for line-in (rear panel) */ |
| 10901 | { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10902 | /* port-D for Front */ |
| 10903 | { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10904 | { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
| 10905 | /* port-E for HP out (front panel) */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10906 | /* this has to be set to VREF80 */ |
| 10907 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10908 | /* route front PCM to HP */ |
Takashi Iwai | 9dece1d | 2006-11-16 17:12:49 +0100 | [diff] [blame] | 10909 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10910 | /* port-F for mic-in (front panel) with vref */ |
| 10911 | { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, |
| 10912 | /* port-G for CLFE (rear panel) */ |
| 10913 | { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10914 | /* port-H for side (rear panel) */ |
| 10915 | { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, |
| 10916 | /* CD-in */ |
| 10917 | { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, |
| 10918 | /* route front mic to ADC1*/ |
| 10919 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 10920 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10921 | /* Unmute DAC0~3 & spdif out*/ |
| 10922 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10923 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10924 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10925 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10926 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10927 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10928 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10929 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10930 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10931 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10932 | |
| 10933 | /* Unmute Stereo Mixer 15 */ |
| 10934 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10935 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10936 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10937 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, /* Output 0~12 step */ |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10938 | |
| 10939 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10940 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10941 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10942 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10943 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10944 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10945 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10946 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10947 | /* hp used DAC 3 (Front) */ |
| 10948 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10949 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10950 | { } |
| 10951 | }; |
| 10952 | |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 10953 | /* additional init verbs for ASUS laptops */ |
| 10954 | static struct hda_verb alc861_asus_laptop_init_verbs[] = { |
| 10955 | { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ |
| 10956 | { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ |
| 10957 | { } |
| 10958 | }; |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 10959 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10960 | /* |
| 10961 | * generic initialization of ADC, input mixers and output mixers |
| 10962 | */ |
| 10963 | static struct hda_verb alc861_auto_init_verbs[] = { |
| 10964 | /* |
| 10965 | * Unmute ADC0 and set the default input to mic-in |
| 10966 | */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 10967 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 10968 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10969 | |
| 10970 | /* Unmute DAC0~3 & spdif out*/ |
| 10971 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10972 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10973 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10974 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 10975 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 10976 | |
| 10977 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
| 10978 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10979 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10980 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10981 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10982 | |
| 10983 | /* Unmute Stereo Mixer 15 */ |
| 10984 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10985 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10986 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 10987 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, |
| 10988 | |
| 10989 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10990 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10991 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10992 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10993 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10994 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10995 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 10996 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 10997 | |
| 10998 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 10999 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11000 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11001 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11002 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11003 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11004 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 11005 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11006 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11007 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, /* set Mic 1 */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11008 | |
| 11009 | { } |
| 11010 | }; |
| 11011 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11012 | static struct hda_verb alc861_toshiba_init_verbs[] = { |
| 11013 | {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11014 | |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11015 | { } |
| 11016 | }; |
| 11017 | |
| 11018 | /* toggle speaker-output according to the hp-jack state */ |
| 11019 | static void alc861_toshiba_automute(struct hda_codec *codec) |
| 11020 | { |
| 11021 | unsigned int present; |
| 11022 | |
| 11023 | present = snd_hda_codec_read(codec, 0x0f, 0, |
| 11024 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11025 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0, |
| 11026 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
| 11027 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3, |
| 11028 | HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE); |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11029 | } |
| 11030 | |
| 11031 | static void alc861_toshiba_unsol_event(struct hda_codec *codec, |
| 11032 | unsigned int res) |
| 11033 | { |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11034 | if ((res >> 26) == ALC880_HP_EVENT) |
| 11035 | alc861_toshiba_automute(codec); |
| 11036 | } |
| 11037 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11038 | /* pcm configuration: identiacal with ALC880 */ |
| 11039 | #define alc861_pcm_analog_playback alc880_pcm_analog_playback |
| 11040 | #define alc861_pcm_analog_capture alc880_pcm_analog_capture |
| 11041 | #define alc861_pcm_digital_playback alc880_pcm_digital_playback |
| 11042 | #define alc861_pcm_digital_capture alc880_pcm_digital_capture |
| 11043 | |
| 11044 | |
| 11045 | #define ALC861_DIGOUT_NID 0x07 |
| 11046 | |
| 11047 | static struct hda_channel_mode alc861_8ch_modes[1] = { |
| 11048 | { 8, NULL } |
| 11049 | }; |
| 11050 | |
| 11051 | static hda_nid_t alc861_dac_nids[4] = { |
| 11052 | /* front, surround, clfe, side */ |
| 11053 | 0x03, 0x06, 0x05, 0x04 |
| 11054 | }; |
| 11055 | |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11056 | static hda_nid_t alc660_dac_nids[3] = { |
| 11057 | /* front, clfe, surround */ |
| 11058 | 0x03, 0x05, 0x06 |
| 11059 | }; |
| 11060 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11061 | static hda_nid_t alc861_adc_nids[1] = { |
| 11062 | /* ADC0-2 */ |
| 11063 | 0x08, |
| 11064 | }; |
| 11065 | |
| 11066 | static struct hda_input_mux alc861_capture_source = { |
| 11067 | .num_items = 5, |
| 11068 | .items = { |
| 11069 | { "Mic", 0x0 }, |
| 11070 | { "Front Mic", 0x3 }, |
| 11071 | { "Line", 0x1 }, |
| 11072 | { "CD", 0x4 }, |
| 11073 | { "Mixer", 0x5 }, |
| 11074 | }, |
| 11075 | }; |
| 11076 | |
| 11077 | /* fill in the dac_nids table from the parsed pin configuration */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11078 | static int alc861_auto_fill_dac_nids(struct alc_spec *spec, |
| 11079 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11080 | { |
| 11081 | int i; |
| 11082 | hda_nid_t nid; |
| 11083 | |
| 11084 | spec->multiout.dac_nids = spec->private_dac_nids; |
| 11085 | for (i = 0; i < cfg->line_outs; i++) { |
| 11086 | nid = cfg->line_out_pins[i]; |
| 11087 | if (nid) { |
| 11088 | if (i >= ARRAY_SIZE(alc861_dac_nids)) |
| 11089 | continue; |
| 11090 | spec->multiout.dac_nids[i] = alc861_dac_nids[i]; |
| 11091 | } |
| 11092 | } |
| 11093 | spec->multiout.num_dacs = cfg->line_outs; |
| 11094 | return 0; |
| 11095 | } |
| 11096 | |
| 11097 | /* add playback controls from the parsed DAC table */ |
| 11098 | static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 11099 | const struct auto_pin_cfg *cfg) |
| 11100 | { |
| 11101 | char name[32]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11102 | static const char *chname[4] = { |
| 11103 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 11104 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11105 | hda_nid_t nid; |
| 11106 | int i, idx, err; |
| 11107 | |
| 11108 | for (i = 0; i < cfg->line_outs; i++) { |
| 11109 | nid = spec->multiout.dac_nids[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11110 | if (!nid) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11111 | continue; |
| 11112 | if (nid == 0x05) { |
| 11113 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11114 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11115 | "Center Playback Switch", |
| 11116 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 11117 | HDA_OUTPUT)); |
| 11118 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11119 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11120 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 11121 | "LFE Playback Switch", |
| 11122 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 11123 | HDA_OUTPUT)); |
| 11124 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11125 | return err; |
| 11126 | } else { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11127 | for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; |
| 11128 | idx++) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11129 | if (nid == alc861_dac_nids[idx]) |
| 11130 | break; |
| 11131 | sprintf(name, "%s Playback Switch", chname[idx]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11132 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 11133 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 11134 | HDA_OUTPUT)); |
| 11135 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11136 | return err; |
| 11137 | } |
| 11138 | } |
| 11139 | return 0; |
| 11140 | } |
| 11141 | |
| 11142 | static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) |
| 11143 | { |
| 11144 | int err; |
| 11145 | hda_nid_t nid; |
| 11146 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11147 | if (!pin) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11148 | return 0; |
| 11149 | |
| 11150 | if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { |
| 11151 | nid = 0x03; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11152 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
| 11153 | "Headphone Playback Switch", |
| 11154 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 11155 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11156 | return err; |
| 11157 | spec->multiout.hp_nid = nid; |
| 11158 | } |
| 11159 | return 0; |
| 11160 | } |
| 11161 | |
| 11162 | /* create playback/capture controls for input pins */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11163 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 11164 | const struct auto_pin_cfg *cfg) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11165 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11166 | struct hda_input_mux *imux = &spec->private_imux; |
| 11167 | int i, err, idx, idx1; |
| 11168 | |
| 11169 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11170 | switch (cfg->input_pins[i]) { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11171 | case 0x0c: |
| 11172 | idx1 = 1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11173 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11174 | break; |
| 11175 | case 0x0f: |
| 11176 | idx1 = 2; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11177 | idx = 2; /* Line In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11178 | break; |
| 11179 | case 0x0d: |
| 11180 | idx1 = 0; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11181 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11182 | break; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11183 | case 0x10: |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11184 | idx1 = 3; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11185 | idx = 1; /* Mic In */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11186 | break; |
| 11187 | case 0x11: |
| 11188 | idx1 = 4; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11189 | idx = 0; /* CD */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11190 | break; |
| 11191 | default: |
| 11192 | continue; |
| 11193 | } |
| 11194 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11195 | err = new_analog_input(spec, cfg->input_pins[i], |
| 11196 | auto_pin_cfg_labels[i], idx, 0x15); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11197 | if (err < 0) |
| 11198 | return err; |
| 11199 | |
Takashi Iwai | 4a471b7 | 2005-12-07 13:56:29 +0100 | [diff] [blame] | 11200 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11201 | imux->items[imux->num_items].index = idx1; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11202 | imux->num_items++; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11203 | } |
| 11204 | return 0; |
| 11205 | } |
| 11206 | |
| 11207 | static struct snd_kcontrol_new alc861_capture_mixer[] = { |
| 11208 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
| 11209 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
| 11210 | |
| 11211 | { |
| 11212 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11213 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11214 | * So call somewhat different.. |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11215 | */ |
| 11216 | /* .name = "Capture Source", */ |
| 11217 | .name = "Input Source", |
| 11218 | .count = 1, |
| 11219 | .info = alc_mux_enum_info, |
| 11220 | .get = alc_mux_enum_get, |
| 11221 | .put = alc_mux_enum_put, |
| 11222 | }, |
| 11223 | { } /* end */ |
| 11224 | }; |
| 11225 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11226 | static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, |
| 11227 | hda_nid_t nid, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11228 | int pin_type, int dac_idx) |
| 11229 | { |
| 11230 | /* set as output */ |
| 11231 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11232 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11233 | pin_type); |
| 11234 | snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 11235 | AMP_OUT_UNMUTE); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11236 | |
| 11237 | } |
| 11238 | |
| 11239 | static void alc861_auto_init_multi_out(struct hda_codec *codec) |
| 11240 | { |
| 11241 | struct alc_spec *spec = codec->spec; |
| 11242 | int i; |
| 11243 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 11244 | alc_subsystem_id(codec, 0x0e, 0x0f, 0x0b); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11245 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
| 11246 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11247 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11248 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 11249 | alc861_auto_set_output_and_unmute(codec, nid, pin_type, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11250 | spec->multiout.dac_nids[i]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11251 | } |
| 11252 | } |
| 11253 | |
| 11254 | static void alc861_auto_init_hp_out(struct hda_codec *codec) |
| 11255 | { |
| 11256 | struct alc_spec *spec = codec->spec; |
| 11257 | hda_nid_t pin; |
| 11258 | |
Takashi Iwai | eb06ed8 | 2006-09-20 17:10:27 +0200 | [diff] [blame] | 11259 | pin = spec->autocfg.hp_pins[0]; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11260 | if (pin) /* connect to front */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11261 | alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, |
| 11262 | spec->multiout.dac_nids[0]); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11263 | } |
| 11264 | |
| 11265 | static void alc861_auto_init_analog_input(struct hda_codec *codec) |
| 11266 | { |
| 11267 | struct alc_spec *spec = codec->spec; |
| 11268 | int i; |
| 11269 | |
| 11270 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 11271 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11272 | if (nid >= 0x0c && nid <= 0x11) { |
| 11273 | snd_hda_codec_write(codec, nid, 0, |
| 11274 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 11275 | i <= AUTO_PIN_FRONT_MIC ? |
| 11276 | PIN_VREF80 : PIN_IN); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11277 | } |
| 11278 | } |
| 11279 | } |
| 11280 | |
| 11281 | /* parse the BIOS configuration and set up the alc_spec */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11282 | /* return 1 if successful, 0 if the proper config is not found, |
| 11283 | * or a negative error code |
| 11284 | */ |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11285 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 11286 | { |
| 11287 | struct alc_spec *spec = codec->spec; |
| 11288 | int err; |
| 11289 | static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
| 11290 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11291 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 11292 | alc861_ignore); |
| 11293 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11294 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11295 | if (!spec->autocfg.line_outs) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11296 | return 0; /* can't find valid BIOS pin config */ |
| 11297 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11298 | err = alc861_auto_fill_dac_nids(spec, &spec->autocfg); |
| 11299 | if (err < 0) |
| 11300 | return err; |
| 11301 | err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 11302 | if (err < 0) |
| 11303 | return err; |
| 11304 | err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0]); |
| 11305 | if (err < 0) |
| 11306 | return err; |
| 11307 | err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 11308 | if (err < 0) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11309 | return err; |
| 11310 | |
| 11311 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 11312 | |
| 11313 | if (spec->autocfg.dig_out_pin) |
| 11314 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
| 11315 | |
| 11316 | if (spec->kctl_alloc) |
| 11317 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 11318 | |
| 11319 | spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; |
| 11320 | |
Jonathan Woithe | a1e8d2d | 2006-03-28 12:47:09 +0200 | [diff] [blame] | 11321 | spec->num_mux_defs = 1; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11322 | spec->input_mux = &spec->private_imux; |
| 11323 | |
| 11324 | spec->adc_nids = alc861_adc_nids; |
| 11325 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
| 11326 | spec->mixers[spec->num_mixers] = alc861_capture_mixer; |
| 11327 | spec->num_mixers++; |
| 11328 | |
| 11329 | return 1; |
| 11330 | } |
| 11331 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11332 | /* additional initialization for auto-configuration model */ |
| 11333 | static void alc861_auto_init(struct hda_codec *codec) |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11334 | { |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11335 | alc861_auto_init_multi_out(codec); |
| 11336 | alc861_auto_init_hp_out(codec); |
| 11337 | alc861_auto_init_analog_input(codec); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11338 | } |
| 11339 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11340 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11341 | static struct hda_amp_list alc861_loopbacks[] = { |
| 11342 | { 0x15, HDA_INPUT, 0 }, |
| 11343 | { 0x15, HDA_INPUT, 1 }, |
| 11344 | { 0x15, HDA_INPUT, 2 }, |
| 11345 | { 0x15, HDA_INPUT, 3 }, |
| 11346 | { } /* end */ |
| 11347 | }; |
| 11348 | #endif |
| 11349 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11350 | |
| 11351 | /* |
| 11352 | * configuration and preset |
| 11353 | */ |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11354 | static const char *alc861_models[ALC861_MODEL_LAST] = { |
| 11355 | [ALC861_3ST] = "3stack", |
| 11356 | [ALC660_3ST] = "3stack-660", |
| 11357 | [ALC861_3ST_DIG] = "3stack-dig", |
| 11358 | [ALC861_6ST_DIG] = "6stack-dig", |
| 11359 | [ALC861_UNIWILL_M31] = "uniwill-m31", |
| 11360 | [ALC861_TOSHIBA] = "toshiba", |
| 11361 | [ALC861_ASUS] = "asus", |
| 11362 | [ALC861_ASUS_LAPTOP] = "asus-laptop", |
| 11363 | [ALC861_AUTO] = "auto", |
| 11364 | }; |
| 11365 | |
| 11366 | static struct snd_pci_quirk alc861_cfg_tbl[] = { |
Takashi Iwai | 687a47b | 2007-01-10 11:25:58 +0100 | [diff] [blame] | 11367 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11368 | SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11369 | SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), |
| 11370 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11371 | SND_PCI_QUIRK(0x1043, 0x13d7, "ASUS A9rp", ALC861_ASUS_LAPTOP), |
Kailang Yang | 83c3421 | 2007-07-05 11:43:05 +0200 | [diff] [blame] | 11372 | SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS P1-AH2", ALC861_3ST_DIG), |
Tobin Davis | ad5e773 | 2007-01-08 10:57:32 +0100 | [diff] [blame] | 11373 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), |
Takashi Iwai | 341d4eb | 2007-07-09 17:53:18 +0200 | [diff] [blame] | 11374 | /* FIXME: the entry below breaks Toshiba A100 (model=auto works!) |
| 11375 | * Any other models that need this preset? |
| 11376 | */ |
| 11377 | /* SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), */ |
Claudio Matsuoka | ef64adb | 2007-07-14 00:26:16 +0200 | [diff] [blame] | 11378 | SND_PCI_QUIRK(0x1462, 0x7254, "HP dx2200 (MSI MS-7254)", ALC861_3ST), |
| 11379 | SND_PCI_QUIRK(0x1462, 0x7297, "HP dx2250 (MSI MS-7297)", ALC861_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 11380 | SND_PCI_QUIRK(0x1584, 0x2b01, "Uniwill X40AIx", ALC861_UNIWILL_M31), |
| 11381 | SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), |
| 11382 | SND_PCI_QUIRK(0x1584, 0x9075, "Airis Praxis N1212", ALC861_ASUS_LAPTOP), |
| 11383 | /* FIXME: the below seems conflict */ |
| 11384 | /* SND_PCI_QUIRK(0x1584, 0x9075, "Uniwill", ALC861_UNIWILL_M31), */ |
| 11385 | SND_PCI_QUIRK(0x1849, 0x0660, "Asrock 939SLI32", ALC660_3ST), |
| 11386 | SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11387 | {} |
| 11388 | }; |
| 11389 | |
| 11390 | static struct alc_config_preset alc861_presets[] = { |
| 11391 | [ALC861_3ST] = { |
| 11392 | .mixers = { alc861_3ST_mixer }, |
| 11393 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11394 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11395 | .dac_nids = alc861_dac_nids, |
| 11396 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11397 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11398 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11399 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11400 | .adc_nids = alc861_adc_nids, |
| 11401 | .input_mux = &alc861_capture_source, |
| 11402 | }, |
| 11403 | [ALC861_3ST_DIG] = { |
| 11404 | .mixers = { alc861_base_mixer }, |
| 11405 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11406 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11407 | .dac_nids = alc861_dac_nids, |
| 11408 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11409 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11410 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11411 | .need_dac_fix = 1, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11412 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11413 | .adc_nids = alc861_adc_nids, |
| 11414 | .input_mux = &alc861_capture_source, |
| 11415 | }, |
| 11416 | [ALC861_6ST_DIG] = { |
| 11417 | .mixers = { alc861_base_mixer }, |
| 11418 | .init_verbs = { alc861_base_init_verbs }, |
| 11419 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11420 | .dac_nids = alc861_dac_nids, |
| 11421 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11422 | .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), |
| 11423 | .channel_mode = alc861_8ch_modes, |
| 11424 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11425 | .adc_nids = alc861_adc_nids, |
| 11426 | .input_mux = &alc861_capture_source, |
| 11427 | }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11428 | [ALC660_3ST] = { |
| 11429 | .mixers = { alc861_3ST_mixer }, |
| 11430 | .init_verbs = { alc861_threestack_init_verbs }, |
| 11431 | .num_dacs = ARRAY_SIZE(alc660_dac_nids), |
| 11432 | .dac_nids = alc660_dac_nids, |
| 11433 | .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), |
| 11434 | .channel_mode = alc861_threestack_modes, |
Takashi Iwai | 4e195a7 | 2006-07-28 14:47:34 +0200 | [diff] [blame] | 11435 | .need_dac_fix = 1, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11436 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11437 | .adc_nids = alc861_adc_nids, |
| 11438 | .input_mux = &alc861_capture_source, |
| 11439 | }, |
Takashi Iwai | 22309c3 | 2006-08-09 16:57:28 +0200 | [diff] [blame] | 11440 | [ALC861_UNIWILL_M31] = { |
| 11441 | .mixers = { alc861_uniwill_m31_mixer }, |
| 11442 | .init_verbs = { alc861_uniwill_m31_init_verbs }, |
| 11443 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11444 | .dac_nids = alc861_dac_nids, |
| 11445 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11446 | .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), |
| 11447 | .channel_mode = alc861_uniwill_m31_modes, |
| 11448 | .need_dac_fix = 1, |
| 11449 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11450 | .adc_nids = alc861_adc_nids, |
| 11451 | .input_mux = &alc861_capture_source, |
| 11452 | }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11453 | [ALC861_TOSHIBA] = { |
| 11454 | .mixers = { alc861_toshiba_mixer }, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11455 | .init_verbs = { alc861_base_init_verbs, |
| 11456 | alc861_toshiba_init_verbs }, |
Tobin Davis | a53d1ae | 2006-10-17 12:00:28 +0200 | [diff] [blame] | 11457 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11458 | .dac_nids = alc861_dac_nids, |
| 11459 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11460 | .channel_mode = alc883_3ST_2ch_modes, |
| 11461 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11462 | .adc_nids = alc861_adc_nids, |
| 11463 | .input_mux = &alc861_capture_source, |
| 11464 | .unsol_event = alc861_toshiba_unsol_event, |
| 11465 | .init_hook = alc861_toshiba_automute, |
| 11466 | }, |
Mariusz Domanski | 7cdbff9 | 2006-10-23 13:42:56 +0200 | [diff] [blame] | 11467 | [ALC861_ASUS] = { |
| 11468 | .mixers = { alc861_asus_mixer }, |
| 11469 | .init_verbs = { alc861_asus_init_verbs }, |
| 11470 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11471 | .dac_nids = alc861_dac_nids, |
| 11472 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11473 | .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), |
| 11474 | .channel_mode = alc861_asus_modes, |
| 11475 | .need_dac_fix = 1, |
| 11476 | .hp_nid = 0x06, |
| 11477 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11478 | .adc_nids = alc861_adc_nids, |
| 11479 | .input_mux = &alc861_capture_source, |
| 11480 | }, |
Takashi Iwai | 56bb0ca | 2006-11-22 11:52:52 +0100 | [diff] [blame] | 11481 | [ALC861_ASUS_LAPTOP] = { |
| 11482 | .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, |
| 11483 | .init_verbs = { alc861_asus_init_verbs, |
| 11484 | alc861_asus_laptop_init_verbs }, |
| 11485 | .num_dacs = ARRAY_SIZE(alc861_dac_nids), |
| 11486 | .dac_nids = alc861_dac_nids, |
| 11487 | .dig_out_nid = ALC861_DIGOUT_NID, |
| 11488 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
| 11489 | .channel_mode = alc883_3ST_2ch_modes, |
| 11490 | .need_dac_fix = 1, |
| 11491 | .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), |
| 11492 | .adc_nids = alc861_adc_nids, |
| 11493 | .input_mux = &alc861_capture_source, |
| 11494 | }, |
| 11495 | }; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11496 | |
| 11497 | |
| 11498 | static int patch_alc861(struct hda_codec *codec) |
| 11499 | { |
| 11500 | struct alc_spec *spec; |
| 11501 | int board_config; |
| 11502 | int err; |
| 11503 | |
Robert P. J. Day | dc041e0 | 2006-12-19 14:44:15 +0100 | [diff] [blame] | 11504 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11505 | if (spec == NULL) |
| 11506 | return -ENOMEM; |
| 11507 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11508 | codec->spec = spec; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11509 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11510 | board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, |
| 11511 | alc861_models, |
| 11512 | alc861_cfg_tbl); |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11513 | |
Takashi Iwai | f5fcc13 | 2006-11-24 17:07:44 +0100 | [diff] [blame] | 11514 | if (board_config < 0) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11515 | printk(KERN_INFO "hda_codec: Unknown model for ALC861, " |
| 11516 | "trying auto-probe from BIOS...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11517 | board_config = ALC861_AUTO; |
| 11518 | } |
| 11519 | |
| 11520 | if (board_config == ALC861_AUTO) { |
| 11521 | /* automatic parse from the BIOS config */ |
| 11522 | err = alc861_parse_auto_config(codec); |
| 11523 | if (err < 0) { |
| 11524 | alc_free(codec); |
| 11525 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 11526 | } else if (!err) { |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 11527 | printk(KERN_INFO |
| 11528 | "hda_codec: Cannot set up configuration " |
| 11529 | "from BIOS. Using base mode...\n"); |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11530 | board_config = ALC861_3ST_DIG; |
| 11531 | } |
| 11532 | } |
| 11533 | |
| 11534 | if (board_config != ALC861_AUTO) |
| 11535 | setup_preset(spec, &alc861_presets[board_config]); |
| 11536 | |
| 11537 | spec->stream_name_analog = "ALC861 Analog"; |
| 11538 | spec->stream_analog_playback = &alc861_pcm_analog_playback; |
| 11539 | spec->stream_analog_capture = &alc861_pcm_analog_capture; |
| 11540 | |
| 11541 | spec->stream_name_digital = "ALC861 Digital"; |
| 11542 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
| 11543 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
| 11544 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 11545 | spec->vmaster_nid = 0x03; |
| 11546 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11547 | codec->patch_ops = alc_patch_ops; |
| 11548 | if (board_config == ALC861_AUTO) |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 11549 | spec->init_hook = alc861_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11550 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 11551 | if (!spec->loopback.amplist) |
| 11552 | spec->loopback.amplist = alc861_loopbacks; |
| 11553 | #endif |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 11554 | |
| 11555 | return 0; |
| 11556 | } |
| 11557 | |
| 11558 | /* |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11559 | * ALC861-VD support |
| 11560 | * |
| 11561 | * Based on ALC882 |
| 11562 | * |
| 11563 | * In addition, an independent DAC |
| 11564 | */ |
| 11565 | #define ALC861VD_DIGOUT_NID 0x06 |
| 11566 | |
| 11567 | static hda_nid_t alc861vd_dac_nids[4] = { |
| 11568 | /* front, surr, clfe, side surr */ |
| 11569 | 0x02, 0x03, 0x04, 0x05 |
| 11570 | }; |
| 11571 | |
| 11572 | /* dac_nids for ALC660vd are in a different order - according to |
| 11573 | * Realtek's driver. |
| 11574 | * This should probably tesult in a different mixer for 6stack models |
| 11575 | * of ALC660vd codecs, but for now there is only 3stack mixer |
| 11576 | * - and it is the same as in 861vd. |
| 11577 | * adc_nids in ALC660vd are (is) the same as in 861vd |
| 11578 | */ |
| 11579 | static hda_nid_t alc660vd_dac_nids[3] = { |
| 11580 | /* front, rear, clfe, rear_surr */ |
| 11581 | 0x02, 0x04, 0x03 |
| 11582 | }; |
| 11583 | |
| 11584 | static hda_nid_t alc861vd_adc_nids[1] = { |
| 11585 | /* ADC0 */ |
| 11586 | 0x09, |
| 11587 | }; |
| 11588 | |
| 11589 | /* input MUX */ |
| 11590 | /* FIXME: should be a matrix-type input source selection */ |
| 11591 | static struct hda_input_mux alc861vd_capture_source = { |
| 11592 | .num_items = 4, |
| 11593 | .items = { |
| 11594 | { "Mic", 0x0 }, |
| 11595 | { "Front Mic", 0x1 }, |
| 11596 | { "Line", 0x2 }, |
| 11597 | { "CD", 0x4 }, |
| 11598 | }, |
| 11599 | }; |
| 11600 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11601 | static struct hda_input_mux alc861vd_dallas_capture_source = { |
| 11602 | .num_items = 3, |
| 11603 | .items = { |
| 11604 | { "Front Mic", 0x0 }, |
| 11605 | { "ATAPI Mic", 0x1 }, |
| 11606 | { "Line In", 0x5 }, |
| 11607 | }, |
| 11608 | }; |
| 11609 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11610 | static struct hda_input_mux alc861vd_hp_capture_source = { |
| 11611 | .num_items = 2, |
| 11612 | .items = { |
| 11613 | { "Front Mic", 0x0 }, |
| 11614 | { "ATAPI Mic", 0x1 }, |
| 11615 | }, |
| 11616 | }; |
| 11617 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11618 | #define alc861vd_mux_enum_info alc_mux_enum_info |
| 11619 | #define alc861vd_mux_enum_get alc_mux_enum_get |
| 11620 | |
| 11621 | static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 11622 | struct snd_ctl_elem_value *ucontrol) |
| 11623 | { |
| 11624 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 11625 | struct alc_spec *spec = codec->spec; |
| 11626 | const struct hda_input_mux *imux = spec->input_mux; |
| 11627 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
| 11628 | static hda_nid_t capture_mixers[1] = { 0x22 }; |
| 11629 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 11630 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 11631 | unsigned int i, idx; |
| 11632 | |
| 11633 | idx = ucontrol->value.enumerated.item[0]; |
| 11634 | if (idx >= imux->num_items) |
| 11635 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 11636 | if (*cur_val == idx) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11637 | return 0; |
| 11638 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11639 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 11640 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 11641 | imux->items[i].index, |
| 11642 | HDA_AMP_MUTE, v); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11643 | } |
| 11644 | *cur_val = idx; |
| 11645 | return 1; |
| 11646 | } |
| 11647 | |
| 11648 | /* |
| 11649 | * 2ch mode |
| 11650 | */ |
| 11651 | static struct hda_channel_mode alc861vd_3stack_2ch_modes[1] = { |
| 11652 | { 2, NULL } |
| 11653 | }; |
| 11654 | |
| 11655 | /* |
| 11656 | * 6ch mode |
| 11657 | */ |
| 11658 | static struct hda_verb alc861vd_6stack_ch6_init[] = { |
| 11659 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 11660 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11661 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11662 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11663 | { } /* end */ |
| 11664 | }; |
| 11665 | |
| 11666 | /* |
| 11667 | * 8ch mode |
| 11668 | */ |
| 11669 | static struct hda_verb alc861vd_6stack_ch8_init[] = { |
| 11670 | { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11671 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11672 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11673 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 11674 | { } /* end */ |
| 11675 | }; |
| 11676 | |
| 11677 | static struct hda_channel_mode alc861vd_6stack_modes[2] = { |
| 11678 | { 6, alc861vd_6stack_ch6_init }, |
| 11679 | { 8, alc861vd_6stack_ch8_init }, |
| 11680 | }; |
| 11681 | |
| 11682 | static struct snd_kcontrol_new alc861vd_chmode_mixer[] = { |
| 11683 | { |
| 11684 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11685 | .name = "Channel Mode", |
| 11686 | .info = alc_ch_mode_info, |
| 11687 | .get = alc_ch_mode_get, |
| 11688 | .put = alc_ch_mode_put, |
| 11689 | }, |
| 11690 | { } /* end */ |
| 11691 | }; |
| 11692 | |
| 11693 | static struct snd_kcontrol_new alc861vd_capture_mixer[] = { |
| 11694 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 11695 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 11696 | |
| 11697 | { |
| 11698 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 11699 | /* The multiple "Capture Source" controls confuse alsamixer |
| 11700 | * So call somewhat different.. |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11701 | */ |
| 11702 | /* .name = "Capture Source", */ |
| 11703 | .name = "Input Source", |
| 11704 | .count = 1, |
| 11705 | .info = alc861vd_mux_enum_info, |
| 11706 | .get = alc861vd_mux_enum_get, |
| 11707 | .put = alc861vd_mux_enum_put, |
| 11708 | }, |
| 11709 | { } /* end */ |
| 11710 | }; |
| 11711 | |
| 11712 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 11713 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 11714 | */ |
| 11715 | static struct snd_kcontrol_new alc861vd_6st_mixer[] = { |
| 11716 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11717 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11718 | |
| 11719 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11720 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11721 | |
| 11722 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, |
| 11723 | HDA_OUTPUT), |
| 11724 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, |
| 11725 | HDA_OUTPUT), |
| 11726 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), |
| 11727 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), |
| 11728 | |
| 11729 | HDA_CODEC_VOLUME("Side Playback Volume", 0x05, 0x0, HDA_OUTPUT), |
| 11730 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), |
| 11731 | |
| 11732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11733 | |
| 11734 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11737 | |
| 11738 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11739 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11740 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11741 | |
| 11742 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11743 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11744 | |
| 11745 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11746 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11747 | |
| 11748 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11749 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11750 | |
| 11751 | { } /* end */ |
| 11752 | }; |
| 11753 | |
| 11754 | static struct snd_kcontrol_new alc861vd_3st_mixer[] = { |
| 11755 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11756 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11757 | |
| 11758 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11759 | |
| 11760 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11761 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11762 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11763 | |
| 11764 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11765 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11766 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11767 | |
| 11768 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 11769 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 11770 | |
| 11771 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11772 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11773 | |
| 11774 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11775 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
| 11776 | |
| 11777 | { } /* end */ |
| 11778 | }; |
| 11779 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11780 | static struct snd_kcontrol_new alc861vd_lenovo_mixer[] = { |
| 11781 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11782 | /*HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),*/ |
| 11783 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 11784 | |
| 11785 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 11786 | |
| 11787 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
| 11788 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11790 | |
| 11791 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
| 11792 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11793 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11794 | |
| 11795 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 11796 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 11797 | |
| 11798 | { } /* end */ |
| 11799 | }; |
| 11800 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11801 | /* Pin assignment: Front=0x14, HP = 0x15, |
| 11802 | * Front Mic=0x18, ATAPI Mic = 0x19, Line In = 0x1d |
| 11803 | */ |
| 11804 | static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { |
| 11805 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11806 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11807 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11808 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11809 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11810 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11811 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11812 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11813 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 11814 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 11815 | { } /* end */ |
| 11816 | }; |
| 11817 | |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 11818 | /* Pin assignment: Speaker=0x14, Line-out = 0x15, |
| 11819 | * Front Mic=0x18, ATAPI Mic = 0x19, |
| 11820 | */ |
| 11821 | static struct snd_kcontrol_new alc861vd_hp_mixer[] = { |
| 11822 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 11823 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), |
| 11824 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 11825 | HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), |
| 11826 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 11827 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 11828 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 11829 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 11830 | |
| 11831 | { } /* end */ |
| 11832 | }; |
| 11833 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11834 | /* |
| 11835 | * generic initialization of ADC, input mixers and output mixers |
| 11836 | */ |
| 11837 | static struct hda_verb alc861vd_volume_init_verbs[] = { |
| 11838 | /* |
| 11839 | * Unmute ADC0 and set the default input to mic-in |
| 11840 | */ |
| 11841 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11842 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11843 | |
| 11844 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of |
| 11845 | * the analog-loopback mixer widget |
| 11846 | */ |
| 11847 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 11848 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11849 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11850 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 11851 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 11852 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11853 | |
| 11854 | /* Capture mixer: unmute Mic, F-Mic, Line, CD inputs */ |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11856 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11858 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 11859 | |
| 11860 | /* |
| 11861 | * Set up output mixers (0x02 - 0x05) |
| 11862 | */ |
| 11863 | /* set vol=0 to output mixers */ |
| 11864 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11865 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11866 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11867 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 11868 | |
| 11869 | /* set up input amps for analog loopback */ |
| 11870 | /* Amp Indices: DAC = 0, mixer = 1 */ |
| 11871 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11872 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11873 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11874 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11875 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11876 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11877 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 11878 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 11879 | |
| 11880 | { } |
| 11881 | }; |
| 11882 | |
| 11883 | /* |
| 11884 | * 3-stack pin configuration: |
| 11885 | * front = 0x14, mic/clfe = 0x18, HP = 0x19, line/surr = 0x1a, f-mic = 0x1b |
| 11886 | */ |
| 11887 | static struct hda_verb alc861vd_3stack_init_verbs[] = { |
| 11888 | /* |
| 11889 | * Set pin mode and muting |
| 11890 | */ |
| 11891 | /* set front pin widgets 0x14 for output */ |
| 11892 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11893 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11894 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11895 | |
| 11896 | /* Mic (rear) pin: input vref at 80% */ |
| 11897 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11898 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11899 | /* Front Mic pin: input vref at 80% */ |
| 11900 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11901 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11902 | /* Line In pin: input */ |
| 11903 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11904 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11905 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11906 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11907 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11908 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11909 | /* CD pin widget for input */ |
| 11910 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11911 | |
| 11912 | { } |
| 11913 | }; |
| 11914 | |
| 11915 | /* |
| 11916 | * 6-stack pin configuration: |
| 11917 | */ |
| 11918 | static struct hda_verb alc861vd_6stack_init_verbs[] = { |
| 11919 | /* |
| 11920 | * Set pin mode and muting |
| 11921 | */ |
| 11922 | /* set front pin widgets 0x14 for output */ |
| 11923 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11924 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11925 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11926 | |
| 11927 | /* Rear Pin: output 1 (0x0d) */ |
| 11928 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11930 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
| 11931 | /* CLFE Pin: output 2 (0x0e) */ |
| 11932 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11933 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11934 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, |
| 11935 | /* Side Pin: output 3 (0x0f) */ |
| 11936 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 11937 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11938 | {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, |
| 11939 | |
| 11940 | /* Mic (rear) pin: input vref at 80% */ |
| 11941 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11942 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11943 | /* Front Mic pin: input vref at 80% */ |
| 11944 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 11945 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11946 | /* Line In pin: input */ |
| 11947 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11948 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 11949 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 11950 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 11951 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 11952 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 11953 | /* CD pin widget for input */ |
| 11954 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 11955 | |
| 11956 | { } |
| 11957 | }; |
| 11958 | |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11959 | static struct hda_verb alc861vd_eapd_verbs[] = { |
| 11960 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, |
| 11961 | { } |
| 11962 | }; |
| 11963 | |
| 11964 | static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { |
| 11965 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 11966 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 11967 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
| 11968 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 11969 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 11970 | {} |
| 11971 | }; |
| 11972 | |
| 11973 | /* toggle speaker-output according to the hp-jack state */ |
| 11974 | static void alc861vd_lenovo_hp_automute(struct hda_codec *codec) |
| 11975 | { |
| 11976 | unsigned int present; |
| 11977 | unsigned char bits; |
| 11978 | |
| 11979 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 11980 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11981 | bits = present ? HDA_AMP_MUTE : 0; |
| 11982 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 11983 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11984 | } |
| 11985 | |
| 11986 | static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) |
| 11987 | { |
| 11988 | unsigned int present; |
| 11989 | unsigned char bits; |
| 11990 | |
| 11991 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 11992 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 11993 | bits = present ? HDA_AMP_MUTE : 0; |
| 11994 | snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, |
| 11995 | HDA_AMP_MUTE, bits); |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 11996 | } |
| 11997 | |
| 11998 | static void alc861vd_lenovo_automute(struct hda_codec *codec) |
| 11999 | { |
| 12000 | alc861vd_lenovo_hp_automute(codec); |
| 12001 | alc861vd_lenovo_mic_automute(codec); |
| 12002 | } |
| 12003 | |
| 12004 | static void alc861vd_lenovo_unsol_event(struct hda_codec *codec, |
| 12005 | unsigned int res) |
| 12006 | { |
| 12007 | switch (res >> 26) { |
| 12008 | case ALC880_HP_EVENT: |
| 12009 | alc861vd_lenovo_hp_automute(codec); |
| 12010 | break; |
| 12011 | case ALC880_MIC_EVENT: |
| 12012 | alc861vd_lenovo_mic_automute(codec); |
| 12013 | break; |
| 12014 | } |
| 12015 | } |
| 12016 | |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12017 | static struct hda_verb alc861vd_dallas_verbs[] = { |
| 12018 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12019 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12020 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12021 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12022 | |
| 12023 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12024 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12025 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12026 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12027 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12028 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12029 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12030 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12031 | |
| 12032 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12033 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12034 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12035 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12036 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12037 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12038 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12039 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12040 | |
| 12041 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12042 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12043 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, |
| 12044 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12045 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12046 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12047 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12048 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12049 | |
| 12050 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12053 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
| 12054 | |
| 12055 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12056 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12057 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12058 | |
| 12059 | { } /* end */ |
| 12060 | }; |
| 12061 | |
| 12062 | /* toggle speaker-output according to the hp-jack state */ |
| 12063 | static void alc861vd_dallas_automute(struct hda_codec *codec) |
| 12064 | { |
| 12065 | unsigned int present; |
| 12066 | |
| 12067 | present = snd_hda_codec_read(codec, 0x15, 0, |
| 12068 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12069 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12070 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12071 | } |
| 12072 | |
| 12073 | static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) |
| 12074 | { |
| 12075 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12076 | alc861vd_dallas_automute(codec); |
| 12077 | } |
| 12078 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12079 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12080 | #define alc861vd_loopbacks alc880_loopbacks |
| 12081 | #endif |
| 12082 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12083 | /* pcm configuration: identiacal with ALC880 */ |
| 12084 | #define alc861vd_pcm_analog_playback alc880_pcm_analog_playback |
| 12085 | #define alc861vd_pcm_analog_capture alc880_pcm_analog_capture |
| 12086 | #define alc861vd_pcm_digital_playback alc880_pcm_digital_playback |
| 12087 | #define alc861vd_pcm_digital_capture alc880_pcm_digital_capture |
| 12088 | |
| 12089 | /* |
| 12090 | * configuration and preset |
| 12091 | */ |
| 12092 | static const char *alc861vd_models[ALC861VD_MODEL_LAST] = { |
| 12093 | [ALC660VD_3ST] = "3stack-660", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12094 | [ALC660VD_3ST_DIG] = "3stack-660-digout", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12095 | [ALC861VD_3ST] = "3stack", |
| 12096 | [ALC861VD_3ST_DIG] = "3stack-digout", |
| 12097 | [ALC861VD_6ST_DIG] = "6stack-digout", |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12098 | [ALC861VD_LENOVO] = "lenovo", |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12099 | [ALC861VD_DALLAS] = "dallas", |
Takashi Iwai | 983f8ae | 2007-08-15 16:44:04 +0200 | [diff] [blame] | 12100 | [ALC861VD_HP] = "hp", |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12101 | [ALC861VD_AUTO] = "auto", |
| 12102 | }; |
| 12103 | |
| 12104 | static struct snd_pci_quirk alc861vd_cfg_tbl[] = { |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12105 | SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), |
| 12106 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), |
Takashi Iwai | 07e038b | 2007-02-15 18:23:41 +0100 | [diff] [blame] | 12107 | SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12108 | SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12109 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12110 | SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12111 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba A135", ALC861VD_LENOVO), |
Takashi Iwai | 38baf5a | 2007-08-16 17:52:43 +0200 | [diff] [blame] | 12112 | /*SND_PCI_QUIRK(0x1179, 0xff00, "DALLAS", ALC861VD_DALLAS),*/ /*lenovo*/ |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12113 | SND_PCI_QUIRK(0x1179, 0xff01, "DALLAS", ALC861VD_DALLAS), |
Takashi Iwai | 542d7c6 | 2007-08-16 18:57:30 +0200 | [diff] [blame] | 12114 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
Takashi Iwai | 39c5d41 | 2007-08-15 16:24:17 +0200 | [diff] [blame] | 12115 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 12116 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), |
| 12117 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), |
Tobin Davis | 625dc0b | 2007-07-30 21:42:10 +0200 | [diff] [blame] | 12118 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12119 | {} |
| 12120 | }; |
| 12121 | |
| 12122 | static struct alc_config_preset alc861vd_presets[] = { |
| 12123 | [ALC660VD_3ST] = { |
| 12124 | .mixers = { alc861vd_3st_mixer }, |
| 12125 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12126 | alc861vd_3stack_init_verbs }, |
| 12127 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12128 | .dac_nids = alc660vd_dac_nids, |
| 12129 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12130 | .adc_nids = alc861vd_adc_nids, |
| 12131 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12132 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12133 | .input_mux = &alc861vd_capture_source, |
| 12134 | }, |
Mike Crash | 6963f84 | 2007-06-25 12:12:51 +0200 | [diff] [blame] | 12135 | [ALC660VD_3ST_DIG] = { |
| 12136 | .mixers = { alc861vd_3st_mixer }, |
| 12137 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12138 | alc861vd_3stack_init_verbs }, |
| 12139 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12140 | .dac_nids = alc660vd_dac_nids, |
| 12141 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12142 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12143 | .adc_nids = alc861vd_adc_nids, |
| 12144 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12145 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12146 | .input_mux = &alc861vd_capture_source, |
| 12147 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12148 | [ALC861VD_3ST] = { |
| 12149 | .mixers = { alc861vd_3st_mixer }, |
| 12150 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12151 | alc861vd_3stack_init_verbs }, |
| 12152 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12153 | .dac_nids = alc861vd_dac_nids, |
| 12154 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12155 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12156 | .input_mux = &alc861vd_capture_source, |
| 12157 | }, |
| 12158 | [ALC861VD_3ST_DIG] = { |
| 12159 | .mixers = { alc861vd_3st_mixer }, |
| 12160 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12161 | alc861vd_3stack_init_verbs }, |
| 12162 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12163 | .dac_nids = alc861vd_dac_nids, |
| 12164 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12165 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12166 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12167 | .input_mux = &alc861vd_capture_source, |
| 12168 | }, |
| 12169 | [ALC861VD_6ST_DIG] = { |
| 12170 | .mixers = { alc861vd_6st_mixer, alc861vd_chmode_mixer }, |
| 12171 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12172 | alc861vd_6stack_init_verbs }, |
| 12173 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12174 | .dac_nids = alc861vd_dac_nids, |
| 12175 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12176 | .num_channel_mode = ARRAY_SIZE(alc861vd_6stack_modes), |
| 12177 | .channel_mode = alc861vd_6stack_modes, |
| 12178 | .input_mux = &alc861vd_capture_source, |
| 12179 | }, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12180 | [ALC861VD_LENOVO] = { |
| 12181 | .mixers = { alc861vd_lenovo_mixer }, |
| 12182 | .init_verbs = { alc861vd_volume_init_verbs, |
| 12183 | alc861vd_3stack_init_verbs, |
| 12184 | alc861vd_eapd_verbs, |
| 12185 | alc861vd_lenovo_unsol_verbs }, |
| 12186 | .num_dacs = ARRAY_SIZE(alc660vd_dac_nids), |
| 12187 | .dac_nids = alc660vd_dac_nids, |
| 12188 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12189 | .adc_nids = alc861vd_adc_nids, |
| 12190 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12191 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12192 | .input_mux = &alc861vd_capture_source, |
| 12193 | .unsol_event = alc861vd_lenovo_unsol_event, |
| 12194 | .init_hook = alc861vd_lenovo_automute, |
| 12195 | }, |
Kailang Yang | 272a527 | 2007-05-14 11:00:38 +0200 | [diff] [blame] | 12196 | [ALC861VD_DALLAS] = { |
| 12197 | .mixers = { alc861vd_dallas_mixer }, |
| 12198 | .init_verbs = { alc861vd_dallas_verbs }, |
| 12199 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12200 | .dac_nids = alc861vd_dac_nids, |
| 12201 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12202 | .adc_nids = alc861vd_adc_nids, |
| 12203 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12204 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12205 | .input_mux = &alc861vd_dallas_capture_source, |
| 12206 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12207 | .init_hook = alc861vd_dallas_automute, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12208 | }, |
| 12209 | [ALC861VD_HP] = { |
| 12210 | .mixers = { alc861vd_hp_mixer }, |
| 12211 | .init_verbs = { alc861vd_dallas_verbs, alc861vd_eapd_verbs }, |
| 12212 | .num_dacs = ARRAY_SIZE(alc861vd_dac_nids), |
| 12213 | .dac_nids = alc861vd_dac_nids, |
| 12214 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 12215 | .dig_out_nid = ALC861VD_DIGOUT_NID, |
| 12216 | .adc_nids = alc861vd_adc_nids, |
| 12217 | .num_channel_mode = ARRAY_SIZE(alc861vd_3stack_2ch_modes), |
| 12218 | .channel_mode = alc861vd_3stack_2ch_modes, |
| 12219 | .input_mux = &alc861vd_hp_capture_source, |
| 12220 | .unsol_event = alc861vd_dallas_unsol_event, |
| 12221 | .init_hook = alc861vd_dallas_automute, |
| 12222 | }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12223 | }; |
| 12224 | |
| 12225 | /* |
| 12226 | * BIOS auto configuration |
| 12227 | */ |
| 12228 | static void alc861vd_auto_set_output_and_unmute(struct hda_codec *codec, |
| 12229 | hda_nid_t nid, int pin_type, int dac_idx) |
| 12230 | { |
| 12231 | /* set as output */ |
| 12232 | snd_hda_codec_write(codec, nid, 0, |
| 12233 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 12234 | snd_hda_codec_write(codec, nid, 0, |
| 12235 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 12236 | } |
| 12237 | |
| 12238 | static void alc861vd_auto_init_multi_out(struct hda_codec *codec) |
| 12239 | { |
| 12240 | struct alc_spec *spec = codec->spec; |
| 12241 | int i; |
| 12242 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12243 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12244 | for (i = 0; i <= HDA_SIDE; i++) { |
| 12245 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12246 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12247 | if (nid) |
| 12248 | alc861vd_auto_set_output_and_unmute(codec, nid, |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 12249 | pin_type, i); |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12250 | } |
| 12251 | } |
| 12252 | |
| 12253 | |
| 12254 | static void alc861vd_auto_init_hp_out(struct hda_codec *codec) |
| 12255 | { |
| 12256 | struct alc_spec *spec = codec->spec; |
| 12257 | hda_nid_t pin; |
| 12258 | |
| 12259 | pin = spec->autocfg.hp_pins[0]; |
| 12260 | if (pin) /* connect to front and use dac 0 */ |
| 12261 | alc861vd_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 12262 | } |
| 12263 | |
| 12264 | #define alc861vd_is_input_pin(nid) alc880_is_input_pin(nid) |
| 12265 | #define ALC861VD_PIN_CD_NID ALC880_PIN_CD_NID |
| 12266 | |
| 12267 | static void alc861vd_auto_init_analog_input(struct hda_codec *codec) |
| 12268 | { |
| 12269 | struct alc_spec *spec = codec->spec; |
| 12270 | int i; |
| 12271 | |
| 12272 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 12273 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 12274 | if (alc861vd_is_input_pin(nid)) { |
| 12275 | snd_hda_codec_write(codec, nid, 0, |
| 12276 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 12277 | i <= AUTO_PIN_FRONT_MIC ? |
| 12278 | PIN_VREF80 : PIN_IN); |
| 12279 | if (nid != ALC861VD_PIN_CD_NID) |
| 12280 | snd_hda_codec_write(codec, nid, 0, |
| 12281 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 12282 | AMP_OUT_MUTE); |
| 12283 | } |
| 12284 | } |
| 12285 | } |
| 12286 | |
| 12287 | #define alc861vd_idx_to_mixer_vol(nid) ((nid) + 0x02) |
| 12288 | #define alc861vd_idx_to_mixer_switch(nid) ((nid) + 0x0c) |
| 12289 | |
| 12290 | /* add playback controls from the parsed DAC table */ |
| 12291 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12292 | * different NIDs for mute/unmute switch and volume control */ |
| 12293 | static int alc861vd_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 12294 | const struct auto_pin_cfg *cfg) |
| 12295 | { |
| 12296 | char name[32]; |
| 12297 | static const char *chname[4] = {"Front", "Surround", "CLFE", "Side"}; |
| 12298 | hda_nid_t nid_v, nid_s; |
| 12299 | int i, err; |
| 12300 | |
| 12301 | for (i = 0; i < cfg->line_outs; i++) { |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12302 | if (!spec->multiout.dac_nids[i]) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12303 | continue; |
| 12304 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12305 | alc880_dac_to_idx( |
| 12306 | spec->multiout.dac_nids[i])); |
| 12307 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12308 | alc880_dac_to_idx( |
| 12309 | spec->multiout.dac_nids[i])); |
| 12310 | |
| 12311 | if (i == 2) { |
| 12312 | /* Center/LFE */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12313 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12314 | "Center Playback Volume", |
| 12315 | HDA_COMPOSE_AMP_VAL(nid_v, 1, 0, |
| 12316 | HDA_OUTPUT)); |
| 12317 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12318 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12319 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 12320 | "LFE Playback Volume", |
| 12321 | HDA_COMPOSE_AMP_VAL(nid_v, 2, 0, |
| 12322 | HDA_OUTPUT)); |
| 12323 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12324 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12325 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12326 | "Center Playback Switch", |
| 12327 | HDA_COMPOSE_AMP_VAL(nid_s, 1, 2, |
| 12328 | HDA_INPUT)); |
| 12329 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12330 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12331 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 12332 | "LFE Playback Switch", |
| 12333 | HDA_COMPOSE_AMP_VAL(nid_s, 2, 2, |
| 12334 | HDA_INPUT)); |
| 12335 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12336 | return err; |
| 12337 | } else { |
| 12338 | sprintf(name, "%s Playback Volume", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12339 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12340 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, |
| 12341 | HDA_OUTPUT)); |
| 12342 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12343 | return err; |
| 12344 | sprintf(name, "%s Playback Switch", chname[i]); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12345 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 12346 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12347 | HDA_INPUT)); |
| 12348 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12349 | return err; |
| 12350 | } |
| 12351 | } |
| 12352 | return 0; |
| 12353 | } |
| 12354 | |
| 12355 | /* add playback controls for speaker and HP outputs */ |
| 12356 | /* Based on ALC880 version. But ALC861VD has separate, |
| 12357 | * different NIDs for mute/unmute switch and volume control */ |
| 12358 | static int alc861vd_auto_create_extra_out(struct alc_spec *spec, |
| 12359 | hda_nid_t pin, const char *pfx) |
| 12360 | { |
| 12361 | hda_nid_t nid_v, nid_s; |
| 12362 | int err; |
| 12363 | char name[32]; |
| 12364 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12365 | if (!pin) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12366 | return 0; |
| 12367 | |
| 12368 | if (alc880_is_fixed_pin(pin)) { |
| 12369 | nid_v = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 12370 | /* specify the DAC as the extra output */ |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12371 | if (!spec->multiout.hp_nid) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12372 | spec->multiout.hp_nid = nid_v; |
| 12373 | else |
| 12374 | spec->multiout.extra_out_nid[0] = nid_v; |
| 12375 | /* control HP volume/switch on the output mixer amp */ |
| 12376 | nid_v = alc861vd_idx_to_mixer_vol( |
| 12377 | alc880_fixed_pin_idx(pin)); |
| 12378 | nid_s = alc861vd_idx_to_mixer_switch( |
| 12379 | alc880_fixed_pin_idx(pin)); |
| 12380 | |
| 12381 | sprintf(name, "%s Playback Volume", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12382 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 12383 | HDA_COMPOSE_AMP_VAL(nid_v, 3, 0, HDA_OUTPUT)); |
| 12384 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12385 | return err; |
| 12386 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12387 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 12388 | HDA_COMPOSE_AMP_VAL(nid_s, 3, 2, HDA_INPUT)); |
| 12389 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12390 | return err; |
| 12391 | } else if (alc880_is_multi_pin(pin)) { |
| 12392 | /* set manual connection */ |
| 12393 | /* we have only a switch on HP-out PIN */ |
| 12394 | sprintf(name, "%s Playback Switch", pfx); |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12395 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 12396 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 12397 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12398 | return err; |
| 12399 | } |
| 12400 | return 0; |
| 12401 | } |
| 12402 | |
| 12403 | /* parse the BIOS configuration and set up the alc_spec |
| 12404 | * return 1 if successful, 0 if the proper config is not found, |
| 12405 | * or a negative error code |
| 12406 | * Based on ALC880 version - had to change it to override |
| 12407 | * alc880_auto_create_extra_out and alc880_auto_create_multi_out_ctls */ |
| 12408 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 12409 | { |
| 12410 | struct alc_spec *spec = codec->spec; |
| 12411 | int err; |
| 12412 | static hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
| 12413 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12414 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 12415 | alc861vd_ignore); |
| 12416 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12417 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12418 | if (!spec->autocfg.line_outs) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12419 | return 0; /* can't find valid BIOS pin config */ |
| 12420 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12421 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 12422 | if (err < 0) |
| 12423 | return err; |
| 12424 | err = alc861vd_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 12425 | if (err < 0) |
| 12426 | return err; |
| 12427 | err = alc861vd_auto_create_extra_out(spec, |
| 12428 | spec->autocfg.speaker_pins[0], |
| 12429 | "Speaker"); |
| 12430 | if (err < 0) |
| 12431 | return err; |
| 12432 | err = alc861vd_auto_create_extra_out(spec, |
| 12433 | spec->autocfg.hp_pins[0], |
| 12434 | "Headphone"); |
| 12435 | if (err < 0) |
| 12436 | return err; |
| 12437 | err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 12438 | if (err < 0) |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12439 | return err; |
| 12440 | |
| 12441 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 12442 | |
| 12443 | if (spec->autocfg.dig_out_pin) |
| 12444 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
| 12445 | |
| 12446 | if (spec->kctl_alloc) |
| 12447 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 12448 | |
| 12449 | spec->init_verbs[spec->num_init_verbs++] |
| 12450 | = alc861vd_volume_init_verbs; |
| 12451 | |
| 12452 | spec->num_mux_defs = 1; |
| 12453 | spec->input_mux = &spec->private_imux; |
| 12454 | |
Takashi Iwai | 776e184 | 2007-08-29 15:07:11 +0200 | [diff] [blame] | 12455 | err = alc_auto_add_mic_boost(codec); |
| 12456 | if (err < 0) |
| 12457 | return err; |
| 12458 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12459 | return 1; |
| 12460 | } |
| 12461 | |
| 12462 | /* additional initialization for auto-configuration model */ |
| 12463 | static void alc861vd_auto_init(struct hda_codec *codec) |
| 12464 | { |
| 12465 | alc861vd_auto_init_multi_out(codec); |
| 12466 | alc861vd_auto_init_hp_out(codec); |
| 12467 | alc861vd_auto_init_analog_input(codec); |
| 12468 | } |
| 12469 | |
| 12470 | static int patch_alc861vd(struct hda_codec *codec) |
| 12471 | { |
| 12472 | struct alc_spec *spec; |
| 12473 | int err, board_config; |
| 12474 | |
| 12475 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 12476 | if (spec == NULL) |
| 12477 | return -ENOMEM; |
| 12478 | |
| 12479 | codec->spec = spec; |
| 12480 | |
| 12481 | board_config = snd_hda_check_board_config(codec, ALC861VD_MODEL_LAST, |
| 12482 | alc861vd_models, |
| 12483 | alc861vd_cfg_tbl); |
| 12484 | |
| 12485 | if (board_config < 0 || board_config >= ALC861VD_MODEL_LAST) { |
| 12486 | printk(KERN_INFO "hda_codec: Unknown model for ALC660VD/" |
| 12487 | "ALC861VD, trying auto-probe from BIOS...\n"); |
| 12488 | board_config = ALC861VD_AUTO; |
| 12489 | } |
| 12490 | |
| 12491 | if (board_config == ALC861VD_AUTO) { |
| 12492 | /* automatic parse from the BIOS config */ |
| 12493 | err = alc861vd_parse_auto_config(codec); |
| 12494 | if (err < 0) { |
| 12495 | alc_free(codec); |
| 12496 | return err; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12497 | } else if (!err) { |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12498 | printk(KERN_INFO |
| 12499 | "hda_codec: Cannot set up configuration " |
| 12500 | "from BIOS. Using base mode...\n"); |
| 12501 | board_config = ALC861VD_3ST; |
| 12502 | } |
| 12503 | } |
| 12504 | |
| 12505 | if (board_config != ALC861VD_AUTO) |
| 12506 | setup_preset(spec, &alc861vd_presets[board_config]); |
| 12507 | |
| 12508 | spec->stream_name_analog = "ALC861VD Analog"; |
| 12509 | spec->stream_analog_playback = &alc861vd_pcm_analog_playback; |
| 12510 | spec->stream_analog_capture = &alc861vd_pcm_analog_capture; |
| 12511 | |
| 12512 | spec->stream_name_digital = "ALC861VD Digital"; |
| 12513 | spec->stream_digital_playback = &alc861vd_pcm_digital_playback; |
| 12514 | spec->stream_digital_capture = &alc861vd_pcm_digital_capture; |
| 12515 | |
| 12516 | spec->adc_nids = alc861vd_adc_nids; |
| 12517 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
| 12518 | |
| 12519 | spec->mixers[spec->num_mixers] = alc861vd_capture_mixer; |
| 12520 | spec->num_mixers++; |
| 12521 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 12522 | spec->vmaster_nid = 0x02; |
| 12523 | |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12524 | codec->patch_ops = alc_patch_ops; |
| 12525 | |
| 12526 | if (board_config == ALC861VD_AUTO) |
| 12527 | spec->init_hook = alc861vd_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12528 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 12529 | if (!spec->loopback.amplist) |
| 12530 | spec->loopback.amplist = alc861vd_loopbacks; |
| 12531 | #endif |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 12532 | |
| 12533 | return 0; |
| 12534 | } |
| 12535 | |
| 12536 | /* |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12537 | * ALC662 support |
| 12538 | * |
| 12539 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 12540 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 12541 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 12542 | * 6-channel independent captures. |
| 12543 | * |
| 12544 | * In addition, an independent DAC for the multi-playback (not used in this |
| 12545 | * driver yet). |
| 12546 | */ |
| 12547 | #define ALC662_DIGOUT_NID 0x06 |
| 12548 | #define ALC662_DIGIN_NID 0x0a |
| 12549 | |
| 12550 | static hda_nid_t alc662_dac_nids[4] = { |
| 12551 | /* front, rear, clfe, rear_surr */ |
| 12552 | 0x02, 0x03, 0x04 |
| 12553 | }; |
| 12554 | |
| 12555 | static hda_nid_t alc662_adc_nids[1] = { |
| 12556 | /* ADC1-2 */ |
| 12557 | 0x09, |
| 12558 | }; |
| 12559 | /* input MUX */ |
| 12560 | /* FIXME: should be a matrix-type input source selection */ |
| 12561 | |
| 12562 | static struct hda_input_mux alc662_capture_source = { |
| 12563 | .num_items = 4, |
| 12564 | .items = { |
| 12565 | { "Mic", 0x0 }, |
| 12566 | { "Front Mic", 0x1 }, |
| 12567 | { "Line", 0x2 }, |
| 12568 | { "CD", 0x4 }, |
| 12569 | }, |
| 12570 | }; |
| 12571 | |
| 12572 | static struct hda_input_mux alc662_lenovo_101e_capture_source = { |
| 12573 | .num_items = 2, |
| 12574 | .items = { |
| 12575 | { "Mic", 0x1 }, |
| 12576 | { "Line", 0x2 }, |
| 12577 | }, |
| 12578 | }; |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12579 | |
| 12580 | static struct hda_input_mux alc662_eeepc_capture_source = { |
| 12581 | .num_items = 2, |
| 12582 | .items = { |
| 12583 | { "i-Mic", 0x1 }, |
| 12584 | { "e-Mic", 0x0 }, |
| 12585 | }, |
| 12586 | }; |
| 12587 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12588 | #define alc662_mux_enum_info alc_mux_enum_info |
| 12589 | #define alc662_mux_enum_get alc_mux_enum_get |
| 12590 | |
| 12591 | static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol, |
| 12592 | struct snd_ctl_elem_value *ucontrol) |
| 12593 | { |
| 12594 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 12595 | struct alc_spec *spec = codec->spec; |
| 12596 | const struct hda_input_mux *imux = spec->input_mux; |
| 12597 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12598 | static hda_nid_t capture_mixers[2] = { 0x23, 0x22 }; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12599 | hda_nid_t nid = capture_mixers[adc_idx]; |
| 12600 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
| 12601 | unsigned int i, idx; |
| 12602 | |
| 12603 | idx = ucontrol->value.enumerated.item[0]; |
| 12604 | if (idx >= imux->num_items) |
| 12605 | idx = imux->num_items - 1; |
Takashi Iwai | 82beb8f | 2007-08-10 17:09:26 +0200 | [diff] [blame] | 12606 | if (*cur_val == idx) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12607 | return 0; |
| 12608 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12609 | unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE; |
| 12610 | snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, |
| 12611 | imux->items[i].index, |
| 12612 | HDA_AMP_MUTE, v); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12613 | } |
| 12614 | *cur_val = idx; |
| 12615 | return 1; |
| 12616 | } |
| 12617 | /* |
| 12618 | * 2ch mode |
| 12619 | */ |
| 12620 | static struct hda_channel_mode alc662_3ST_2ch_modes[1] = { |
| 12621 | { 2, NULL } |
| 12622 | }; |
| 12623 | |
| 12624 | /* |
| 12625 | * 2ch mode |
| 12626 | */ |
| 12627 | static struct hda_verb alc662_3ST_ch2_init[] = { |
| 12628 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
| 12629 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12630 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
| 12631 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
| 12632 | { } /* end */ |
| 12633 | }; |
| 12634 | |
| 12635 | /* |
| 12636 | * 6ch mode |
| 12637 | */ |
| 12638 | static struct hda_verb alc662_3ST_ch6_init[] = { |
| 12639 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12640 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12641 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, |
| 12642 | { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12643 | { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
| 12644 | { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
| 12645 | { } /* end */ |
| 12646 | }; |
| 12647 | |
| 12648 | static struct hda_channel_mode alc662_3ST_6ch_modes[2] = { |
| 12649 | { 2, alc662_3ST_ch2_init }, |
| 12650 | { 6, alc662_3ST_ch6_init }, |
| 12651 | }; |
| 12652 | |
| 12653 | /* |
| 12654 | * 2ch mode |
| 12655 | */ |
| 12656 | static struct hda_verb alc662_sixstack_ch6_init[] = { |
| 12657 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12658 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, |
| 12659 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12660 | { } /* end */ |
| 12661 | }; |
| 12662 | |
| 12663 | /* |
| 12664 | * 6ch mode |
| 12665 | */ |
| 12666 | static struct hda_verb alc662_sixstack_ch8_init[] = { |
| 12667 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12668 | { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12669 | { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
| 12670 | { } /* end */ |
| 12671 | }; |
| 12672 | |
| 12673 | static struct hda_channel_mode alc662_5stack_modes[2] = { |
| 12674 | { 2, alc662_sixstack_ch6_init }, |
| 12675 | { 6, alc662_sixstack_ch8_init }, |
| 12676 | }; |
| 12677 | |
| 12678 | /* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17 |
| 12679 | * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b |
| 12680 | */ |
| 12681 | |
| 12682 | static struct snd_kcontrol_new alc662_base_mixer[] = { |
| 12683 | /* output mixer control */ |
| 12684 | HDA_CODEC_VOLUME("Front Playback Volume", 0x2, 0x0, HDA_OUTPUT), |
| 12685 | HDA_CODEC_MUTE("Front Playback Switch", 0x02, 0x0, HDA_OUTPUT), |
| 12686 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x3, 0x0, HDA_OUTPUT), |
| 12687 | HDA_CODEC_MUTE("Surround Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
| 12688 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12689 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12690 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12691 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12692 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12693 | |
| 12694 | /*Input mixer control */ |
| 12695 | HDA_CODEC_VOLUME("CD Playback Volume", 0xb, 0x4, HDA_INPUT), |
| 12696 | HDA_CODEC_MUTE("CD Playback Switch", 0xb, 0x4, HDA_INPUT), |
| 12697 | HDA_CODEC_VOLUME("Line Playback Volume", 0xb, 0x02, HDA_INPUT), |
| 12698 | HDA_CODEC_MUTE("Line Playback Switch", 0xb, 0x02, HDA_INPUT), |
| 12699 | HDA_CODEC_VOLUME("Mic Playback Volume", 0xb, 0x0, HDA_INPUT), |
| 12700 | HDA_CODEC_MUTE("Mic Playback Switch", 0xb, 0x0, HDA_INPUT), |
| 12701 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0xb, 0x01, HDA_INPUT), |
| 12702 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0xb, 0x01, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12703 | { } /* end */ |
| 12704 | }; |
| 12705 | |
| 12706 | static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { |
| 12707 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12708 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12709 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12710 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12711 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12712 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12713 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12714 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12715 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12716 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12717 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12718 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12719 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12720 | { } /* end */ |
| 12721 | }; |
| 12722 | |
| 12723 | static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { |
| 12724 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12725 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
| 12726 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12727 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12728 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12729 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12730 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12731 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
| 12732 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12733 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
| 12734 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
| 12735 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12736 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12737 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12738 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12739 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12740 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12741 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), |
| 12742 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12743 | { } /* end */ |
| 12744 | }; |
| 12745 | |
| 12746 | static struct snd_kcontrol_new alc662_lenovo_101e_mixer[] = { |
| 12747 | HDA_CODEC_VOLUME("Front Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12748 | HDA_BIND_MUTE("Front Playback Switch", 0x02, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12749 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12750 | HDA_BIND_MUTE("Speaker Playback Switch", 0x03, 2, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12751 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12752 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12753 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12754 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12755 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12756 | { } /* end */ |
| 12757 | }; |
| 12758 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12759 | static struct snd_kcontrol_new alc662_eeepc_p701_mixer[] = { |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12760 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12761 | |
| 12762 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12763 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
| 12764 | |
| 12765 | HDA_CODEC_VOLUME("e-Mic Boost", 0x18, 0, HDA_INPUT), |
| 12766 | HDA_CODEC_VOLUME("e-Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12767 | HDA_CODEC_MUTE("e-Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12768 | |
| 12769 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), |
| 12770 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
| 12771 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
| 12772 | { } /* end */ |
| 12773 | }; |
| 12774 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12775 | static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { |
| 12776 | HDA_CODEC_VOLUME("LineOut Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
| 12777 | HDA_CODEC_MUTE("LineOut Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
| 12778 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
| 12779 | HDA_BIND_MUTE("Surround Playback Switch", 0x03, 2, HDA_INPUT), |
| 12780 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x04, 1, 0x0, HDA_OUTPUT), |
| 12781 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x04, 2, 0x0, HDA_OUTPUT), |
| 12782 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x04, 1, 2, HDA_INPUT), |
| 12783 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x04, 2, 2, HDA_INPUT), |
Takashi Iwai | 86cd929 | 2008-01-28 18:09:56 +0100 | [diff] [blame] | 12784 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12785 | HDA_BIND_MUTE("MuteCtrl Playback Switch", 0x0c, 2, HDA_INPUT), |
| 12786 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), |
| 12787 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
| 12788 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
| 12789 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
| 12790 | { } /* end */ |
| 12791 | }; |
| 12792 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12793 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
| 12794 | { |
| 12795 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12796 | .name = "Channel Mode", |
| 12797 | .info = alc_ch_mode_info, |
| 12798 | .get = alc_ch_mode_get, |
| 12799 | .put = alc_ch_mode_put, |
| 12800 | }, |
| 12801 | { } /* end */ |
| 12802 | }; |
| 12803 | |
| 12804 | static struct hda_verb alc662_init_verbs[] = { |
| 12805 | /* ADC: mute amp left and right */ |
| 12806 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12807 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12808 | /* Front mixer: unmute input/output amp left and right (volume = 0) */ |
| 12809 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12810 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12811 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12812 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12813 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12814 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12815 | |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12816 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12817 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12818 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12819 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12820 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12821 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12822 | |
| 12823 | /* Front Pin: output 0 (0x0c) */ |
| 12824 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12825 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12826 | |
| 12827 | /* Rear Pin: output 1 (0x0d) */ |
| 12828 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12829 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12830 | |
| 12831 | /* CLFE Pin: output 2 (0x0e) */ |
| 12832 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12834 | |
| 12835 | /* Mic (rear) pin: input vref at 80% */ |
| 12836 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12837 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12838 | /* Front Mic pin: input vref at 80% */ |
| 12839 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
| 12840 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12841 | /* Line In pin: input */ |
| 12842 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12843 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
| 12844 | /* Line-2 In: Headphone output (output 0 - 0x0c) */ |
| 12845 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
| 12846 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
| 12847 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12848 | /* CD pin widget for input */ |
| 12849 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
| 12850 | |
| 12851 | /* FIXME: use matrix-type input source selection */ |
| 12852 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12853 | /* Input mixer */ |
| 12854 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12855 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12856 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12857 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12858 | |
| 12859 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12860 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12861 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, |
| 12862 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12863 | { } |
| 12864 | }; |
| 12865 | |
| 12866 | static struct hda_verb alc662_sue_init_verbs[] = { |
| 12867 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT}, |
| 12868 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12869 | {} |
| 12870 | }; |
| 12871 | |
| 12872 | static struct hda_verb alc662_eeepc_sue_init_verbs[] = { |
| 12873 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
| 12874 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12875 | {} |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12876 | }; |
| 12877 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 12878 | /* Set Unsolicited Event*/ |
| 12879 | static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = { |
| 12880 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
| 12881 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
| 12882 | {} |
| 12883 | }; |
| 12884 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12885 | /* |
| 12886 | * generic initialization of ADC, input mixers and output mixers |
| 12887 | */ |
| 12888 | static struct hda_verb alc662_auto_init_verbs[] = { |
| 12889 | /* |
| 12890 | * Unmute ADC and set the default input to mic-in |
| 12891 | */ |
| 12892 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
| 12893 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12894 | |
| 12895 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
| 12896 | * mixer widget |
| 12897 | * Note: PASD motherboards uses the Line In 2 as the input for front |
| 12898 | * panel mic (mic 2) |
| 12899 | */ |
| 12900 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 12901 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
| 12902 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 12903 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
| 12904 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, |
| 12905 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12906 | |
| 12907 | /* |
| 12908 | * Set up output mixers (0x0c - 0x0f) |
| 12909 | */ |
| 12910 | /* set vol=0 to output mixers */ |
| 12911 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12912 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12913 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
| 12914 | |
| 12915 | /* set up input amps for analog loopback */ |
| 12916 | /* Amp Indices: DAC = 0, mixer = 1 */ |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 12917 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12918 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12919 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12920 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
| 12921 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 12922 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12923 | |
| 12924 | |
| 12925 | /* FIXME: use matrix-type input source selection */ |
| 12926 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
| 12927 | /* Input mixer */ |
| 12928 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | d1a991a | 2007-08-15 16:21:59 +0200 | [diff] [blame] | 12929 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12930 | { } |
| 12931 | }; |
| 12932 | |
| 12933 | /* capture mixer elements */ |
| 12934 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
| 12935 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
| 12936 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
| 12937 | { |
| 12938 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
| 12939 | /* The multiple "Capture Source" controls confuse alsamixer |
| 12940 | * So call somewhat different.. |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12941 | */ |
| 12942 | /* .name = "Capture Source", */ |
| 12943 | .name = "Input Source", |
| 12944 | .count = 1, |
Herton Ronaldo Krzesinski | 6e7939b | 2007-12-19 17:49:02 +0100 | [diff] [blame] | 12945 | .info = alc662_mux_enum_info, |
| 12946 | .get = alc662_mux_enum_get, |
| 12947 | .put = alc662_mux_enum_put, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12948 | }, |
| 12949 | { } /* end */ |
| 12950 | }; |
| 12951 | |
| 12952 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
| 12953 | { |
| 12954 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12955 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12956 | |
| 12957 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 12958 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12959 | bits = present ? HDA_AMP_MUTE : 0; |
| 12960 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12961 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12962 | } |
| 12963 | |
| 12964 | static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) |
| 12965 | { |
| 12966 | unsigned int present; |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 12967 | unsigned char bits; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12968 | |
| 12969 | present = snd_hda_codec_read(codec, 0x1b, 0, |
| 12970 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
Takashi Iwai | 47fd830 | 2007-08-10 17:11:07 +0200 | [diff] [blame] | 12971 | bits = present ? HDA_AMP_MUTE : 0; |
| 12972 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
| 12973 | HDA_AMP_MUTE, bits); |
| 12974 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
| 12975 | HDA_AMP_MUTE, bits); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 12976 | } |
| 12977 | |
| 12978 | static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, |
| 12979 | unsigned int res) |
| 12980 | { |
| 12981 | if ((res >> 26) == ALC880_HP_EVENT) |
| 12982 | alc662_lenovo_101e_all_automute(codec); |
| 12983 | if ((res >> 26) == ALC880_FRONT_EVENT) |
| 12984 | alc662_lenovo_101e_ispeaker_automute(codec); |
| 12985 | } |
| 12986 | |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 12987 | static void alc662_eeepc_mic_automute(struct hda_codec *codec) |
| 12988 | { |
| 12989 | unsigned int present; |
| 12990 | |
| 12991 | present = snd_hda_codec_read(codec, 0x18, 0, |
| 12992 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
| 12993 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12994 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12995 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12996 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
| 12997 | snd_hda_codec_write(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 12998 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 12999 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 13000 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
| 13001 | } |
| 13002 | |
| 13003 | /* unsolicited event for HP jack sensing */ |
| 13004 | static void alc662_eeepc_unsol_event(struct hda_codec *codec, |
| 13005 | unsigned int res) |
| 13006 | { |
| 13007 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13008 | alc262_hippo1_automute( codec ); |
| 13009 | |
| 13010 | if ((res >> 26) == ALC880_MIC_EVENT) |
| 13011 | alc662_eeepc_mic_automute(codec); |
| 13012 | } |
| 13013 | |
| 13014 | static void alc662_eeepc_inithook(struct hda_codec *codec) |
| 13015 | { |
| 13016 | alc262_hippo1_automute( codec ); |
| 13017 | alc662_eeepc_mic_automute(codec); |
| 13018 | } |
| 13019 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13020 | static void alc662_eeepc_ep20_automute(struct hda_codec *codec) |
| 13021 | { |
| 13022 | unsigned int mute; |
| 13023 | unsigned int present; |
| 13024 | |
| 13025 | snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); |
| 13026 | present = snd_hda_codec_read(codec, 0x14, 0, |
| 13027 | AC_VERB_GET_PIN_SENSE, 0); |
| 13028 | present = (present & 0x80000000) != 0; |
| 13029 | if (present) { |
| 13030 | /* mute internal speaker */ |
| 13031 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13032 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
| 13033 | } else { |
| 13034 | /* unmute internal speaker if necessary */ |
| 13035 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
| 13036 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
| 13037 | HDA_AMP_MUTE, mute); |
| 13038 | } |
| 13039 | } |
| 13040 | |
| 13041 | /* unsolicited event for HP jack sensing */ |
| 13042 | static void alc662_eeepc_ep20_unsol_event(struct hda_codec *codec, |
| 13043 | unsigned int res) |
| 13044 | { |
| 13045 | if ((res >> 26) == ALC880_HP_EVENT) |
| 13046 | alc662_eeepc_ep20_automute(codec); |
| 13047 | } |
| 13048 | |
| 13049 | static void alc662_eeepc_ep20_inithook(struct hda_codec *codec) |
| 13050 | { |
| 13051 | alc662_eeepc_ep20_automute(codec); |
| 13052 | } |
| 13053 | |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13054 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13055 | #define alc662_loopbacks alc880_loopbacks |
| 13056 | #endif |
| 13057 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13058 | |
| 13059 | /* pcm configuration: identiacal with ALC880 */ |
| 13060 | #define alc662_pcm_analog_playback alc880_pcm_analog_playback |
| 13061 | #define alc662_pcm_analog_capture alc880_pcm_analog_capture |
| 13062 | #define alc662_pcm_digital_playback alc880_pcm_digital_playback |
| 13063 | #define alc662_pcm_digital_capture alc880_pcm_digital_capture |
| 13064 | |
| 13065 | /* |
| 13066 | * configuration and preset |
| 13067 | */ |
| 13068 | static const char *alc662_models[ALC662_MODEL_LAST] = { |
| 13069 | [ALC662_3ST_2ch_DIG] = "3stack-dig", |
| 13070 | [ALC662_3ST_6ch_DIG] = "3stack-6ch-dig", |
| 13071 | [ALC662_3ST_6ch] = "3stack-6ch", |
| 13072 | [ALC662_5ST_DIG] = "6stack-dig", |
| 13073 | [ALC662_LENOVO_101E] = "lenovo-101e", |
Takashi Iwai | b995d76 | 2007-10-17 10:41:06 +0200 | [diff] [blame] | 13074 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13075 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13076 | [ALC662_AUTO] = "auto", |
| 13077 | }; |
| 13078 | |
| 13079 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13080 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13081 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
Takashi Iwai | ac3e374 | 2007-12-17 17:14:18 +0100 | [diff] [blame] | 13082 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13083 | {} |
| 13084 | }; |
| 13085 | |
| 13086 | static struct alc_config_preset alc662_presets[] = { |
| 13087 | [ALC662_3ST_2ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13088 | .mixers = { alc662_3ST_2ch_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13089 | .init_verbs = { alc662_init_verbs }, |
| 13090 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13091 | .dac_nids = alc662_dac_nids, |
| 13092 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13093 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13094 | .adc_nids = alc662_adc_nids, |
| 13095 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13096 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13097 | .channel_mode = alc662_3ST_2ch_modes, |
| 13098 | .input_mux = &alc662_capture_source, |
| 13099 | }, |
| 13100 | [ALC662_3ST_6ch_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13101 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13102 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13103 | .init_verbs = { alc662_init_verbs }, |
| 13104 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13105 | .dac_nids = alc662_dac_nids, |
| 13106 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13107 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13108 | .adc_nids = alc662_adc_nids, |
| 13109 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13110 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13111 | .channel_mode = alc662_3ST_6ch_modes, |
| 13112 | .need_dac_fix = 1, |
| 13113 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13114 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13115 | [ALC662_3ST_6ch] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13116 | .mixers = { alc662_3ST_6ch_mixer, alc662_chmode_mixer, |
| 13117 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13118 | .init_verbs = { alc662_init_verbs }, |
| 13119 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13120 | .dac_nids = alc662_dac_nids, |
| 13121 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13122 | .adc_nids = alc662_adc_nids, |
| 13123 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13124 | .channel_mode = alc662_3ST_6ch_modes, |
| 13125 | .need_dac_fix = 1, |
| 13126 | .input_mux = &alc662_capture_source, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13127 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13128 | [ALC662_5ST_DIG] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13129 | .mixers = { alc662_base_mixer, alc662_chmode_mixer, |
| 13130 | alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13131 | .init_verbs = { alc662_init_verbs }, |
| 13132 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13133 | .dac_nids = alc662_dac_nids, |
| 13134 | .dig_out_nid = ALC662_DIGOUT_NID, |
| 13135 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13136 | .adc_nids = alc662_adc_nids, |
| 13137 | .dig_in_nid = ALC662_DIGIN_NID, |
| 13138 | .num_channel_mode = ARRAY_SIZE(alc662_5stack_modes), |
| 13139 | .channel_mode = alc662_5stack_modes, |
| 13140 | .input_mux = &alc662_capture_source, |
| 13141 | }, |
| 13142 | [ALC662_LENOVO_101E] = { |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13143 | .mixers = { alc662_lenovo_101e_mixer, alc662_capture_mixer }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13144 | .init_verbs = { alc662_init_verbs, alc662_sue_init_verbs }, |
| 13145 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13146 | .dac_nids = alc662_dac_nids, |
| 13147 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13148 | .adc_nids = alc662_adc_nids, |
| 13149 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13150 | .channel_mode = alc662_3ST_2ch_modes, |
| 13151 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13152 | .unsol_event = alc662_lenovo_101e_unsol_event, |
| 13153 | .init_hook = alc662_lenovo_101e_all_automute, |
| 13154 | }, |
Kailang Yang | 291702f | 2007-10-16 14:28:03 +0200 | [diff] [blame] | 13155 | [ALC662_ASUS_EEEPC_P701] = { |
| 13156 | .mixers = { alc662_eeepc_p701_mixer, alc662_capture_mixer }, |
| 13157 | .init_verbs = { alc662_init_verbs, |
| 13158 | alc662_eeepc_sue_init_verbs }, |
| 13159 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13160 | .dac_nids = alc662_dac_nids, |
| 13161 | .num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids), |
| 13162 | .adc_nids = alc662_adc_nids, |
| 13163 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), |
| 13164 | .channel_mode = alc662_3ST_2ch_modes, |
| 13165 | .input_mux = &alc662_eeepc_capture_source, |
| 13166 | .unsol_event = alc662_eeepc_unsol_event, |
| 13167 | .init_hook = alc662_eeepc_inithook, |
| 13168 | }, |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13169 | [ALC662_ASUS_EEEPC_EP20] = { |
| 13170 | .mixers = { alc662_eeepc_ep20_mixer, alc662_capture_mixer, |
| 13171 | alc662_chmode_mixer }, |
| 13172 | .init_verbs = { alc662_init_verbs, |
| 13173 | alc662_eeepc_ep20_sue_init_verbs }, |
| 13174 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), |
| 13175 | .dac_nids = alc662_dac_nids, |
| 13176 | .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), |
| 13177 | .adc_nids = alc662_adc_nids, |
| 13178 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes), |
| 13179 | .channel_mode = alc662_3ST_6ch_modes, |
| 13180 | .input_mux = &alc662_lenovo_101e_capture_source, |
| 13181 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
| 13182 | .init_hook = alc662_eeepc_ep20_inithook, |
| 13183 | }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13184 | |
| 13185 | }; |
| 13186 | |
| 13187 | |
| 13188 | /* |
| 13189 | * BIOS auto configuration |
| 13190 | */ |
| 13191 | |
| 13192 | /* add playback controls from the parsed DAC table */ |
| 13193 | static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, |
| 13194 | const struct auto_pin_cfg *cfg) |
| 13195 | { |
| 13196 | char name[32]; |
| 13197 | static const char *chname[4] = { |
| 13198 | "Front", "Surround", NULL /*CLFE*/, "Side" |
| 13199 | }; |
| 13200 | hda_nid_t nid; |
| 13201 | int i, err; |
| 13202 | |
| 13203 | for (i = 0; i < cfg->line_outs; i++) { |
| 13204 | if (!spec->multiout.dac_nids[i]) |
| 13205 | continue; |
Kailang Yang | b60dd39 | 2007-09-20 12:50:29 +0200 | [diff] [blame] | 13206 | nid = alc880_idx_to_dac(i); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13207 | if (i == 2) { |
| 13208 | /* Center/LFE */ |
| 13209 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13210 | "Center Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13211 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, |
| 13212 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13213 | if (err < 0) |
| 13214 | return err; |
| 13215 | err = add_control(spec, ALC_CTL_WIDGET_VOL, |
| 13216 | "LFE Playback Volume", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13217 | HDA_COMPOSE_AMP_VAL(nid, 2, 0, |
| 13218 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13219 | if (err < 0) |
| 13220 | return err; |
| 13221 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13222 | "Center Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13223 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, |
| 13224 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13225 | if (err < 0) |
| 13226 | return err; |
| 13227 | err = add_control(spec, ALC_CTL_BIND_MUTE, |
| 13228 | "LFE Playback Switch", |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13229 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, |
| 13230 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13231 | if (err < 0) |
| 13232 | return err; |
| 13233 | } else { |
| 13234 | sprintf(name, "%s Playback Volume", chname[i]); |
| 13235 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13236 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
| 13237 | HDA_OUTPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13238 | if (err < 0) |
| 13239 | return err; |
| 13240 | sprintf(name, "%s Playback Switch", chname[i]); |
| 13241 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13242 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, |
| 13243 | HDA_INPUT)); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13244 | if (err < 0) |
| 13245 | return err; |
| 13246 | } |
| 13247 | } |
| 13248 | return 0; |
| 13249 | } |
| 13250 | |
| 13251 | /* add playback controls for speaker and HP outputs */ |
| 13252 | static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, |
| 13253 | const char *pfx) |
| 13254 | { |
| 13255 | hda_nid_t nid; |
| 13256 | int err; |
| 13257 | char name[32]; |
| 13258 | |
| 13259 | if (!pin) |
| 13260 | return 0; |
| 13261 | |
| 13262 | if (alc880_is_fixed_pin(pin)) { |
| 13263 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13264 | /* printk("DAC nid=%x\n",nid); */ |
| 13265 | /* specify the DAC as the extra output */ |
| 13266 | if (!spec->multiout.hp_nid) |
| 13267 | spec->multiout.hp_nid = nid; |
| 13268 | else |
| 13269 | spec->multiout.extra_out_nid[0] = nid; |
| 13270 | /* control HP volume/switch on the output mixer amp */ |
| 13271 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
| 13272 | sprintf(name, "%s Playback Volume", pfx); |
| 13273 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, |
| 13274 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); |
| 13275 | if (err < 0) |
| 13276 | return err; |
| 13277 | sprintf(name, "%s Playback Switch", pfx); |
| 13278 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, |
| 13279 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT)); |
| 13280 | if (err < 0) |
| 13281 | return err; |
| 13282 | } else if (alc880_is_multi_pin(pin)) { |
| 13283 | /* set manual connection */ |
| 13284 | /* we have only a switch on HP-out PIN */ |
| 13285 | sprintf(name, "%s Playback Switch", pfx); |
| 13286 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
| 13287 | HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT)); |
| 13288 | if (err < 0) |
| 13289 | return err; |
| 13290 | } |
| 13291 | return 0; |
| 13292 | } |
| 13293 | |
| 13294 | /* create playback/capture controls for input pins */ |
| 13295 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, |
| 13296 | const struct auto_pin_cfg *cfg) |
| 13297 | { |
| 13298 | struct hda_input_mux *imux = &spec->private_imux; |
| 13299 | int i, err, idx; |
| 13300 | |
| 13301 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13302 | if (alc880_is_input_pin(cfg->input_pins[i])) { |
| 13303 | idx = alc880_input_pin_idx(cfg->input_pins[i]); |
| 13304 | err = new_analog_input(spec, cfg->input_pins[i], |
| 13305 | auto_pin_cfg_labels[i], |
| 13306 | idx, 0x0b); |
| 13307 | if (err < 0) |
| 13308 | return err; |
| 13309 | imux->items[imux->num_items].label = |
| 13310 | auto_pin_cfg_labels[i]; |
| 13311 | imux->items[imux->num_items].index = |
| 13312 | alc880_input_pin_idx(cfg->input_pins[i]); |
| 13313 | imux->num_items++; |
| 13314 | } |
| 13315 | } |
| 13316 | return 0; |
| 13317 | } |
| 13318 | |
| 13319 | static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, |
| 13320 | hda_nid_t nid, int pin_type, |
| 13321 | int dac_idx) |
| 13322 | { |
| 13323 | /* set as output */ |
| 13324 | snd_hda_codec_write(codec, nid, 0, |
| 13325 | AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); |
| 13326 | snd_hda_codec_write(codec, nid, 0, |
| 13327 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); |
| 13328 | /* need the manual connection? */ |
| 13329 | if (alc880_is_multi_pin(nid)) { |
| 13330 | struct alc_spec *spec = codec->spec; |
| 13331 | int idx = alc880_multi_pin_idx(nid); |
| 13332 | snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, |
| 13333 | AC_VERB_SET_CONNECT_SEL, |
| 13334 | alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); |
| 13335 | } |
| 13336 | } |
| 13337 | |
| 13338 | static void alc662_auto_init_multi_out(struct hda_codec *codec) |
| 13339 | { |
| 13340 | struct alc_spec *spec = codec->spec; |
| 13341 | int i; |
| 13342 | |
Kailang Yang | 8c42722 | 2008-01-10 13:03:59 +0100 | [diff] [blame] | 13343 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13344 | for (i = 0; i <= HDA_SIDE; i++) { |
| 13345 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13346 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13347 | if (nid) |
Takashi Iwai | baba8ee | 2007-04-23 17:17:48 +0200 | [diff] [blame] | 13348 | alc662_auto_set_output_and_unmute(codec, nid, pin_type, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13349 | i); |
| 13350 | } |
| 13351 | } |
| 13352 | |
| 13353 | static void alc662_auto_init_hp_out(struct hda_codec *codec) |
| 13354 | { |
| 13355 | struct alc_spec *spec = codec->spec; |
| 13356 | hda_nid_t pin; |
| 13357 | |
| 13358 | pin = spec->autocfg.hp_pins[0]; |
| 13359 | if (pin) /* connect to front */ |
| 13360 | /* use dac 0 */ |
| 13361 | alc662_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); |
| 13362 | } |
| 13363 | |
| 13364 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) |
| 13365 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
| 13366 | |
| 13367 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
| 13368 | { |
| 13369 | struct alc_spec *spec = codec->spec; |
| 13370 | int i; |
| 13371 | |
| 13372 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
| 13373 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
| 13374 | if (alc662_is_input_pin(nid)) { |
| 13375 | snd_hda_codec_write(codec, nid, 0, |
| 13376 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
| 13377 | (i <= AUTO_PIN_FRONT_MIC ? |
| 13378 | PIN_VREF80 : PIN_IN)); |
| 13379 | if (nid != ALC662_PIN_CD_NID) |
| 13380 | snd_hda_codec_write(codec, nid, 0, |
| 13381 | AC_VERB_SET_AMP_GAIN_MUTE, |
| 13382 | AMP_OUT_MUTE); |
| 13383 | } |
| 13384 | } |
| 13385 | } |
| 13386 | |
| 13387 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 13388 | { |
| 13389 | struct alc_spec *spec = codec->spec; |
| 13390 | int err; |
| 13391 | static hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
| 13392 | |
| 13393 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
| 13394 | alc662_ignore); |
| 13395 | if (err < 0) |
| 13396 | return err; |
| 13397 | if (!spec->autocfg.line_outs) |
| 13398 | return 0; /* can't find valid BIOS pin config */ |
| 13399 | |
Takashi Iwai | f12ab1e | 2007-04-12 15:51:47 +0200 | [diff] [blame] | 13400 | err = alc880_auto_fill_dac_nids(spec, &spec->autocfg); |
| 13401 | if (err < 0) |
| 13402 | return err; |
| 13403 | err = alc662_auto_create_multi_out_ctls(spec, &spec->autocfg); |
| 13404 | if (err < 0) |
| 13405 | return err; |
| 13406 | err = alc662_auto_create_extra_out(spec, |
| 13407 | spec->autocfg.speaker_pins[0], |
| 13408 | "Speaker"); |
| 13409 | if (err < 0) |
| 13410 | return err; |
| 13411 | err = alc662_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], |
| 13412 | "Headphone"); |
| 13413 | if (err < 0) |
| 13414 | return err; |
| 13415 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); |
| 13416 | if (err < 0) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13417 | return err; |
| 13418 | |
| 13419 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
| 13420 | |
| 13421 | if (spec->autocfg.dig_out_pin) |
| 13422 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
| 13423 | |
| 13424 | if (spec->kctl_alloc) |
| 13425 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
| 13426 | |
| 13427 | spec->num_mux_defs = 1; |
| 13428 | spec->input_mux = &spec->private_imux; |
| 13429 | |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13430 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13431 | spec->mixers[spec->num_mixers] = alc662_capture_mixer; |
| 13432 | spec->num_mixers++; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13433 | return 1; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13434 | } |
| 13435 | |
| 13436 | /* additional initialization for auto-configuration model */ |
| 13437 | static void alc662_auto_init(struct hda_codec *codec) |
| 13438 | { |
| 13439 | alc662_auto_init_multi_out(codec); |
| 13440 | alc662_auto_init_hp_out(codec); |
| 13441 | alc662_auto_init_analog_input(codec); |
| 13442 | } |
| 13443 | |
| 13444 | static int patch_alc662(struct hda_codec *codec) |
| 13445 | { |
| 13446 | struct alc_spec *spec; |
| 13447 | int err, board_config; |
| 13448 | |
| 13449 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 13450 | if (!spec) |
| 13451 | return -ENOMEM; |
| 13452 | |
| 13453 | codec->spec = spec; |
| 13454 | |
| 13455 | board_config = snd_hda_check_board_config(codec, ALC662_MODEL_LAST, |
| 13456 | alc662_models, |
| 13457 | alc662_cfg_tbl); |
| 13458 | if (board_config < 0) { |
| 13459 | printk(KERN_INFO "hda_codec: Unknown model for ALC662, " |
| 13460 | "trying auto-probe from BIOS...\n"); |
| 13461 | board_config = ALC662_AUTO; |
| 13462 | } |
| 13463 | |
| 13464 | if (board_config == ALC662_AUTO) { |
| 13465 | /* automatic parse from the BIOS config */ |
| 13466 | err = alc662_parse_auto_config(codec); |
| 13467 | if (err < 0) { |
| 13468 | alc_free(codec); |
| 13469 | return err; |
Takashi Iwai | 8c87286f | 2007-06-19 12:11:16 +0200 | [diff] [blame] | 13470 | } else if (!err) { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13471 | printk(KERN_INFO |
| 13472 | "hda_codec: Cannot set up configuration " |
| 13473 | "from BIOS. Using base mode...\n"); |
| 13474 | board_config = ALC662_3ST_2ch_DIG; |
| 13475 | } |
| 13476 | } |
| 13477 | |
| 13478 | if (board_config != ALC662_AUTO) |
| 13479 | setup_preset(spec, &alc662_presets[board_config]); |
| 13480 | |
| 13481 | spec->stream_name_analog = "ALC662 Analog"; |
| 13482 | spec->stream_analog_playback = &alc662_pcm_analog_playback; |
| 13483 | spec->stream_analog_capture = &alc662_pcm_analog_capture; |
| 13484 | |
| 13485 | spec->stream_name_digital = "ALC662 Digital"; |
| 13486 | spec->stream_digital_playback = &alc662_pcm_digital_playback; |
| 13487 | spec->stream_digital_capture = &alc662_pcm_digital_capture; |
| 13488 | |
| 13489 | if (!spec->adc_nids && spec->input_mux) { |
| 13490 | spec->adc_nids = alc662_adc_nids; |
| 13491 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
| 13492 | } |
| 13493 | |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 13494 | spec->vmaster_nid = 0x02; |
| 13495 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13496 | codec->patch_ops = alc_patch_ops; |
| 13497 | if (board_config == ALC662_AUTO) |
| 13498 | spec->init_hook = alc662_auto_init; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 13499 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
| 13500 | if (!spec->loopback.amplist) |
| 13501 | spec->loopback.amplist = alc662_loopbacks; |
| 13502 | #endif |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13503 | |
| 13504 | return 0; |
| 13505 | } |
| 13506 | |
| 13507 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13508 | * patch entries |
| 13509 | */ |
| 13510 | struct hda_codec_preset snd_hda_preset_realtek[] = { |
| 13511 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13512 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13513 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 13514 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13515 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13516 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13517 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13518 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 13519 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 13520 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 13521 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
| 13522 | .patch = patch_alc883 }, |
| 13523 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 13524 | .patch = patch_alc662 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 13525 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13526 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13527 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 13528 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | 9c7f852 | 2006-06-28 15:08:22 +0200 | [diff] [blame] | 13529 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 13530 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13531 | {} /* terminator */ |
| 13532 | }; |